Skip to content

Commit 71f569b

Browse files
dataangelOceania2018
authored andcommitted
Update gen_math_ops.cs
1 parent b6755cc commit 71f569b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*****************************************************************************
1+
/*****************************************************************************
22
Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
@@ -619,6 +619,16 @@ public static Tensor logical_xor(Tensor x, Tensor y, string name = "LogicalXor")
619619

620620
public static Tensor squared_difference(Tensor x, Tensor y, string name = null)
621621
{
622+
if (tf.Context.executing_eagerly())
623+
{
624+
var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName,
625+
"SquaredDifference", name,
626+
null,
627+
x,y);
628+
629+
return results[0];
630+
}
631+
622632
var _op = tf.OpDefLib._apply_op_helper("SquaredDifference", name, args: new { x, y, name });
623633

624634
return _op.outputs[0];
@@ -1210,4 +1220,4 @@ public static Tensor zero_fraction(Tensor value, string name = null)
12101220
return _op.outputs[0];
12111221
}
12121222
}
1213-
}
1223+
}

0 commit comments

Comments
 (0)