anchor.diff:      [<Test>]
       member _.TestTensorSumDimKeepDim () =
           // Test all non-bool types
  -        for ty in Combos.IntegralAndFloatingPoint do 
  -            let t = ty.tensor([[[1.;2.;3.;4.]; [5.;6.;7.;8.]; [9.;10.;11.;12.]]; [[13.;14.;15.;16.]; [17.;18.;19.;20.]; [21.;22.;23.;24.]]])
  +        for combo in Combos.IntegralAndFloatingPoint do 
  +            let t = combo.tensor([[[1.;2.;3.;4.]; [5.;6.;7.;8.]; [9.;10.;11.;12.]]; [[13.;14.;15.;16.]; [17.;18.;19.;20.]; [21.;22.;23.;24.]]])
               let tSum0 = t.sum(0, keepDim=true)
  -            let tSum0Correct = ty.tensor([[[14.0f; 16.0f; 18.0f; 20.0f]; [22.0f; 24.0f; 26.0f; 28.0f]; [30.0f; 32.0f; 34.0f; 36.0f]]], dtype=ty.dtype.SummationType)
  +            let tSum0Correct = combo.tensor([[[14.0f; 16.0f; 18.0f; 20.0f]; [22.0f; 24.0f; 26.0f; 28.0f]; [30.0f; 32.0f; 34.0f; 36.0f]]], dtype=combo.dtype.SummationType)
               let tSum1 = t.sum(1, keepDim=true)
  -            let tSum1Correct = ty.tensor([[[15.0f; 18.0f; 21.0f; 24.0f]]; [[51.0f; 54.0f; 57.0f; 60.0f]]], dtype=ty.dtype.SummationType)
  +            let tSum1Correct = combo.tensor([[[15.0f; 18.0f; 21.0f; 24.0f]]; [[51.0f; 54.0f; 57.0f; 60.0f]]], dtype=combo.dtype.SummationType)
               let tSum2 = t.sum(2, keepDim=true)
  -            let tSum2Correct = ty.tensor([[[10.0f]; [26.0f]; [42.0f]]; [[58.0f]; [74.0f]; [90.0f]]], dtype=ty.dtype.SummationType)
  -
  -            Assert.AreEqual(tSum0.dtype, ty.dtype.SummationType)
  -            Assert.AreEqual(tSum1.dtype, ty.dtype.SummationType)
  -            Assert.AreEqual(tSum2.dtype, ty.dtype.SummationType)
  +            let tSum2Correct = combo.tensor([[[10.0f]; [26.0f]; [42.0f]]; [[58.0f]; [74.0f]; [90.0f]]], dtype=combo.dtype.SummationType)
  +
  +            Assert.AreEqual(tSum0.dtype, combo.dtype.SummationType)
  +            Assert.AreEqual(tSum1.dtype, combo.dtype.SummationType)
  +            Assert.AreEqual(tSum2.dtype, combo.dtype.SummationType)
               Assert.AreEqual(tSum0Correct, tSum0)
               Assert.AreEqual(tSum1Correct, tSum1)
               Assert.AreEqual(tSum2Correct, tSum2)
   
       [<Test>]
       member _.TestTensorMean () =
  -        for ty in Combos.FloatingPoint do 
  -            let t = ty.tensor([[[1.;2.;3.;4.]; [5.;6.;7.;8.]; [9.;10.;11.;12.]]; [[13.;14.;15.;16.]; [17.;18.;19.;20.]; [21.;22.;23.;24.]]])
  +        for combo in Combos.FloatingPoint do 
  +            let t = combo.tensor([[[1.;2.;3.;4.]; [5.;6.;7.;8.]; [9.;10.;11.;12.]]; [[13.;14.;15.;16.]; [17.;18.;19.;20.]; [21.;22.;23.;24.]]])
               let tMean = t.mean()
  -            let tMeanCorrect = ty.tensor(12.5)
  +            let tMeanCorrect = combo.tensor(12.5)
   
               Assert.AreEqual(tMeanCorrect, tMean)
  -            Assert.AreEqual(tMean.dtype, ty.dtype)
  +            Assert.AreEqual(tMean.dtype, combo.dtype)
   
               // mean, dim={0,1,2}
               (* Python:
  
positive.code:                                              [[1.4250, 1.7200, 1.8228],
                                                [1.2607, 0.6599, 1.8958],
                                                [0.6304, 1.5875, 0.4057]]]])
              let tk3p1i = ty.tensor([[[[ 0, 10,  6],
                                                    [16, 36, 21],
                                                    [41, 59, 45]],
  
  
negative.code:     [<Test>]
      member _.TestTensorAddT2T1 () =
          // Test all non-bool types
          for combo in Combos.IntegralAndFloatingPoint do 
              let t1 = combo.tensor([[1.; 2.]; [3.; 4.]]) + combo.tensor([5.; 6.])
              let t1Correct = combo.tensor([[6.; 8.]; [8.; 10.]])
  
              Assert.AreEqual(t1Correct, t1)
              Assert.AreEqual(t1.dtype, combo.dtype)
  
          for combo in Combos.Bool do 
              // check broadcast for bool tensor 0 --> [2]
              let t6a = combo.tensor([true; false])
              let t6b = combo.tensor(true)
              let t6 = t6a + t6b
              let t6Correct = combo.tensor([true; true])
              Assert.AreEqual(t6, t6Correct)
  
              // check broadcast for bool tensor [1] --> [2]
              let t7a = combo.tensor([true; false])
              let t7b = combo.tensor([true])
              let t7 = t7a + t7b
              let t7Correct = combo.tensor([true; true])
              Assert.AreEqual(t7, t7Correct)
  
  
      [<Test>]
      member _.TestTensorSubTT () =
          // Test all pairs of non-bool types, for widening
          for combo in Combos.IntegralAndFloatingPoint do 
              for dtype2 in DTypes.IntegralAndFloatingPoint do 
                  match DType.widen combo.dtype dtype2 with 
                  | None -> ()
                  | Some dtypeRes -> 
  
                  let t1 = combo.tensor([1.; 2.]) - combo.tensor([3.; 4.], dtype=dtype2)
                  let t1Correct = combo.tensor([-2.; -2.], dtype=dtypeRes)
  
                  Assert.AreEqual(t1Correct, t1)
                  Assert.AreEqual(t1.dtype, dtypeRes)
  
                  let t2 = combo.tensor([1.; 2.]) - combo.tensor(5., dtype=dtype2)
                  let t2Correct = combo.tensor([-4.; -3.], dtype=dtypeRes)
  
                  Assert.AreEqual(t2Correct, t2)
                  Assert.AreEqual(t2.dtype, dtypeRes)
  
          // Test scalar broadcast
          for combo in Combos.IntegralAndFloatingPoint do 
              let t3 = combo.tensor([1.; 2.]) - 5.f
              let t3Correct = combo.tensor([-4.; -3.])
  
              Assert.AreEqual(t3Correct, t3)
              Assert.AreEqual(t3.dtype, combo.dtype)
  
              let t4 = 5. - combo.tensor([1.; 2.])
              let t4Correct = combo.tensor([4.; 3.])
  
              Assert.AreEqual(t4Correct, t4)
              Assert.AreEqual(t4.dtype, combo.dtype)
  
              let t5 = combo.tensor([1.; 2.]) - 5
              let t5Correct = combo.tensor([-4.; -3.])
  
              Assert.AreEqual(t5Correct, t5)
              Assert.AreEqual(t5.dtype, combo.dtype)
  
          for combo in Combos.Bool do 
              // Bool tensors do not support subtraction
              //
              //   torch.tensor([[True]], dtype=torch.bool) - torch.tensor([[True]], dtype=torch.bool)
              //
              // RuntimeError: Subtraction, the `-` operator, with two bool tensors is not supported. Use the `^` or `logical_xor()` operator instead.
  
              let t5a = combo.tensor([true; false])
              let t5b = combo.tensor([true; true])
              isInvalidOp(fun () -> t5a - t5b)
  
      [<Test>]
      member _.TestTensorMulTT () =
          // Test all pairs of non-bool types
          for combo in Combos.IntegralAndFloatingPoint do 
              for dtype2 in DTypes.IntegralAndFloatingPoint do 
                  match DType.widen combo.dtype dtype2 with 
                  | None -> ()
                  | Some dtypeRes -> 
                  let t1 = combo.tensor([1.; 2.]) * combo.tensor([3.; 4.], dtype=dtype2)
                  let t1Correct = combo.tensor([3.; 8.], dtype=dtypeRes)
  
                  Assert.AreEqual(t1Correct, t1)
                  Assert.AreEqual(t1.dtype, dtypeRes)
  
                  let t2 = combo.tensor([1.; 2.]) * combo.tensor(5., dtype=dtype2)
                  let t2Correct = combo.tensor([5.; 10.], dtype=dtypeRes)
  
                  Assert.AreEqual(t2Correct, t2)
                  Assert.AreEqual(t2.dtype, dtypeRes)
  
          // Test scalar broadcasting 
          for combo in Combos.IntegralAndFloatingPoint do 
              let t3 = combo.tensor([1.; 2.]) * 5.f
              let t3Correct = combo.tensor([5.; 10.])
  
              Assert.AreEqual(t3Correct, t3)
  
              let t4 = 5. * combo.tensor([1.; 2.])
              let t4Correct = combo.tensor([5.; 10.])
  
              Assert.AreEqual(t4Correct, t4)
              Assert.AreEqual(t3.dtype, combo.dtype)
              Assert.AreEqual(t4.dtype, combo.dtype)
  
          // Bool tensors support multiplication giving bool tensor
          //
          //    torch.ones(10, dtype=torch.bool) * torch.ones(10, dtype=torch.bool)
          //
          //    tensor([True, True, True, True, True, True, True, True, True, True])
          for combo in Combos.Bool do 
              let t1 = combo.tensor([true; true])
              let t2 = combo.tensor([true; false])
              let i = t1 * t2
              let iCorrect = combo.tensor([true; false])
              Assert.AreEqual(iCorrect, i)
  
      [<Test>]
      member _.TestTensorMulTT_BroadcastSystematic () =
        for combo in Combos.FloatingPoint do 
          // 2x2 * 1  (broadcast --> 2x2)
          // 2x2 * 2  (broadcast --> 2x2)
          // 2x2 * 2x1  (broadcast --> 2x2)
          // 2x2 * 1x2  (broadcast --> 2x2)
          let t5a = combo.tensor([ [1.; 2.]; [3.; 4.] ])
          for t5b in [ combo.tensor([ 5.0 ])
                       combo.tensor([ 5.0; 5.0 ])
                       combo.tensor([ [5.0]; [5.0] ])
                       combo.tensor([ [5.0; 5.0] ]) ] do
              let t5 = t5a * t5b
              let t5Commute = t5b * t5a
              let t5Correct = combo.tensor([ [5.; 10.]; [15.; 20.] ])
  
              Assert.AreEqual(t5Correct, t5)
              Assert.AreEqual(t5Correct, t5Commute)
  