Skip to content

Commit 8bfe91c

Browse files
committed
gen_math_ops.sub SciSharp#97
1 parent 530fe1c commit 8bfe91c

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/TensorFlowNET.Core/APIs/tf.math.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ public static unsafe Tensor add(Tensor a, Tensor b)
1111
return gen_math_ops.add(a, b);
1212
}
1313

14+
public static unsafe Tensor sub(Tensor a, Tensor b)
15+
{
16+
return gen_math_ops.sub(a, b);
17+
}
18+
1419
public static unsafe Tensor multiply(Tensor x, Tensor y)
1520
{
1621
return gen_math_ops.mul(x, y);

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,28 @@ public static class gen_math_ops
99
{
1010
public static OpDefLibrary _op_def_lib = new OpDefLibrary();
1111

12-
public static Tensor add(Tensor a, Tensor b)
12+
public static Tensor add(Tensor x, Tensor y)
1313
{
1414
var keywords = new Dictionary<string, object>();
15-
keywords.Add("x", a);
16-
keywords.Add("y", b);
15+
keywords.Add("x", x);
16+
keywords.Add("y", y);
1717

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

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

23+
public static Tensor sub(Tensor x, Tensor y)
24+
{
25+
var keywords = new Dictionary<string, object>();
26+
keywords.Add("x", x);
27+
keywords.Add("y", y);
28+
29+
var _op = _op_def_lib._apply_op_helper("Sub", name: "sub", keywords: keywords);
30+
31+
return new Tensor(_op, 0, _op.OutputType(0));
32+
}
33+
2334
public static Tensor mul(Tensor x, Tensor y)
2435
{
2536
var keywords = new Dictionary<string, object>();

0 commit comments

Comments
 (0)