Browse Source

Eager mode for tf.add works.

tags/v0.20
Oceania2018 5 years ago
parent
commit
692ba77334
3 changed files with 4 additions and 6 deletions
  1. BIN
      docs/assets/eager-mode-add.png
  2. +3
    -4
      src/TensorFlowNET.Core/Eager/pywrap_tfe_src.cs
  3. +1
    -2
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs

BIN
docs/assets/eager-mode-add.png View File

Before After
Width: 1476  |  Height: 777  |  Size: 109 kB

+ 3
- 4
src/TensorFlowNET.Core/Eager/pywrap_tfe_src.cs View File

@@ -63,12 +63,11 @@ namespace Tensorflow.Eager
var retVals = new IntPtr[num_retvals];
c_api.TFE_Execute(op, retVals, ref num_retvals, status);

var h = c_api.TFE_NewTensorHandle(retVals[0], status);
var data = new Tensor(h);
var t = c_api.TFE_TensorHandleResolve(retVals[0], status);
status.Check(true);
}

throw new NotImplementedException("");
return new EagerTensor(t);
}
}

/// <summary>


+ 1
- 2
src/TensorFlowNET.Core/Operations/gen_math_ops.cs View File

@@ -142,11 +142,10 @@ namespace Tensorflow

public static EagerTensor add(Tensor x, Tensor y, string name = null)
{
// _op_def_lib._apply_op_helper("Add", name, args: new { x, y });

if (tf.context.executing_eagerly())
{
var _result = pywrap_tfe_src.TFE_Py_FastPathExecute(tf.context, "", "Add", name, new[] { x, y });
return _result;
}

return null;


Loading…
Cancel
Save