Example #1
0
 public void TestMemoryDisposalOnes()
 {
     for (int i = 0; i < 1024; i++)
     {
         var x = DoubleTensor.Ones(new long[] { 1024, 1024 });
         x.Dispose();
     }
 }
Example #2
0
        public void TestSaveLoadTensorDouble()
        {
            var file = ".saveload.double.ts";

            if (File.Exists(file))
            {
                File.Delete(file);
            }
            var tensor = DoubleTensor.Ones(new long[] { 5, 6 });

            tensor.Save(file);
            var tensorLoaded = TorchTensor.Load(file);

            File.Delete(file);
            Assert.NotNull(tensorLoaded);
            Assert.Equal(tensorLoaded.Type, tensor.Type);
            Assert.Equal(tensorLoaded, tensor);
        }