Skip to content

Commit 7a828c0

Browse files
committed
Fixed SciSharp#398, Recusive defualt session factory
1 parent 71dd19d commit 7a828c0

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/TensorFlowNET.Core/Keras/backend.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class backend : BackendBase
2828
//Func<Array, bool> py_any = any;
2929
//Func<double, double, double, IEnumerable<double>> py_slice = slice;
3030

31-
public static Session _SESSION = tf.defaultSession;
31+
public static Session _SESSION = ops.get_default_session();
3232
public static Graph _GRAPH = null;
3333
public static Dictionary<Graph, GraphLearningPhase> _GRAPH_LEARNING_PHASES;
3434
//Dictionary<Graph, Dictionary<string, int>> PER_GRAPH_LAYER_NAME_UIDS;

src/TensorFlowNET.Core/tensorflow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public partial class tensorflow : IObjectLife
4040

4141
public tensorflow()
4242
{
43-
_defaultSessionFactory = new ThreadLocal<Session>(Session);
43+
_defaultSessionFactory = new ThreadLocal<Session>(() => new Session());
4444
}
4545

4646
public Session defaultSession => _defaultSessionFactory.Value;

0 commit comments

Comments
 (0)