anchor.diff:  
           statics.CreateFromFlatArray(data, shape, device)
   
  +    /// Gets a tensor filled with values drawn from the given .NET object for the
  +    /// given configuration settings, defaulting to the configuration settings of the object tensor.
       member t.CreateLike(values: obj, ?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.Create(values, dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a zero tensor for the given configuration settings, defaulting to the configuration settings of the object tensor
       member t.ZeroLike(?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.Zero(dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a tensor filled with zero values for the given shape and configuration settings,
  +    /// defaulting to the configuration settings of the object tensor
       member t.ZerosLike(shape: int[], ?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.Zeros(shape=shape, dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a scalar one tensor for the given configuration settings, defaulting to the configuration settings of the object tensor
       member t.OneLike(?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.One(dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a tensor filled with one values for the given shape and configuration settings,
  +    /// defaulting to the configuration settings of the object tensor
       member t.OnesLike(shape: int[], ?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.Ones(shape=shape, dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a tensor filled with the given scalar value for the given shape and configuration settings,
  +    /// defaulting to the configuration settings of the object tensor
       member t.FullLike(shape: int[], value: obj, ?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.Full(shape, value, dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a tensor filled with random values for the given shape and configuration settings,
  +    /// defaulting to the configuration settings of the object tensor
       member t.RandomLike(shape: int[], ?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.Random(shape=shape, dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a tensor filled with random values from a normal distribution for the given shape and configuration settings,
  +    /// defaulting to the configuration settings of the object tensor
       member t.RandomNormalLike(shape: int[], ?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.RandomNormal(shape=shape, dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Gets a tensor filled with random integer values from the given range for the given shape and configuration settings,
  +    /// defaulting to the configuration settings of the object tensor
       member t.RandomIntLike(shape: int[], low:int, high:int, ?dtype: Dtype, ?device: Device, ?backend: Backend) =
           RawTensor.RandomInt(shape=shape, low=low, high=high, dtype=defaultArg dtype t.Dtype, device=defaultArg device t.Device, backend=defaultArg backend t.Backend)
   
  +    /// Clone the underlying storage of the tensor.
       abstract member Clone : unit -> RawTensor
  +
  +    /// Expand the shape of the tensor.
       abstract member Expand: newShape: int[] -> RawTensor
  -    abstract member StackTs: RawTensor[] * dim:int -> RawTensor
  +
  +    /// Stack the given tensors along the given dimension
  +    abstract member StackTs: tensors: RawTensor[] * dim:int -> RawTensor
  +
  +    /// Unstack the given tensors along the given dimension
       abstract member UnstackT: dim:int -> RawTensor[]
  -    abstract member CatTs: RawTensor[] * dim: int -> RawTensor
  -    abstract member SplitT: int[] * dim: int -> RawTensor[]
  +
  +    /// Concatenate the given tensors along the given dimension
  +    abstract member CatTs: tensors: RawTensor[] * dim: int -> RawTensor
  +
  +    /// Split the given tensors along the given dimensions
  +    abstract member SplitT: sizes: int[] * dim: int -> RawTensor[]
  +
  +    /// Get a textual representation of the tensors
       abstract member GetString: unit -> string
       
  -    /// The indexes are an Nx3 array.   The first row is the start bounds, the second row is
  -    /// the end bounds, the third is 1/0 indicating dimension removal.
  -    abstract member GetSlice: int[,] -> RawTensor
  -
  +    /// <summary> Get a slice of the given tensor.</summary>
  +    ///
  +    /// <param name="fullBounds">
  +    ///  The indexes are an Nx3 array.   The first row is the start bounds, the second row is
  +    ///  the end bounds, the third is 1/0 indicating dimension removal.
  +    /// </param>
  +    abstract member GetSlice: fullBounds: int[,] -> RawTensor
  +
  +    /// Get a .NET object for all the values in the tensor
       abstract member ToValues: unit -> obj
  -    abstract member Equals: RawTensor -> bool
  -    abstract member Cast : Dtype -> RawTensor
  -    abstract member MoveTo : Device -> RawTensor
  +
  +    /// Compare two tensors for equality
  +    abstract member Equals: t2: RawTensor -> bool
  +
  +    /// Returns a tensor where the elements have each been cast to the given tensor element storage type.
  +    abstract member Cast: dtype: Dtype -> RawTensor
  +
  +    /// Returns a tensor moved to the given device.
  +    abstract member MoveTo: device: Device -> RawTensor
  +
  +    /// Returns a hash of the contents of the tensor.  This operation may cause the
  +    /// tensor to be moved to the CPU, and its entire contents iterated.
       abstract member ComputeHash: unit -> int
  -    abstract member AllClose: RawTensor * float * float -> bool
  -    abstract member ClampT: RawTensor * RawTensor -> RawTensor
  -    abstract member GatherT: int * RawTensor -> RawTensor
  -    abstract member LtTT: RawTensor -> RawTensor
  -    abstract member GtTT: RawTensor -> RawTensor
  -    abstract member LeTT: RawTensor -> RawTensor
  -    abstract member GeTT: RawTensor -> RawTensor
  -    abstract member EqTT: RawTensor -> RawTensor
  -    abstract member NeqTT: RawTensor -> RawTensor
  +
  +    /// Indicates if the two tensors have the same shape and element type, and all corresponding values
  +    /// are equal up to the given tolerances.
  +    abstract member AllClose: t2: RawTensor * relativeTolerance: float * absoluteTolerance: float -> bool
  +
  +    /// Returns a boolean tensor with values constrained by the corresponding elements in the low/high tensors.
  +    abstract member ClampT: low: RawTensor * high: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor selecting the given indices from the given dimension and stacking those in the order specified.
  +    abstract member GatherT: dim: int * indices: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor comparing each element pairwise with the corresponding element in <c>t2</c>
  +    abstract member LtTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor comparing each element pairwise with the corresponding element in <c>t2</c>
  +    abstract member GtTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor comparing each element pairwise with the corresponding element in <c>t2</c>
  +    abstract member LeTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor comparing each element pairwise with the corresponding element in <c>t2</c>
  +    abstract member GeTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor comparing each element pairwise with the corresponding element in <c>t2</c>
  +    abstract member EqTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor comparing each element pairwise with the corresponding element in <c>t2</c>
  +    abstract member NeqTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns a boolean tensor where each element indicates if the corresponding element in the tensor is an infinity value
       abstract member IsInfT : unit -> RawTensor
  +
  +    /// Returns a boolean tensor where each element indicates if the corresponding element in the tensor is a NaN value
       abstract member IsNaNT : unit -> RawTensor
  +
  +    /// Gets a .NET object representing the value of the tensor at the given indexes
       abstract member GetItem : [<System.ParamArray>] indexes: int[] -> obj 
  +
  +    /// Gets the index of a maximum value of the tensor
       abstract member MaxIndexT : unit -> int[]
  +
  +    /// Gets the index of a minimum value of the tensor
       abstract member MinIndexT : unit -> int[]
  +
  +    /// Returns the element-wise addition of the two tensors
       abstract member AddTT : RawTensor -> RawTensor
  +
  +    /// Returns the element-wise addition of two scalars
       abstract member AddTT0 : RawTensor -> RawTensor
  +
  +    /// Returns the element-wise addition of the matrix and vector tensors
       abstract member AddT2T1: RawTensor -> RawTensor
  -    abstract member AddTTSlice: int[] * RawTensor -> RawTensor
  -    abstract member SubTT : RawTensor -> RawTensor
  -    abstract member SubT0T : RawTensor -> RawTensor
  -    abstract member SubTT0 : RawTensor -> RawTensor
  -    abstract member MulTT : RawTensor -> RawTensor
  -    abstract member MulTT0 : RawTensor -> RawTensor
  -    abstract member DivTT : RawTensor -> RawTensor
  -    abstract member DivT0T : RawTensor -> RawTensor
  -    abstract member DivTT0 : RawTensor -> RawTensor
  -    abstract member PowTT : RawTensor -> RawTensor
  -    abstract member PowT0T: RawTensor -> RawTensor
  -    abstract member PowTT0 : RawTensor -> RawTensor
  -    abstract member MatMulT2T2: RawTensor -> RawTensor
  -    abstract member MaxPool1D: int * int * int -> RawTensor * RawTensor
  -    abstract member MaxPool2D: int[] * int[] * int[] -> RawTensor * RawTensor
  -    abstract member MaxPool3D: int[] * int[] * int[] -> RawTensor * RawTensor
  -    abstract member MaxUnpool1D: RawTensor * int[] -> RawTensor
  -    abstract member MaxUnpool2D: RawTensor * int[] -> RawTensor
  -    abstract member MaxUnpool3D: RawTensor * int[] -> RawTensor
  -    abstract member Conv1D: RawTensor * int * int -> RawTensor
  -    abstract member Conv2D: RawTensor * int[] * int[] -> RawTensor
  -    abstract member Conv3D: RawTensor * int[] * int[] -> RawTensor
  +
  +    /// Adds a slice of <c>t2</c> at the given location to the tensor
  +    abstract member AddTTSlice: location: int[] * t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise subtraction of two tensors
  +    abstract member SubTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise subtraction of the scalar and a tensor, where the scalar is logically
  +    /// broadcast to the same shape as the tensor
  +    abstract member SubT0T: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise subtraction of the tensor and a scalar, where the scalar is logically
  +    /// broadcast to the same shape as the tensor
  +    abstract member SubTT0: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise multiplication of two tensors
  +    abstract member MulTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise multiplication of a tensor and a scalar, where the scalar is logically
  +    /// broadcast to the same shape as the tensor
  +    abstract member MulTT0: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise division of two tensors
  +    abstract member DivTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise division of a scalar by a tensor, where the scalar is logically
  +    /// broadcast to the same shape as the tensor
  +    abstract member DivT0T: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise division of a tensor by a scalar, where the scalar is logically
  +    /// broadcast to the same shape as the tensor
  +    abstract member DivTT0: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise exponentiation of two tensors
  +    abstract member PowTT: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise exponentiation of a scalar and a tensor, where the scalar is logically
  +    /// broadcast to the same shape as the tensor
  +    abstract member PowT0T: t2: RawTensor -> RawTensor
  +
  +    /// Returns the element-wise exponentiation of a tensor and a scalar, where the scalar is logically
  +    /// broadcast to the same shape as the tensor
  +    abstract member PowTT0: t2: RawTensor -> RawTensor
  +
  +    /// Returns the matrix multiplication of two tensors
  +    abstract member MatMulT2T2: t2: RawTensor -> RawTensor
  +
  +    /// Returns the 1D maxpool of a tensor and its chosen maximum indices
  +    abstract member MaxPool1D: kernelSize: int * stride: int * padding: int -> RawTensor * RawTensor
  +
  +    /// Returns the 2D maxpool of a tensor and its chosen maximum indices
  +    abstract member MaxPool2D: kernelSize: int[] * strides: int[] * padding: int[] -> RawTensor * RawTensor
  +
  +    /// Returns the 3D maxpool of a tensor and its chosen maximum indices
  +    abstract member MaxPool3D: kernelSize: int[] * strides: int[] * padding: int[] -> RawTensor * RawTensor
  +
  +    /// Returns the 1D maxunpool of a tensor using the given indices for locations of maximums
  +    abstract member MaxUnpool1D: indices: RawTensor * outputSize: int[] -> RawTensor
  +
  +    /// Returns the 2D maxunpool of a tensor using the given indices for locations of maximums
  +    abstract member MaxUnpool2D: indices: RawTensor * outputSize: int[] -> RawTensor
  +
  +    /// Returns the 3D maxunpool of a tensor using the given indices for locations of maximums
  +    abstract member MaxUnpool3D: indices: RawTensor * outputSize: int[] -> RawTensor
  +
  +    /// Returns the 1D convolution of the tensor
  +    abstract member Conv1D: kernel: RawTensor * stride: int * padding: int -> RawTensor
  +
  +    /// Returns the 2D convolution of the tensor
  +    abstract member Conv2D: kernel: RawTensor * strides: int[] * padding: int[] -> RawTensor
  +
  +    /// Returns the 3D convolution of the tensor
  +    abstract member Conv3D: kernel: RawTensor * strides: int[] * padding: int[] -> RawTensor
  +
  +    /// Returns the element-wise negation of the tensor
       abstract member NegT : unit -> RawTensor
  +
  +    /// Returns the scalar tensor for the summation of all elements in the the tensor 
       abstract member SumT : ?resultType: Dtype -> RawTensor
  +
  +    /// Returns a vector representing the summation of each the matrix along the first dimension 
       abstract member SumT2Dim0 : unit -> RawTensor
  -    abstract member TransposeT: int * int -> RawTensor
  +
  +    /// Returns the transpose of the tensor between the given dimensions
  +    abstract member TransposeT: dim0: int * dim1: int -> RawTensor
  +
  +    /// Returns the transpose of a 2D tensor
       abstract member TransposeT2: unit -> RawTensor
  -    abstract member SqueezeT: int -> RawTensor
  -    abstract member UnsqueezeT: int -> RawTensor
  -    abstract member FlipT: int[] -> RawTensor
  -    abstract member DilateT: int[] -> RawTensor
  -    abstract member UndilateT: int[] -> RawTensor
  -    abstract member ViewT: int[] -> RawTensor
  +
  +    /// Returns the tensor with the same values and the given dimension removed. The given dimension must be of size 1.
  +    abstract member SqueezeT: dim: int -> RawTensor
  +
  +    /// Returns the tensor with the same values and a dimension of size 1 inserted before the given dimension.
  +    abstract member UnsqueezeT: dim: int -> RawTensor
  +
  +    /// Returns the flip of the tensor along the given dimensions 
  +    abstract member FlipT: dims: int[] -> RawTensor
  +
  +    /// Returns the dilation of the tensor using the given dilations paramaters
  +    abstract member DilateT: dilations: int[] -> RawTensor
  +
  +    /// Returns the reverse of the dilation of the tensor using the given dilations paramaters
  +    abstract member UndilateT: dilations: int[] -> RawTensor
  +
  +    /// Returns the tensor with the same values viewed as a different shape
  +    abstract member ViewT: shape: int[] -> RawTensor
  +
  +    /// Returns the element-wise sign of the tensor
       abstract member SignT: unit -> RawTensor
  +
  +    /// Returns the element-wise integer floor of the tensor
       abstract member FloorT: unit -> RawTensor
  +
  +    /// Returns the element-wise integer ceiling of the tensor
       abstract member CeilT: unit -> RawTensor
  +
  +    /// Returns the element-wise rounding of the tensor
       abstract member RoundT: unit -> RawTensor
  +
  +    /// Returns the element-wise absolute value of the tensor
       abstract member AbsT: unit -> RawTensor
  +
  +    /// Returns the element-wise ReLU of the tensor
       abstract member ReluT: unit -> RawTensor
  +
  +    /// Returns the element-wise softplus of the tensor
       abstract member SoftplusT: unit -> RawTensor
  +
  +    /// Returns the element-wise sigmoid of the tensor
       abstract member SigmoidT: unit -> RawTensor
  +
  +    /// Returns the element-wise natural exponentiation of the tensor
       abstract member ExpT: unit -> RawTensor
  +
  +    /// Returns the element-wise natural logarithm of the tensor
       abstract member LogT: unit -> RawTensor
  +
  +    /// Returns the element-wise base10 logarithm of the tensor
       abstract member Log10T: unit -> RawTensor
  +
  +    /// Returns the element-wise square root of the tensor
       abstract member SqrtT: unit -> RawTensor
  +
  +    /// Returns the element-wise sine of the tensor
       abstract member SinT: unit -> RawTensor
  +
  +    /// Returns the element-wise cosine of the tensor
       abstract member CosT: unit -> RawTensor
  +
  +    /// Returns the element-wise tangent of the tensor
       abstract member TanT: unit -> RawTensor
  +
  +    /// Returns the element-wise sinh of the tensor
       abstract member SinhT: unit -> RawTensor
  +
  +    /// Returns the element-wise cosh of the tensor
       abstract member CoshT: unit -> RawTensor
  +
  +    /// Returns the element-wise tanh of the tensor
       abstract member TanhT: unit -> RawTensor
  +
  +    /// Returns the element-wise asin of the tensor
       abstract member AsinT: unit -> RawTensor
  +
  +    /// Returns the element-wise cos of the tensor
       abstract member AcosT: unit -> RawTensor
  +
  +    /// Returns the element-wise atan of the tensor
       abstract member AtanT: unit -> RawTensor
   
       default t.IsInfT() =
  
positive.code:             | :? RawTensor as y -> Unchecked.compare (x.ToScalar()) (y.ToScalar())
              | _ -> failwithf "cannot compare RawTensor with object of type %A" (yobj.GetType())
  
      member t.ToScalar() =
          match t.Dim with
          | 0 -> t.ToValues()
          | _ -> failwithf "Cannot convert %Ad Tensor to scalar" t.Dim
  
      member t.ToArray() =
          match t.Dim with
          | 0 -> failwithf "Cannot convert scalar Tensor to array"
  
negative.code: open DiffSharp
  open DiffSharp.Util
  
  /// <summary>
  ///   Represents the static functionality implemented by a DiffSharp backend for a particular tensor element type.
  /// </summary>
  ///
  /// <namespacedoc>
  ///   <summary>Contains types and functionality related to backend implementations for DiffSharp.</summary>
  /// </namespacedoc>
  [<AbstractClass>]
  type BackendStatics() = 
      // cache for most recently accessed backend
      static let mutable last = None
      static let backends = System.Collections.Concurrent.ConcurrentDictionary<int, BackendStatics>()
  
      /// Sets the seed for the default random number generator of the backend
      abstract Seed: seed:int -> unit
  
      /// Gets the scalar 0 tensor for the given device
      abstract Zero: device: Device -> RawTensor
  
      /// Gets a tensor filled with zeros for the given shape and device
      abstract Zeros: shape:int[] * device: Device -> RawTensor
  
      /// Gets the scalar 1 tensor for the given device
      abstract One: device: Device -> RawTensor
  
      /// Gets a tensor filled with ones for the given shape and device
      abstract Ones: shape:int[] * device: Device -> RawTensor
  
      /// Gets a tensor filled with the given value for the given shape and device
      abstract Full: shape:int[] * value: obj * device: Device -> RawTensor
  
      /// Gets a tensor filled with random values for the given shape and device
      abstract Random: shape:int[] * device: Device -> RawTensor
  
      /// Gets a tensor filled with random values from the normal distribution for the given shape and device
      abstract RandomNormal: shape:int[] * device: Device -> RawTensor
  
      /// Gets a tensor filled with random integers from the given range for the given shape and device
      abstract RandomInt: shape:int[] * low:int * high:int * device: Device -> RawTensor
  
      /// Gets the devices supported by this backend
      abstract GetDevices: ?deviceType: DeviceType -> Device list
  
      /// Indicates if a device type is supported by this backend
      abstract IsDeviceTypeSupported: deviceType: DeviceType -> bool
      
      /// Seed all backends with the given random seed, or a new seed based on the current time
      /// if no seed is specified.
      static member Seed(?seed:int) =
          let seed = defaultArg seed (int DateTime.Now.Ticks)
          Random.Seed(seed) // Do not remove. util.Random seed would be set by the Reference backend if it's currently loaded. However we still need to keep this here to ensure util.Random seed is set (it may be used in code other than the Reference backend).
  