From 8bfe91c4ea684cf2ae8ea4ffa09ce8cc7b54ba72 Mon Sep 17 00:00:00 2001 From: "estherhu2012@gmail.com" Date: Mon, 7 Jan 2019 03:12:29 -0600 Subject: [PATCH] gen_math_ops.sub #97 --- src/TensorFlowNET.Core/APIs/tf.math.cs | 5 +++++ .../Operations/gen_math_ops.cs | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/TensorFlowNET.Core/APIs/tf.math.cs b/src/TensorFlowNET.Core/APIs/tf.math.cs index 5f019bb4..d45c9b4f 100644 --- a/src/TensorFlowNET.Core/APIs/tf.math.cs +++ b/src/TensorFlowNET.Core/APIs/tf.math.cs @@ -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); diff --git a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs index 27e555bc..a873f804 100644 --- a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs @@ -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(); - 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(); + 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();