anchor.diff:          a.matmul(b).view([])
   
       static member (~-) (a:Tensor) =
  -        let inline fRaw(a:RawTensor) = a.NegT()
  -        let inline fTensor(a) = -a
  -        let inline dfTensorFwd(cp,ap,ad) = -ad
  -        let inline dfTensorRev(a) = NegT(a)
  +        let fRaw(a:RawTensor) = a.NegT()
  +        let fTensor(a) = -a
  +        let dfTensorFwd(cp,ap,ad) = -ad
  +        let dfTensorRev(a) = NegT(a)
           Tensor.OpUnary(a, fRaw, fTensor, dfTensorFwd, dfTensorRev)
       member a.neg() = -a
   
       member a.sum() =
  -        let inline fRaw(a:RawTensor) = a.SumT()
  -        let inline fTensor(a:Tensor) = a.sum()
  -        let inline dfTensorFwd(cp,ap,ad:Tensor) = ad.sum()
  -        let inline dfTensorRev(a) = SumT(a)
  +        let fRaw(a:RawTensor) = a.SumT()
  +        let fTensor(a:Tensor) = a.sum()
  +        let dfTensorFwd(cp,ap,ad:Tensor) = ad.sum()
  +        let dfTensorRev(a) = SumT(a)
           Tensor.OpUnary(a, fRaw, fTensor, dfTensorFwd, dfTensorRev)
   
       // TODO: this can be implemented in a more memory efficient way by pushing the sum operation to the RawTensor level and implementing the derivatives using general broadcasting when it's available
  
positive.code:             let bCast = b.cast(tnew)
              aCast * bCast
          elif a.shape = b.shape then
              let inline fRaw(a:RawTensor,b) = a.MulTT(b)
              let inline fTensor(a,b) = a * b
              let inline dfTensorFwdTT(cp:Tensor,ap:Tensor,ad:Tensor,bp:Tensor,bd:Tensor) = (ad * bp) + (ap * bd)
              let inline dfTensorFwdTC(cp:Tensor,ap:Tensor,ad:Tensor) = ad * b
              let inline dfTensorFwdCT(cp:Tensor,bp:Tensor,bd:Tensor) = a * bd
              let inline dfTensorRevTT(a,b) = MulTT(a,b)
              let inline dfTensorRevTC(a,b) = MulTTConst(a,b)
              let inline dfTensorRevCT(a,b) = MulTTConst(b,a)
              Tensor.OpBinary(a, b, fRaw, fTensor, dfTensorFwdTT, dfTensorFwdTC, dfTensorFwdCT, dfTensorRevTT, dfTensorRevTC, dfTensorRevCT)
          elif a.dim = 0 then
              let inline fRaw(a,b:RawTensor) = b.MulTT0(a)
              let inline fTensor(a,b) = a * b
              let inline dfTensorFwdTT(cp:Tensor,ap:Tensor,ad:Tensor,bp:Tensor,bd:Tensor) = (ad * bp) + (ap * bd)
              let inline dfTensorFwdTC(cp:Tensor,ap:Tensor,ad:Tensor) = ad * b
              let inline dfTensorFwdCT(cp:Tensor,bp:Tensor,bd:Tensor) = a * bd
              let inline dfTensorRevTT(a,b) = MulTT0(b,a)
              let inline dfTensorRevTC(a,b) = MulTConstT0(a,b)
              let inline dfTensorRevCT(a,b) = MulTT0Const(b,a)
              Tensor.OpBinary(a, b, fRaw, fTensor, dfTensorFwdTT, dfTensorFwdTC, dfTensorFwdCT, dfTensorRevTT, dfTensorRevTC, dfTensorRevCT)
          elif b.dim = 0 then
              let inline fRaw(a:RawTensor,b) = a.MulTT0(b)
              let inline fTensor(a,b) = a * b
              let inline dfTensorFwdTT(cp:Tensor,ap:Tensor,ad:Tensor,bp:Tensor,bd:Tensor) = (ad * bp) + (ap * bd)
              let inline dfTensorFwdTC(cp:Tensor,ap:Tensor,ad:Tensor) = ad * b
              let inline dfTensorFwdCT(cp:Tensor,bp:Tensor,bd:Tensor) = a * bd
              let inline dfTensorRevTT(a,b) = MulTT0(a,b)
              let inline dfTensorRevTC(a,b) = MulTT0Const(a,b)
              let inline dfTensorRevCT(a,b) = MulTConstT0(b,a)
              Tensor.OpBinary(a, b, fRaw, fTensor, dfTensorFwdTT, dfTensorFwdTC, dfTensorFwdCT, dfTensorRevTT, dfTensorRevTC, dfTensorRevCT)
          else
              let newShape = broadcastShapes2 a.shape b.shape
  
negative.code: 
      member a.matmul (b:Tensor) =
          checkCanMatmul a.shape b.shape
          let fRaw(a:RawTensor,b) = a.MatMulT2T2(b)
          let fTensor(a:Tensor,b) = a.matmul(b)
          let dfTensorFwdTT(cp,ap:Tensor,ad:Tensor,bp:Tensor,bd:Tensor) = ad.matmul(bp) + ap.matmul(bd)
          let dfTensorFwdTC(cp,ap,ad:Tensor) = ad.matmul(b)
          let dfTensorFwdCT(cp,bp,bd) = a.matmul(bd)
          let dfTensorRevTT(a,b) = MatMulT2T2(a,b)
          let dfTensorRevTC(a,b) = MatMulT2T2Const(a,b)
          let dfTensorRevCT(a,b) = MatMulT2ConstT2(a,b)
          Tensor.OpBinary(a, b, fRaw, fTensor, dfTensorFwdTT, dfTensorFwdTC, dfTensorFwdCT, dfTensorRevTT, dfTensorRevTC, dfTensorRevCT)
  
      member a.dot(b:Tensor) =
  