From 934c9818c4b3c43b1f4d30d527f6447073af8c5f Mon Sep 17 00:00:00 2001 From: dataangel Date: Mon, 14 Dec 2020 05:24:04 +0800 Subject: [PATCH] Update gen_math_ops.cs --- src/TensorFlowNET.Core/Operations/gen_math_ops.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs index fa74bffe..67b5b614 100644 --- a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs @@ -1,4 +1,4 @@ -/***************************************************************************** +/***************************************************************************** Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); @@ -619,6 +619,16 @@ namespace Tensorflow public static Tensor squared_difference(Tensor x, Tensor y, string name = null) { + if (tf.Context.executing_eagerly()) + { + var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName, + "SquaredDifference", name, + null, + x,y); + + return results[0]; + } + var _op = tf.OpDefLib._apply_op_helper("SquaredDifference", name, args: new { x, y, name }); return _op.outputs[0]; @@ -1210,4 +1220,4 @@ namespace Tensorflow return _op.outputs[0]; } } -} \ No newline at end of file +}