Skip to content

Commit 692ba77

Browse files
committed
Eager mode for tf.add works.
1 parent f9070c5 commit 692ba77

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

docs/assets/eager-mode-add.png

107 KB
Loading

src/TensorFlowNET.Core/Eager/pywrap_tfe_src.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ public static EagerTensor TFE_Py_FastPathExecute(Context ctx,
6363
var retVals = new IntPtr[num_retvals];
6464
c_api.TFE_Execute(op, retVals, ref num_retvals, status);
6565

66-
var h = c_api.TFE_NewTensorHandle(retVals[0], status);
67-
var data = new Tensor(h);
66+
var t = c_api.TFE_TensorHandleResolve(retVals[0], status);
6867
status.Check(true);
69-
}
7068

71-
throw new NotImplementedException("");
69+
return new EagerTensor(t);
70+
}
7271
}
7372

7473
/// <summary>

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,10 @@ public static Tensor asin(Tensor x, string name = null)
142142

143143
public static EagerTensor add(Tensor x, Tensor y, string name = null)
144144
{
145-
// _op_def_lib._apply_op_helper("Add", name, args: new { x, y });
146-
147145
if (tf.context.executing_eagerly())
148146
{
149147
var _result = pywrap_tfe_src.TFE_Py_FastPathExecute(tf.context, "", "Add", name, new[] { x, y });
148+
return _result;
150149
}
151150

152151
return null;

0 commit comments

Comments
 (0)