diff --git a/src/TensorFlowNET.Keras/Engine/Layer.Apply.cs b/src/TensorFlowNET.Keras/Engine/Layer.Apply.cs index b19d5307..cabd56cd 100644 --- a/src/TensorFlowNET.Keras/Engine/Layer.Apply.cs +++ b/src/TensorFlowNET.Keras/Engine/Layer.Apply.cs @@ -14,7 +14,7 @@ namespace Tensorflow.Keras.Engine /// public Tensors Apply(Tensors inputs, Tensor state = null, bool training = false) { - callContext = callContext ?? new ThreadLocal() + callContext = callContext?.Value != null ? callContext : new ThreadLocal() { Value = new CallContext() };