|
|
|
@@ -7,7 +7,26 @@ using System.Runtime.InteropServices; |
|
|
|
using System.Text; |
|
|
|
|
|
|
|
namespace Tensorflow |
|
|
|
{ |
|
|
|
{
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 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 an 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.get_default_session().run(op)`.
|
|
|
|
/// </summary> |
|
|
|
public partial class Operation : ITensorOrOperation |
|
|
|
{ |
|
|
|
private readonly IntPtr _handle; // _c_op in python |
|
|
|
@@ -98,6 +117,13 @@ namespace Tensorflow |
|
|
|
case Operation c1: |
|
|
|
control_input_ops.Add(c1); |
|
|
|
break; |
|
|
|
case Tensor tensor: |
|
|
|
control_input_ops.Add(tensor.op); |
|
|
|
break; |
|
|
|
// TODO: IndexedSlices don't yet exist, but once they do, this needs to be uncommented |
|
|
|
//case IndexedSlices islices: |
|
|
|
// control_input_ops.Add(islices.op); |
|
|
|
// break; |
|
|
|
default: |
|
|
|
throw new NotImplementedException($"Control input must be an Operation, a Tensor, or IndexedSlices: {c}"); |
|
|
|
} |
|
|
|
|