Useful aliases

tf.contrib.graph_editor.ph(dtype, shape=None, scope=None)

Create a tf.placeholder for the Graph Editor.

Note that the correct graph scope must be set by the calling function. The placeholder is named using the function placeholder_name (with no tensor argument).

Args:
  • dtype: the tensor type.
  • shape: the tensor shape (optional).
  • scope: absolute scope within which to create the placeholder. None means that the scope of t is preserved. "" means the root scope.
Returns:

A newly created tf.placeholder.


tf.contrib.graph_editor.sgv(*args, **kwargs)

Create a SubGraphView from selected operations and passthrough tensors.

Args:
  • *args: list of 1) regular expressions (compiled or not) or 2) (array of) tf.Operation 3) (array of) tf.Tensor. Those objects will be converted into a list of operations and a list of candidate for passthrough tensors.
  • **kwargs: keyword graph is used 1) to check that the ops and ts are from the correct graph 2) for regular expression query
Returns:

A subgraph view.

Raises:
  • TypeError: if the optional keyword argument graph is not a tf.Graph or if an argument in args is not an (array of) tf.Tensor or an (array of) tf.Operation or a string or a regular expression.
  • ValueError: if one of the keyword arguments is unexpected.

tf.contrib.graph_editor.sgv_scope(scope, graph)

Make a subgraph from a name scope.

Args:
  • scope: the name of the scope.
  • graph: the tf.Graph.
Returns:

A subgraph view representing the given scope.


tf.contrib.graph_editor.ts(*args, **kwargs)

Helper to select tensors.

Args:
  • *args: list of 1) regular expressions (compiled or not) or 2) (array of) tf.Tensor. tf.Operation instances are silently ignored.
  • **kwargs: 'graph': tf.Graph in which to perform the regex query.This is required when using regex. 'positive_filter': an elem if selected only if positive_filter(elem) is True. This is optional. 'restrict_ts_regex': a regular expression is ignored if it doesn't start with the substring "(?#ts)".
Returns:

A list of tf.Tensor.

Raises:
  • TypeError: if the optional keyword argument graph is not a tf.Graph or if an argument in args is not an (array of) tf.Tensor or an (array of) tf.Operation (silently ignored) or a string or a regular expression.
  • ValueError: if one of the keyword arguments is unexpected or if a regular expression is used without passing a graph as a keyword argument.

tf.contrib.graph_editor.ops(*args, **kwargs)

Helper to select operations.

Args:
  • *args: list of 1) regular expressions (compiled or not) or 2) (array of) tf.Operation. tf.Tensor instances are silently ignored.
  • **kwargs: 'graph': tf.Graph in which to perform the regex query.This is required when using regex. 'positive_filter': an elem if selected only if positive_filter(elem) is True. This is optional. 'restrict_ops_regex': a regular expression is ignored if it doesn't start with the substring "(?#ops)".
Returns:

A list of tf.Operation.

Raises:
  • TypeError: if the optional keyword argument graph is not a tf.Graph or if an argument in args is not an (array of) tf.Operation or an (array of) tf.Tensor (silently ignored) or a string or a regular expression.
  • ValueError: if one of the keyword arguments is unexpected or if a regular expression is used without passing a graph as a keyword argument.

class tf.contrib.graph_editor.matcher

Graph match class.


tf.contrib.graph_editor.matcher.__call__(op) {:#matcher.call}

Evaluate if the op matches or not.


tf.contrib.graph_editor.matcher.__init__(positive_filter) {:#matcher.init}

Graph match constructor.


tf.contrib.graph_editor.matcher.control_input_ops(*args)

Add input matches.


tf.contrib.graph_editor.matcher.input_ops(*args)

Add input matches.


tf.contrib.graph_editor.matcher.output_ops(*args)

Add output matches.