aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-05-06 04:59:04 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-05-06 06:02:05 -0700
commit08ab61856212fd4dd4bdcaa1f05f92cffbd39ee7 (patch)
treef69ae34b7f456f0a70919d84daddd45ed01fe7ef
parent357b19ee7f39d46b32639847e260dac2312b3da5 (diff)
Move declared modules, interfaces, and variables for Tensorboard graph visualizer to a new
externs.ts file. This file contains compiler stubs for external dependencies whos implementations are defined at runtime. Change: 121668070
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/common.ts66
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/externs.ts85
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/tf-graph-common.html1
3 files changed, 86 insertions, 66 deletions
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts
index 51cdee3466..1ed300b03e 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts
@@ -13,67 +13,6 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
-declare module graphlib {
-
- interface GraphOptions {
- name?: string;
- /**
- * Direction for rank nodes. Can be TB, BT, LR, or RL, where T = top,
- * B = bottom, L = left, and R = right.
- */
- rankdir?: string;
- type?: string|number;
- /** Number of pixels between each rank in the layout. */
- ranksep?: number;
- /** Number of pixels that separate nodes horizontally in the layout. */
- nodesep?: number;
- /** Number of pixels that separate edges horizontally in the layout */
- edgesep?: number;
- }
-
- export interface EdgeObject {
- v: string;
- w: string;
- name?: string;
- }
-
- export class Graph<N, E> {
- constructor(opt?: Object);
- setNode(name: string, value?: N): void;
- hasNode(name: string): boolean;
- setEdge(fromName: string, toName: string, value?: E): void;
- hasEdge(fromName: string, toName: string): boolean;
- edge(fromName: string, toName: string): E;
- edge(edgeObject: EdgeObject): E;
- removeEdge(v: string, w: string): void;
- nodes(): string[];
- node(name: string): N;
- removeNode(name: string): void;
- setGraph(graphOptions: GraphOptions): void;
- graph(): GraphOptions;
- nodeCount(): number;
- neighbors(name: string): string[];
- successors(name: string): string[];
- predecessors(name: string): string[];
- edges(): EdgeObject[];
- outEdges(name: string): E[];
- inEdges(name: string): E[];
- /**
- * Returns those nodes in the graph that have no in-edges.
- * Takes O(|V|) time.
- */
- sources(): string[];
- /**
- * Remove the node with the id v in the graph or do nothing if
- * the node is not in the graph. If the node was removed this
- * function also removes any incident edges. Returns the graph,
- * allowing this to be chained with other functions. Takes O(|E|) time.
- */
- removeNode(name: string): Graph<N, E>;
- setParent(name: string, parentName: string): void;
- }
-}
-
module tf {
/**
* Recommended delay (ms) when running an expensive task asynchronously
@@ -299,8 +238,3 @@ export interface TFNodeOutput {
};
}
} // close module tf
-
-/**
- * Declaring dagre var used for dagre layout.
- */
-declare var dagre: { layout(graph: graphlib.Graph<any, any>): void; };
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/externs.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/externs.ts
new file mode 100644
index 0000000000..2341d3a028
--- /dev/null
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/externs.ts
@@ -0,0 +1,85 @@
+/* Copyright 2015 Google Inc. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the 'License');
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an 'AS IS' BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+/**
+ * @fileoverview Extern declarations for tensorflow graph visualizer.
+ * This file contains compiler stubs for external dependencies whos
+ * implementations are defined at runtime.
+ */
+
+declare module graphlib {
+ interface GraphOptions {
+ name?: string;
+ /**
+ * Direction for rank nodes. Can be TB, BT, LR, or RL, where T = top,
+ * B = bottom, L = left, and R = right.
+ */
+ rankdir?: string;
+ type?: string|number;
+ /** Number of pixels between each rank in the layout. */
+ ranksep?: number;
+ /** Number of pixels that separate nodes horizontally in the layout. */
+ nodesep?: number;
+ /** Number of pixels that separate edges horizontally in the layout */
+ edgesep?: number;
+ }
+
+ export interface EdgeObject {
+ v: string;
+ w: string;
+ name?: string;
+ }
+
+ export class Graph<N, E> {
+ constructor(opt?: Object);
+ setNode(name: string, value?: N): void;
+ hasNode(name: string): boolean;
+ setEdge(fromName: string, toName: string, value?: E): void;
+ hasEdge(fromName: string, toName: string): boolean;
+ edge(fromName: string, toName: string): E;
+ edge(edgeObject: EdgeObject): E;
+ removeEdge(v: string, w: string): void;
+ nodes(): string[];
+ node(name: string): N;
+ removeNode(name: string): void;
+ setGraph(graphOptions: GraphOptions): void;
+ graph(): GraphOptions;
+ nodeCount(): number;
+ neighbors(name: string): string[];
+ successors(name: string): string[];
+ predecessors(name: string): string[];
+ edges(): EdgeObject[];
+ outEdges(name: string): E[];
+ inEdges(name: string): E[];
+ /**
+ * Returns those nodes in the graph that have no in-edges.
+ * Takes O(|V|) time.
+ */
+ sources(): string[];
+ /**
+ * Remove the node with the id v in the graph or do nothing if
+ * the node is not in the graph. If the node was removed this
+ * function also removes any incident edges. Returns the graph,
+ * allowing this to be chained with other functions. Takes O(|E|) time.
+ */
+ removeNode(name: string): Graph<N, E>;
+ setParent(name: string, parentName: string): void;
+ }
+}
+
+/**
+ * Declaring dagre var used for dagre layout.
+ */
+declare var dagre: {layout(graph: graphlib.Graph<any, any>): void;};
diff --git a/tensorflow/tensorboard/components/tf-graph-common/tf-graph-common.html b/tensorflow/tensorboard/components/tf-graph-common/tf-graph-common.html
index 3ef0c63335..d3fc4c2ef1 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/tf-graph-common.html
+++ b/tensorflow/tensorboard/components/tf-graph-common/tf-graph-common.html
@@ -4,6 +4,7 @@
<link rel="import" href="../tf-imports/lodash.html">
<script src="lib/common.js"></script>
+<script src="lib/externs.js"></script>
<script src="lib/graph.js"></script>
<script src="lib/parser.js"></script>
<script src="lib/hierarchy.js"></script>