Options
All
  • Public
  • Public/Protected
  • All
Menu

Module tfgraph

Index

Type aliases

TensorShape

TensorShape: number[]

Variables

EDGE_KEY_DELIM

EDGE_KEY_DELIM: "--" = "--"

LARGE_ATTRS_KEY

LARGE_ATTRS_KEY: "_too_large_attrs" = "_too_large_attrs"

Attribute key used for storing attributes that are too large.

LIMIT_ATTR_SIZE

LIMIT_ATTR_SIZE: 1024 = 1024

Maximum allowed size in bytes, before the attribute is considered large and filtered out of the graph.

NAMESPACE_DELIM

NAMESPACE_DELIM: "/" = "/"

Delimiter used in node names to denote namespaces.

OUTPUT_SHAPES_KEY

OUTPUT_SHAPES_KEY: "_output_shapes" = "_output_shapes"

Attribute key reserved for the shapes of the output tensors.

ROOT_NAME

ROOT_NAME: "__root__" = "__root__"

Functions

addEdgeToGraph

build

createGraph

  • createGraph<N, E>(name: string, type: any, opt?: object): Graph<N, E>
  • Create a new graphlib.Graph() instance with default parameters

    Type parameters

    • N

    • E

    Parameters

    • name: string
    • type: any
    • Default value opt: object = {}

    Returns Graph<N, E>

createMetaedge

  • createMetaedge(v: string, w: string): Metaedge

createMetanode

  • createMetanode(name: string, opt?: object): Metanode

createSeriesNode

  • createSeriesNode(prefix: string, suffix: string, parent: string, clusterId: number, name: string): SeriesNode
  • Parameters

    • prefix: string
    • suffix: string
    • parent: string
    • clusterId: number
    • name: string

    Returns SeriesNode

degreeSequence

  • degreeSequence(graph: Graph<any, any>): number[]
  • Returns a list of the degrees of each node in the graph.

    Parameters

    Returns number[]

extractOutputShapes

  • Extracts the shapes of the output tensors from the attr property in the node proto.

    Parameters

    • attr: object[]
      • key: string
      • value: any

    Returns TensorShape[]

getEmbedPredicate

  • getEmbedPredicate(types: string[]): (Anonymous function)
  • Create a predicate for checking whether a node should be embedded based on the specified types.

    Parameters

    • types: string[]

    Returns (Anonymous function)

getGroupSeriesNodeButtonString

  • getGroupSeriesNodeButtonString(group: SeriesGroupingType): "Ungroup this series of nodes" | "Group this series of nodes"
  • Returns the string for the series node grouping toggle button, dependant on the provided current SeriesGroupingType.

    Parameters

    Returns "Ungroup this series of nodes" | "Group this series of nodes"

getHierarchicalPath

  • getHierarchicalPath(name: string, seriesNames?: object): string[]
  • Returns the hierarchical path of the current node, based on the node's name. For example, if the name is 'a/b/c', the returned path is ['a', 'a/b', 'a/b/c'].

    Parameters

    • name: string
    • Optional seriesNames: object
      • [name: string]: string

    Returns string[]

getIncludeNodeButtonString

  • getIncludeNodeButtonString(include: InclusionType): "Add to main graph" | "Remove from main graph"
  • Returns the string for the node inclusion toggle button, dependant on the provided current InclusionType.

    Parameters

    Returns "Add to main graph" | "Remove from main graph"

getSeriesNodeName

  • getSeriesNodeName(prefix: string, suffix: string, parent: string, startId?: number, endId?: number): string
  • Parameters

    • prefix: string
    • suffix: string
    • parent: string
    • Optional startId: number
    • Optional endId: number

    Returns string

getStrictName

  • getStrictName(name: string): string
  • Returns a strict node name (name => name/(name)) to avoid conflicts where the node name is also a namespace.

    Parameters

    • name: string

    Returns string

hasSimilarDegreeSequence

  • hasSimilarDegreeSequence(graph1: Graph<any, any>, graph2: Graph<any, any>): boolean
  • Returns if the degree sequence of the two graphs is the same.

    Parameters

    Returns boolean

mapStrictHierarchy

  • mapStrictHierarchy(nodeNames: string[], embeddingNodeNames: string[]): object
  • For each op node (embedding or non-embedding), rename it if there is a non-embedding node under its namespace. For example, assume node name 'A'. If there is a non-embedding node under its namespace (e.g. 'A/B'), 'A' will be renamed to 'A/(A)'. Then the namespace 'A' will contain 2 nodes: '(A)' and 'B'. If all the nodes under 'A' are embedding nodes (e.g. constant and summary), keep 'A' as an Op node and don't create a namespace.

    Parameters

    • nodeNames: string[]

      An array of regular (non-embedding) node names.

    • embeddingNodeNames: string[]

      An array of embedding node names.

    Returns object

    Dictionary object mapping names that need to be renamed to new names.

    • [oldName: string]: string

normalizeInputs

  • Normalizes the inputs and extracts associated metadata: 1) Inputs can contain a colon followed by a number at the end (e.g. inputName:1) and we remove this from the input name, and take note that the input was numbered. 2) Control dependency inputs contain caret at the beginning and we remove this and annotate the edge as a control dependency.

    Parameters

    • inputs: string[]

      Array of unnormalized names of input nodes.

    Returns NormalizedInput[]

toggleNodeSeriesGroup

  • toggleNodeSeriesGroup(map: object, name: string): void
  • Toggle the node series grouping option in the provided map, setting it to ungroup if the series is not already in the map.

    Parameters

    Returns void

Generated using TypeDoc