From a7cdf6e1a2df4b69f28fb6c2a6d661bfb21bb4c0 Mon Sep 17 00:00:00 2001 From: Eli Belash Date: Fri, 30 Aug 2019 19:48:24 +0300 Subject: [PATCH] ops.uid: Use Interlocked.Increment instead of ++ --- src/TensorFlowNET.Core/ops.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TensorFlowNET.Core/ops.cs b/src/TensorFlowNET.Core/ops.cs index 1dc8eb56..18184edd 100644 --- a/src/TensorFlowNET.Core/ops.cs +++ b/src/TensorFlowNET.Core/ops.cs @@ -93,6 +93,7 @@ namespace Tensorflow //return _default_graph_stack.get_default() return default_graph_stack.get_controller(); } + public static Graph set_default_graph(Graph graph) { //TODO: original source does not have a 'set_default_graph' and indicates there should be a _default_graph_stack! @@ -311,7 +312,7 @@ namespace Tensorflow /// public static int uid() { - return uid_number++; + return Interlocked.Increment(ref uid_number); } public static void colocate_with(bool ignore_existing = false)