LostTech.TensorFlow : API Documentation

Type Operation

Namespace tensorflow

Parent PythonObjectContainer

Interfaces IOperation

Represents a graph node that performs computation on tensors.

An `Operation` is a node in a TensorFlow `Graph` that takes zero or more `Tensor` objects as input, and produces zero or more `Tensor` objects as output. Objects of type `Operation` are created by calling a Python op constructor (such as tf.matmul) or tf.Graph.create_op.

For example `c = tf.matmul(a, b)` creates an `Operation` of type "MatMul" that takes tensors `a` and `b` as input, and produces `c` as output.

After the graph has been launched in a session, an `Operation` can be executed by passing it to tf.Session.run. `op.run()` is a shortcut for calling `tf.compat.v1.get_default_session().run(op)`.

Methods

Properties

Public instance methods

object colocation_groups_dyn()

Returns the list of colocation groups of the op.

object get_attr(string name)

Returns the value of the attr of this op with the given `name`.
Parameters
string name
The name of the attr to fetch.
Returns
object
The value of the attr, as a Python object.

object get_attr_dyn(object name)

Returns the value of the attr of this op with the given `name`.
Parameters
object name
The name of the attr to fetch.
Returns
object
The value of the attr, as a Python object.

void run(IDictionary<object, object> feed_dict, object session)

Runs this operation in a `Session`.

Calling this method will execute all preceding operations that produce the inputs needed for this operation.

*N.B.* Before invoking `Operation.run()`, its graph must have been launched in a session, and either a default session must be available, or `session` must be specified explicitly.
Parameters
IDictionary<object, object> feed_dict
A dictionary that maps `Tensor` objects to feed values. See tf.Session.run for a description of the valid feed values.
object session
(Optional.) The `Session` to be used to run to this operation. If none, the default session will be used.

object run_dyn(object feed_dict, object session)

Runs this operation in a `Session`.

Calling this method will execute all preceding operations that produce the inputs needed for this operation.

*N.B.* Before invoking `Operation.run()`, its graph must have been launched in a session, and either a default session must be available, or `session` must be specified explicitly.
Parameters
object feed_dict
A dictionary that maps `Tensor` objects to feed values. See tf.Session.run for a description of the valid feed values.
object session
(Optional.) The `Session` to be used to run to this operation. If none, the default session will be used.

object values_dyn()

DEPRECATED: Use outputs.

Public properties

IList<Operation> control_inputs get;

The `Operation` objects on which this op has a control dependency.

Before this op is executed, TensorFlow will ensure that the operations in `self.control_inputs` have finished executing. This mechanism can be used to run ops sequentially for performance reasons, or to ensure that the side effects of an op are observed in the correct order.

object control_inputs_dyn get;

The `Operation` objects on which this op has a control dependency.

Before this op is executed, TensorFlow will ensure that the operations in `self.control_inputs` have finished executing. This mechanism can be used to run ops sequentially for performance reasons, or to ensure that the side effects of an op are observed in the correct order.

object device get;

The name of the device to which this op has been assigned, if any.

object device_dyn get;

The name of the device to which this op has been assigned, if any.

Graph graph get;

The `Graph` that contains this operation.

object graph_dyn get;

The `Graph` that contains this operation.

IList<Tensor> inputs get;

The list of `Tensor` objects representing the data inputs of this op.

object inputs_dyn get;

The list of `Tensor` objects representing the data inputs of this op.

object name get;

The full name of this operation.

object name_dyn get;

The full name of this operation.

object node_def get;

Returns the `NodeDef` representation of this operation.

object node_def_dyn get;

Returns the `NodeDef` representation of this operation.

object op_def get;

Returns the `OpDef` proto that represents the type of this op.

object op_def_dyn get;

Returns the `OpDef` proto that represents the type of this op.

IList<Tensor> outputs get;

The list of `Tensor` objects representing the outputs of this op.

object outputs_dyn get;

The list of `Tensor` objects representing the outputs of this op.

object PythonObject get;

ValueTuple<object> traceback get;

Returns the call stack from when this operation was constructed.

object traceback_dyn get;

Returns the call stack from when this operation was constructed.

ValueTuple<object> traceback_with_start_lines get;

Same as traceback but includes start line of function definition.

object traceback_with_start_lines_dyn get;

Same as traceback but includes start line of function definition.

object type get;

The type of the op (e.g. `"MatMul"`).

object type_dyn get;

The type of the op (e.g. `"MatMul"`).