diff --git a/src/TensorFlowNET.Core/APIs/tf.nn.cs b/src/TensorFlowNET.Core/APIs/tf.nn.cs index e5cd4e569..397c68c7c 100644 --- a/src/TensorFlowNET.Core/APIs/tf.nn.cs +++ b/src/TensorFlowNET.Core/APIs/tf.nn.cs @@ -144,16 +144,8 @@ public Tensor batch_normalization(Tensor x, Tensor offset, Tensor scale, float variance_epsilon, - string name = null) - { - var inv = math_ops.rsqrt(variance + variance_epsilon); - tf_with(ops.name_scope(name, "batchnorm", (x, mean, variance, scale, offset)), scope => - { - if (scale != null) inv *= scale; - }); - if (offset != null) return x * math_ops.cast(inv, x.dtype) + math_ops.cast(offset - mean * inv, dtype: x.dtype); - else return x * math_ops.cast(inv, x.dtype) + math_ops.cast(-mean * inv, dtype: x.dtype); - } + string name = null) => nn_impl.batch_normalization(x, mean, variance, offset, scale, variance_epsilon, name); + public Tensor max_pool(Tensor value, int[] ksize, int[] strides, string padding, string data_format = "NHWC", string name = null) => nn_ops.max_pool(value, ksize, strides, padding, data_format: data_format, name: name); diff --git a/src/TensorFlowNET.Core/Operations/array_ops.cs b/src/TensorFlowNET.Core/Operations/array_ops.cs index 7f787533a..fbb3bf119 100644 --- a/src/TensorFlowNET.Core/Operations/array_ops.cs +++ b/src/TensorFlowNET.Core/Operations/array_ops.cs @@ -678,7 +678,6 @@ public static Tensor stop_gradient(Tensor input, string name = null) var tape = tf.GradientTape().stop_recording(); var result = gen_array_ops.stop_gradient(input, name); tape.StartRecord(); - tf.GradientTape().PushTape(tape); return result; }