config

Facilitates the generation of complex tensorflow models, built from compositions of tensorflow functions.


class config.AntGraph(config, tensordict={}, placeholderdict={}, data=None, function_map={}, imports={}, marker='-', variable_bindings=None, graph_name='no_name', graph_dest='antpics/', develop=False)[source]

Object to store graph information from graph built with config file.

Parameters:
  • config – A plain text config file
  • tensordict – A dictionary of premade tensors represented in the config by key
  • placeholderdict – A dictionary of premade placeholder tensors represented in the config by key
  • data – A dictionary of data matrices with keys corresponding to placeholder names in graph.
  • function_map – A dictionary of function_handle:node_op pairs to use in building the graph
  • imports – A dictionary of module_name:path_to_module key value pairs for custom node_ops modules.
  • marker – The marker for representing graph structure
  • variable_bindings – A dictionary with entries of the form variable_name:value for variable replacement in config file.
  • graph_name – The name of the graph. Will be used to name the graph pdf file.
  • graph_dest – The folder to write the graph pdf and graph dot string to.
  • develop – True|False. Whether to print tensor info, while constructing the tensorflow graph.
display_graph(pdfviewer='okular')[source]

Display the pdf image of graph from config file to screen.

get_array(collection_name, index, session, graph)[source]
placeholderdict

A dictionary of tensors which are placeholders in the graph. The key should correspond to the key of the corresponding data in a data dictionary.

tensor_out

Tensor or list of tensors returned from last node of graph.

tensordict

A dictionary of tensors which are nodes in the graph.

exception config.GraphMarkerError[source]

Raised when leading character of a line (other than first) in a graph config file is not the specified level marker.

exception config.MissingDataError[source]

Raised when data needed to determine shapes is not found in the DataSet.

exception config.MissingTensorError[source]

Raised when a tensor is described by name only in the graph and it is not in a dictionary.

exception config.ProcessLookupError[source]

Raised when lookup receives a dataname argument without a corresponding value in it’s DataSet and there is not already a Placeholder with that name.

exception config.RandomNodeFunctionError[source]

Raised when something strange happened with a node function call.

exception config.UndefinedVariableError[source]

Raised when a a variable in config is not a key in variable_bindings map handed to graph_setup.

exception config.UnsupportedNodeError[source]

Raised when a config file calls a function that is not defined, i.e., has not been imported, or is not in the node_ops base file.

config.ph_rep(ph)[source]

Convenience function for representing a tensorflow placeholder.

Parameters:ph – A tensorflow placeholder.
Returns:A string representing the placeholder.
config.testGraph(config, marker='-', graph_dest='antpics/', graph_name='test_graph')[source]
Parameters:
  • config – A graph specification in .config format.
  • marker – A character or string of characters to delimit graph edges.
  • graph_dest – Where to save the graphviz pdf and associated dot file.
  • graph_name – A name for the graph (without extension)