@@ -18,8 +18,8 @@ limitations under the License.
18
18
import * as d3 from 'd3' ;
19
19
import { graphlib } from 'dagre' ;
20
20
import * as _ from 'lodash' ;
21
- import * as tf_graph_common from './common' ;
22
- import * as tf_graph from './graph' ;
21
+ import * as tfGraphCommon from './common' ;
22
+ import * as tfGraph from './graph' ;
23
23
import {
24
24
BridgeNode ,
25
25
createGraph ,
@@ -37,7 +37,7 @@ import {
37
37
OpNodeImpl ,
38
38
} from './graph' ;
39
39
import { Hierarchy } from './hierarchy' ;
40
- import * as tf_graph_util from './util' ;
40
+ import * as tfGraphUtil from './util' ;
41
41
42
42
export type EdgeData = {
43
43
v : string ;
@@ -199,7 +199,7 @@ const PARAMS = {
199
199
*/
200
200
const nodeDisplayNameRegex = new RegExp (
201
201
'^(?:' +
202
- tf_graph . FUNCTION_LIBRARY_NODE_PREFIX +
202
+ tfGraph . FUNCTION_LIBRARY_NODE_PREFIX +
203
203
')?(\\w+)_[a-z0-9]{8}(?:_\\d+)?$'
204
204
) ;
205
205
/**
@@ -301,14 +301,11 @@ export class RenderGraphInfo {
301
301
. domain ( [ 0 , maxComputeTime as unknown as number ] )
302
302
. range ( PARAMS . minMaxColors ) ;
303
303
this . edgeWidthSizedBasedScale = this . hierarchy . hasShapeInfo
304
- ? tf_graph_common . EDGE_WIDTH_SIZE_BASED_SCALE
304
+ ? tfGraphCommon . EDGE_WIDTH_SIZE_BASED_SCALE
305
305
: d3
306
306
. scaleLinear ( )
307
307
. domain ( [ 1 , this . hierarchy . maxMetaEdgeSize ] )
308
- . range ( [
309
- tf_graph_common . MIN_EDGE_WIDTH ,
310
- tf_graph_common . MAX_EDGE_WIDTH ,
311
- ] ) ;
308
+ . range ( [ tfGraphCommon . MIN_EDGE_WIDTH , tfGraphCommon . MAX_EDGE_WIDTH ] ) ;
312
309
}
313
310
/**
314
311
* Get a previously created RenderNodeInfo by its node name.
@@ -376,8 +373,7 @@ export class RenderGraphInfo {
376
373
}
377
374
// We only fade nodes when we're displaying stats.
378
375
renderInfo . isFadedOut =
379
- this . displayingStats &&
380
- ! tf_graph_util . hasDisplayableNodeStats ( node . stats ) ;
376
+ this . displayingStats && ! tfGraphUtil . hasDisplayableNodeStats ( node . stats ) ;
381
377
var deviceHistogram : { } | null = null ;
382
378
var xlaClusterHistogram : { } | null = null ;
383
379
var opCompatibility : number | null = null ;
@@ -628,7 +624,7 @@ export class RenderGraphInfo {
628
624
newPrefix : string ,
629
625
functionOutputIndexToNode : { [ key : string ] : Node }
630
626
) : Metanode {
631
- const newMetanode = tf_graph . createMetanode (
627
+ const newMetanode = tfGraph . createMetanode (
632
628
libraryMetanode . name . replace ( oldPrefix , newPrefix )
633
629
) ;
634
630
// Copy over various properties.
@@ -685,7 +681,7 @@ export class RenderGraphInfo {
685
681
// This logic should never run because the meta graph should only
686
682
// contain meta and op nodes.
687
683
console . warn (
688
- node . name + ' is oddly neither a metanode nor an opnode.'
684
+ ` ${ node . name } is oddly neither a metanode nor an opnode.`
689
685
) ;
690
686
}
691
687
} ) ;
@@ -873,7 +869,7 @@ export class RenderGraphInfo {
873
869
// This node is not a function call.
874
870
return ;
875
871
}
876
- if ( childName . indexOf ( tf_graph . FUNCTION_LIBRARY_NODE_PREFIX ) === 0 ) {
872
+ if ( childName . indexOf ( tfGraph . FUNCTION_LIBRARY_NODE_PREFIX ) === 0 ) {
877
873
// Do not replace library functions in the graph. The library
878
874
// functions serve as templates for other nodes.
879
875
return ;
@@ -951,7 +947,7 @@ export class RenderGraphInfo {
951
947
if ( ! _ . isEmpty ( this . hierarchy . libraryFunctions ) ) {
952
948
this . buildSubhierarchiesForNeededFunctions ( metagraph ) ;
953
949
}
954
- if ( nodeName === tf_graph . ROOT_NAME ) {
950
+ if ( nodeName === tfGraph . ROOT_NAME ) {
955
951
// Add all metanodes representing library function templates into the
956
952
// library function scene group for the root node.
957
953
_ . forOwn (
@@ -1344,11 +1340,11 @@ export class RenderGraphInfo {
1344
1340
let metaedge = metagraph . edge ( edgeObj ) ;
1345
1341
let renderMetaedgeInfo = new RenderMetaedgeInfo ( metaedge as any ) ;
1346
1342
_ . forEach ( renderMetaedgeInfo . metaedge . baseEdgeList , ( baseEdge ) => {
1347
- const sourcePathList = baseEdge . v ! . split ( tf_graph . NAMESPACE_DELIM ) ;
1343
+ const sourcePathList = baseEdge . v ! . split ( tfGraph . NAMESPACE_DELIM ) ;
1348
1344
for ( let i = sourcePathList . length ; i >= 0 ; i -- ) {
1349
1345
const fromBeginningPathList = sourcePathList . slice ( 0 , i ) ;
1350
1346
const node = this . hierarchy . node (
1351
- fromBeginningPathList . join ( tf_graph . NAMESPACE_DELIM )
1347
+ fromBeginningPathList . join ( tfGraph . NAMESPACE_DELIM )
1352
1348
) ;
1353
1349
if ( node ) {
1354
1350
if (
@@ -1359,7 +1355,7 @@ export class RenderGraphInfo {
1359
1355
// Expand all hierarchies including the parent.
1360
1356
const currentNodeName = fromBeginningPathList
1361
1357
. slice ( 0 , j )
1362
- . join ( tf_graph . NAMESPACE_DELIM ) ;
1358
+ . join ( tfGraph . NAMESPACE_DELIM ) ;
1363
1359
if ( ! currentNodeName ) {
1364
1360
continue ;
1365
1361
}
@@ -1507,7 +1503,7 @@ export class AnnotationList {
1507
1503
ellipsisNode . setNumMoreNodes ( ++ ellipsisNode . numMoreNodes ) ;
1508
1504
return ;
1509
1505
}
1510
- let ellipsisNode = new tf_graph . EllipsisNodeImpl ( 1 ) ;
1506
+ let ellipsisNode = new tfGraph . EllipsisNodeImpl ( 1 ) ;
1511
1507
this . list . push (
1512
1508
new Annotation (
1513
1509
ellipsisNode ,
@@ -1682,7 +1678,7 @@ export class RenderNodeInfo {
1682
1678
// Only use the portion beyond the last delimiter as the display
1683
1679
// name.
1684
1680
this . displayName = node . name . substring (
1685
- node . name . lastIndexOf ( tf_graph . NAMESPACE_DELIM ) + 1
1681
+ node . name . lastIndexOf ( tfGraph . NAMESPACE_DELIM ) + 1
1686
1682
) ;
1687
1683
if ( node . type === NodeType . META && ( node as Metanode ) . associatedFunction ) {
1688
1684
// Function names are suffixed with a length-8 hexadecimal string
@@ -1700,13 +1696,13 @@ export class RenderNodeInfo {
1700
1696
// common scenario.
1701
1697
this . displayName = match [ 1 ] ;
1702
1698
} else if (
1703
- _ . startsWith ( this . displayName , tf_graph . FUNCTION_LIBRARY_NODE_PREFIX )
1699
+ _ . startsWith ( this . displayName , tfGraph . FUNCTION_LIBRARY_NODE_PREFIX )
1704
1700
) {
1705
1701
// The string does not match the usual pattern for how functions are
1706
1702
// named. Just use the entire second portion of the string as the name
1707
1703
// if we can successfully remove the prefix.
1708
1704
this . displayName = this . displayName . substring (
1709
- tf_graph . FUNCTION_LIBRARY_NODE_PREFIX . length
1705
+ tfGraph . FUNCTION_LIBRARY_NODE_PREFIX . length
1710
1706
) ;
1711
1707
}
1712
1708
}
@@ -1750,7 +1746,7 @@ export class RenderMetaedgeInfo {
1750
1746
weight : number ;
1751
1747
/**
1752
1748
* X and Y coordinate pairs of the points in the path of the edge.
1753
- * @see tf_graph .node.subsceneAdjustPaths
1749
+ * @see tfGraph .node.subsceneAdjustPaths
1754
1750
*/
1755
1751
points : Point [ ] ;
1756
1752
/**
@@ -1822,7 +1818,7 @@ function setGraphDepth(graph: graphlib.Graph, depth: number) {
1822
1818
} ) ;
1823
1819
}
1824
1820
export class RenderGroupNodeInfo extends RenderNodeInfo {
1825
- override node : GroupNode ;
1821
+ declare node : GroupNode ;
1826
1822
/**
1827
1823
* The core graph is derived from the underlying node's metagraph, minus
1828
1824
* the extracted source-like and sink-like nodes.
@@ -1851,10 +1847,7 @@ export class RenderGroupNodeInfo extends RenderNodeInfo {
1851
1847
isolatedOutExtract : RenderNodeInfo [ ] ;
1852
1848
/** Array of nodes to show in the function library scene group. */
1853
1849
libraryFunctionsExtract : RenderNodeInfo [ ] ;
1854
- constructor (
1855
- groupNode : GroupNode ,
1856
- graphOptions : tf_graph . LabeledGraphOptions
1857
- ) {
1850
+ constructor ( groupNode : GroupNode , graphOptions : tfGraph . LabeledGraphOptions ) {
1858
1851
super ( groupNode ) ;
1859
1852
let metagraph = groupNode . metagraph ;
1860
1853
let gl = metagraph . graph ( ) as any ;
@@ -1999,7 +1992,7 @@ function extractSpecifiedNodes(renderNode: RenderGroupNodeInfo) {
1999
1992
let renderInfo = graph . node ( n ) ;
2000
1993
if (
2001
1994
renderInfo . node . include === InclusionType . EXCLUDE &&
2002
- ! n . startsWith ( tf_graph . FUNCTION_LIBRARY_NODE_PREFIX )
1995
+ ! n . startsWith ( tfGraph . FUNCTION_LIBRARY_NODE_PREFIX )
2003
1996
) {
2004
1997
// Move the node if the node is excluded and not part of the library
2005
1998
// function scene group, which contains nodes that do not represent ops in
@@ -2287,7 +2280,7 @@ export function expandUntilNodeIsShown(
2287
2280
let renderNode = renderHierarchy . getRenderNodeByName ( nodeName ) ;
2288
2281
for ( let i = 1 ; i < splitTensorName . length ; i ++ ) {
2289
2282
// Op nodes are not expandable.
2290
- if ( renderNode . node . type === tf_graph . NodeType . OP ) {
2283
+ if ( renderNode . node . type === tfGraph . NodeType . OP ) {
2291
2284
break ;
2292
2285
}
2293
2286
renderHierarchy . buildSubhierarchy ( nodeName ) ;
0 commit comments