Options
All
  • Public
  • Public/Protected
  • All
Menu

Module parser

Index

Functions

fetchAndParseGraphData

  • Fetches the graph file, parses it and returns a promise of the result. The result will be undefined if the graph is empty.

    Parameters

    Returns Promise<Array<NodeDef>>

fetchAndParseMetadata

  • fetchAndParseMetadata(path: string, tracker: ProgressTracker): Promise<ArrayBuffer>
  • Fetches the metadata file, parses it and returns a promise of the result.

    Parameters

    Returns Promise<ArrayBuffer>

fetchPbTxt

  • fetchPbTxt(filepath: string): Promise<ArrayBuffer>
  • Fetches a text file and returns a promise of the result.

    Parameters

    • filepath: string

    Returns Promise<ArrayBuffer>

parseGraphPbTxt

  • parseGraphPbTxt(input: ArrayBuffer): Promise<NodeDef[]>
  • Parses an ArrayBuffer of a proto txt file into a raw Graph object.

    Parameters

    • input: ArrayBuffer

    Returns Promise<NodeDef[]>

parsePbtxtFile

  • parsePbtxtFile(input: ArrayBuffer, repeatedFields: object): Promise<Object>
  • Parses a ArrayBuffer of a proto txt file into javascript object.

    Parameters

    • input: ArrayBuffer

      The ArrayBuffer or file object implementing slice.

    • repeatedFields: object

      Map (Set) of all the repeated fields, since you can't tell directly from the pbtxt if a field is repeated or not.

      • [attrPath: string]: boolean

    Returns Promise<Object>

    The parsed object.

parseValue

  • parseValue(value: string): string | number | boolean
  • Parses a native js value, which can be either a string, boolean or number.

    Parameters

    • value: string

      The value to be parsed.

    Returns string | number | boolean

streamParse

  • streamParse(arrayBuffer: ArrayBuffer, callback: function, chunkSize?: number, delim?: string): Promise<boolean>
  • Parse a file object in a streaming fashion line by line (or custom delim). Can handle very large files.

    Parameters

    • arrayBuffer: ArrayBuffer
    • callback: function

      The callback called on each line

        • (string: any): void
        • Parameters

          • string: any

          Returns void

    • Default value chunkSize: number = 1000000

      The size of each read chunk. (optional)

    • Default value delim: string = ""

      The delimiter used to split a line. (optional)

    Returns Promise<boolean>

    A promise for when it is finished.

Object literals

GRAPH_REPEATED_FIELDS

GRAPH_REPEATED_FIELDS: object

TODO: REMOVE THIS Since proto-txt doesn't explicitly say whether an attribute is repeated (an array) or not, we keep a hard-coded list of attributes that are known to be repeated. This list is used in parsing time to convert repeated attributes into arrays even when the attribute only shows up once in the object.

node

node: boolean = true

node.attr

node.attr: boolean = true

node.attr.value.list.s

node.attr.value.list.s: boolean = true

node.attr.value.list.shape

node.attr.value.list.shape: boolean = true

node.attr.value.list.shape.dim

node.attr.value.list.shape.dim: boolean = true

node.attr.value.list.type

node.attr.value.list.type: boolean = true

node.attr.value.shape.dim

node.attr.value.shape.dim: boolean = true

node.attr.value.tensor.string_val

node.attr.value.tensor.string_val: boolean = true

node.attr.value.tensor.tensor_shape.dim

node.attr.value.tensor.tensor_shape.dim: boolean = true

node.input

node.input: boolean = true

Generated using TypeDoc