| @@ -25,7 +25,8 @@ namespace Tensorflow.Keras | |||||
| public LossesApi losses { get; } = new LossesApi(); | public LossesApi losses { get; } = new LossesApi(); | ||||
| public Activations activations { get; } = new Activations(); | public Activations activations { get; } = new Activations(); | ||||
| public Preprocessing preprocessing { get; } = new Preprocessing(); | public Preprocessing preprocessing { get; } = new Preprocessing(); | ||||
| public BackendImpl backend { get; } = new BackendImpl(); | |||||
| ThreadLocal<BackendImpl> _backend = new ThreadLocal<BackendImpl>(() => new BackendImpl()); | |||||
| public BackendImpl backend => _backend.Value; | |||||
| public OptimizerApi optimizers { get; } = new OptimizerApi(); | public OptimizerApi optimizers { get; } = new OptimizerApi(); | ||||
| public MetricsApi metrics { get; } = new MetricsApi(); | public MetricsApi metrics { get; } = new MetricsApi(); | ||||
| public ModelsApi models { get; } = new ModelsApi(); | public ModelsApi models { get; } = new ModelsApi(); | ||||
| @@ -60,9 +60,9 @@ namespace TensorFlowNET.Keras.UnitTest | |||||
| //act | //act | ||||
| ParallelOptions parallelOptions = new ParallelOptions(); | ParallelOptions parallelOptions = new ParallelOptions(); | ||||
| parallelOptions.MaxDegreeOfParallelism = 1; | |||||
| parallelOptions.MaxDegreeOfParallelism = 8; | |||||
| var input = np.array(new float[,] { { 0, 0 } }); | var input = np.array(new float[,] { { 0, 0 } }); | ||||
| Parallel.For(0, 1, parallelOptions, i => | |||||
| Parallel.For(0, 8, parallelOptions, i => | |||||
| { | { | ||||
| var clone = BuildModel(); | var clone = BuildModel(); | ||||
| clone.load_weights(savefile); | clone.load_weights(savefile); | ||||