Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/TensorFlowNET.Core/APIs/tf.math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ public static unsafe Tensor add(Tensor a, Tensor b)
return gen_math_ops.add(a, b);
}

public static unsafe Tensor sub(Tensor a, Tensor b)
{
return gen_math_ops.sub(a, b);
}

public static unsafe Tensor multiply(Tensor x, Tensor y)
{
return gen_math_ops.mul(x, y);
Expand Down
17 changes: 14 additions & 3 deletions src/TensorFlowNET.Core/Operations/gen_math_ops.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@ public static class gen_math_ops
{
public static OpDefLibrary _op_def_lib = new OpDefLibrary();

public static Tensor add(Tensor a, Tensor b)
public static Tensor add(Tensor x, Tensor y)
{
var keywords = new Dictionary<string, object>();
keywords.Add("x", a);
keywords.Add("y", b);
keywords.Add("x", x);
keywords.Add("y", y);

var _op = _op_def_lib._apply_op_helper("Add", name: "add", keywords: keywords);

return new Tensor(_op, 0, _op.OutputType(0));
}

public static Tensor sub(Tensor x, Tensor y)
{
var keywords = new Dictionary<string, object>();
keywords.Add("x", x);
keywords.Add("y", y);

var _op = _op_def_lib._apply_op_helper("Sub", name: "sub", keywords: keywords);

return new Tensor(_op, 0, _op.OutputType(0));
}

public static Tensor mul(Tensor x, Tensor y)
{
var keywords = new Dictionary<string, object>();
Expand Down