anchor.diff:                      a.Shape a.Layout.Stride
               raise (InvalidOperationException msg)
   
  +    /// <summary>Changes the shape of a tensor.</summary>
  +    /// <param name="shp">The target shape.</param>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>A tensor of the specified shape.</returns>
  +    /// <seealso cref="Tensor`1.reshape``1"/>
       let reshape shp (a: ITensor) =
           match a |> tryReshapeView shp with
           | Some res -> res
           | None -> a.Copy() |> reshapeView shp
   
  +    /// <summary>Flattens the tensor into a (one-dimensional) vector.</summary>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>A vector.</returns>
  +    /// <seealso cref="Tensor`1.flatten``1"/>
       let flatten (a: ITensor) =
           reshape [Remainder] a    
   
  +    /// <summary>Swaps the specified dimensions of the tensor.</summary>
  +    /// <param name="ax1">The dimension to swap.</param>
  +    /// <param name="ax2">The dimension to swap with.</param>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>The tensor with the dimensions swapped.</returns>
  +    /// <seealso cref="Tensor`1.swapDim``1"/>
       let swapDim ax1 ax2 (a: ITensor) =
           a.Relayout (a.Layout |> TensorLayout.swapDim ax1 ax2)
   
  +    /// <summary>Transpose of a matrix.</summary>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>The result of this operation.</returns>
  +    /// <seealso cref="Tensor`1.transpose"/>
       let transpose (a: ITensor) =
           a.Relayout (a.Layout |> TensorLayout.transpose)
   
  +    /// <summary>Permutes the axes as specified.</summary>
  +    /// <param name="permut">The permutation to apply to the dimensions of tensor.</param>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>The tensor with the dimensions permuted.</returns>
  +    /// <seealso cref="Tensor`1.permuteAxes``1"/>
       let permuteAxes (permut: int list) (a: ITensor) =
           a.Relayout (a.Layout |> TensorLayout.permuteAxes permut)
   
  +    /// <summary>Reverses the elements in the specified dimension.</summary>
  +    /// <param name="ax">The axis to reverse.</param>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>The tensor with the dimensions permuted.</returns>
  +    /// <seealso cref="Tensor`1.reverseAxis``1"/>
       let reverseAxis ax (a: ITensor) =
           a.Relayout (a.Layout |> TensorLayout.reverseAxis ax)        
   
  +    /// <summary>Pads the tensor from the left with size-one dimensions until it has at least the specified number of
  +    /// dimensions.</summary>
  +    /// <param name="minDims">The minimum number of dimensions.</param>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>A tensor with at least <paramref name="minDims"/> dimensions.</returns>
  +    /// <seealso cref="Tensor`1.atLeastND``1"/>
       let atLeastND minDims (a: ITensor) =
           if a.NDims >= minDims then a
           else
               let newShp = List.init (minDims - a.NDims) (fun _ -> 1L)
               a |> reshape newShp
   
  +    /// <summary>Pads the tensor from the left with size-one dimensions until it has at least one dimension.</summary>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>A tensor with at least one dimensions.</returns>
  +    /// <seealso cref="Tensor`1.atLeast1D``1"/>
       let atLeast1D (a: ITensor) = a |> atLeastND 1
   
  +    /// <summary>Pads the tensor from the left with size-one dimensions until it has at least two dimensions.</summary>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>A tensor with at least two dimensions.</returns>
  +    /// <seealso cref="Tensor`1.atLeast2D``1"/>
       let atLeast2D (a: ITensor) = a |> atLeastND 2
   
  +    /// <summary>Pads the tensor from the left with size-one dimensions until it has at least three dimensions.</summary>
  +    /// <param name="a">The tensor to operate on.</param>
  +    /// <returns>A tensor with at least three dimensions.</returns>
  +    /// <seealso cref="Tensor`1.atLeast3D``1"/>
       let atLeast3D (a: ITensor) = a |> atLeastND 3
   
  +    /// <summary>Returns a copy of the tensor.</summary>
  +    /// <param name="a">The tensor to copy.</param>
  +    /// <param name="order">The memory layout of the copy. (default: row-major)</param>
  +    /// <returns>A copy of the tensor.</returns>
  +    /// <seealso cref="Tensor`1.copy``1"/>
       let copy (a: ITensor) = a.Copy()
   
  +    /// <summary>Transfers a tensor to the specifed device.</summary>
  +    /// <param name="dev">The target device.</param>
  +    /// <param name="a">The tensor to transfer.</param>
  +    /// <returns>A tensor on the target device.</returns>
  +    /// <seealso cref="Tensor`1.transfer``1"/>
       let transfer (dev: ITensorDevice) (src: ITensor) =
           src.Transfer (dev)
           
  
