Browse Source

gen_math_ops.sub #97

tags/v0.1.0-Tensor
estherhu2012@gmail.com 6 years ago
parent
commit
8bfe91c4ea
2 changed files with 19 additions and 3 deletions
  1. +5
    -0
      src/TensorFlowNET.Core/APIs/tf.math.cs
  2. +14
    -3
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs

+ 5
- 0
src/TensorFlowNET.Core/APIs/tf.math.cs View File

@@ -11,6 +11,11 @@ namespace Tensorflow
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);


+ 14
- 3
src/TensorFlowNET.Core/Operations/gen_math_ops.cs View File

@@ -9,17 +9,28 @@ namespace Tensorflow
{
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>();


Loading…
Cancel
Save