Example #1
0
        public void DisposeScopeWorksForTestTraining1()
        {
            DisposeScopeManager.Statistics.Reset();
            using (var d = torch.NewDisposeScope()) {
                var testTraining = new TestTraining();
                testTraining.TestTraining1();
            }

            _testOutputHelper.WriteLine(
                $"Undisposed Tensors with DisposeScope: {DisposeScopeManager.Statistics.ThreadTotalLiveCount}");
            Assert.Equal(0, DisposeScopeManager.Statistics.ThreadTotalLiveCount);
        }