positive.code:     abstract SetSlice : i0s:int64 option * i0f:int64 option * i1s:int64 option * i1f:int64 option * i2s:int64 option * i2f:int64 option * o3:obj * o4:obj * [<System.ParamArray>] r:obj [] -> unit
  
  
  
  module ITensor =
      let layout (a: ITensor) = a.Layout
  
      let dev (a: ITensor) = a.Dev
  
      let shape (a: ITensor) = a.Shape
  
      let nDims (a: ITensor) = a.Layout.NDims
  
      let nElems (a: ITensor) = a.Layout.NElems
  
      let dataType (a: ITensor) = a.DataType
  
      let relayout newLayout (a: ITensor) =
          a.Relayout newLayout 
  
      let range (rng: Rng list) (a: ITensor) =
          a.Relayout (a.Layout |> TensorLayout.view rng)
  
      let padLeft (a: ITensor) =
          a.Relayout (a.Layout |> TensorLayout.padLeft)
  
      let padRight (a: ITensor) =
          a.Relayout (a.Layout |> TensorLayout.padRight)
  
      let insertAxis ax (a: ITensor) =
          a.Relayout (a.Layout |> TensorLayout.insertAxis ax)
  
      let cutLeft (a: ITensor) =
          a.Relayout (a.Layout |> TensorLayout.cutLeft)
  
      let cutRight (a: ITensor) =
          a.Relayout (a.Layout |> TensorLayout.cutRight)
  
      let private ApplyLayoutFn (fn, xs: ITensor list) = 
          let layouts = fn (xs |> List.map layout)
          (layouts, xs) ||> List.map2 relayout        
  
      let padToSame (xs: ITensor list) = 
          ApplyLayoutFn (TensorLayout.padToSameMany, xs)
  
      let broadcastToSame (xs: ITensor list) =
          ApplyLayoutFn (TensorLayout.broadcastToSameMany, xs)
  
      let broadcastToSameInDims (dims, xs: ITensor list) =
          ApplyLayoutFn (TensorLayout.broadcastToSameInDimsMany dims, xs)
  
      let broadcastTo shp (a: ITensor) =
          a.Relayout (a.Layout |> TensorLayout.broadcastToShape shp)
  
      let isBroadcasted (a: ITensor) =
          a.Layout |> TensorLayout.isBroadcasted 
  
      let tryReshapeView shp (a: ITensor) =
          match a.Layout |> TensorLayout.tryReshape shp with
          | Some newLayout -> a.Relayout newLayout |> Some
          | None -> None
  
      let reshapeView shp (a: ITensor) =
          match tryReshapeView shp a with
          | Some res -> res
  
negative.code:     /// <returns>Sequence of indicies.</returns>
      /// <remarks>The sequence sequentially enumerates the indices of the elements of the specified dimension.</remarks>
      /// <seealso cref="allIdx``1"/>
      static member allIdxOfDim dim (a: Tensor<'T>) = ITensor.allIdxOfDim dim a
              
      /// <summary>Gets a sequence of all all elements within the tensor.</summary>
      /// <param name="a">The tensor to operate on.</param>
  