public static XArray operator /(double lhs, XArray rhs) { XArray lhs_t = new XArray(rhs.Shape, rhs.DataType); lhs_t.Fill(lhs); return(lhs_t / rhs); }
public static XArray operator >>(XArray lhs, int rhs) { XArray rhs_t = new XArray(lhs.Shape, lhs.DataType); rhs_t.Fill(rhs); return(xt.BitwiseRightShift(lhs, rhs_t)); }
public static XArray operator ^(XArray lhs, double rhs) { XArray rhs_t = new XArray(lhs.Shape, lhs.DataType); rhs_t.Fill(rhs); return(xt.BitwiseXor(lhs, rhs_t)); }
public XArray Randn(Shape shape, double mean = 0, double std_dev = 1, DType dtype = DType.Float32) { XArray r = new XArray(shape, dtype); NativeWrapper.TS_Random_Randn(r.GetRef(), mean, std_dev); return(r); }
public static XArray operator /(XArray lhs, double rhs) { XArray rhs_t = new XArray(lhs.Shape, lhs.DataType); rhs_t.Fill(rhs); return(lhs / rhs_t); }
public static XArray operator ^(double lhs, XArray rhs) { XArray lhs_t = new XArray(rhs.Shape, rhs.DataType); lhs_t.Fill(lhs); return(xt.BitwiseXor(lhs_t, rhs)); }
public static XArray NormLp2P(XArray x, double p, params int[] axes) { if (axes.Length > 0) { return(NativeHelper.Reduce(x, axes, p, 0, 0, ReduceFunc.NormLp2P)); } return(NativeHelper.ReduceAll(x, ReduceFunc.NormLp2P, p)); }
public static XArray NormL0(XArray x, params int[] axes) { if (axes.Length > 0) { return(NativeHelper.Reduce(x, axes, 0, 0, 0, ReduceFunc.NormL0)); } return(NativeHelper.ReduceAll(x, ReduceFunc.NormL0)); }
public static XArray NanCumProd(XArray x, int?axis = null) { if (axis.HasValue) { return(NativeHelper.Accumulating(x, axis.Value, ReduceFunc.NanCumProd)); } return(NativeHelper.Accumulating(x, -9999, ReduceFunc.NanCumProd)); }
internal static XArray FromRef(XArrayRef tensorRef) { long[] shape_data = new long[tensorRef.dimCount]; Marshal.Copy(tensorRef.sizes, shape_data, 0, shape_data.Length); Shape shape = new Shape(shape_data); XArray result = new XArray(shape, tensorRef.elementType); result.NativePtr = tensorRef.buffer; return(result); }
internal XArrayRef AllocTensorRef(XArray tensor) { var tensorRef = new XArrayRef(); tensorRef.buffer = GetBufferStart(tensor); tensorRef.dimCount = tensor.Shape.Length; tensorRef.sizes = AllocArray(tensor.Shape.Data); tensorRef.strides = AllocArray(tensor.strides); tensorRef.elementType = tensor.DataType; return(tensorRef); }
public static XArray Remainder(XArray a, XArray b) => NativeHelper.ElementwiseOps(a, b, ElementwiseFunc.Remainder);
public XArray Choice(Shape shape, int n, XArray weight, bool replace = true, DType dtype = DType.Float32) { return(NativeHelper.RandomChoice(shape, n, weight, replace, dtype)); }
public static XArray Trapz(XArray x, double dx = 1, int axis = -1) { return(NativeHelper.Reduce(x, new int[1] { 0 }, dx, 0, axis, ReduceFunc.Trapz)); }
public bool Any(int axis = -1, bool keepdims = true, XArray where = null) { throw new NotImplementedException(); }
public XArray SearchSorted(XArray v, string side = "") { throw new NotImplementedException(); }
public static XArray Diff(XArray x, int n, int axis = -1) { return(NativeHelper.Reduce(x, new int[1] { 0 }, 0, n, axis, ReduceFunc.Diff)); }
public static XArray Fma(XArray a, XArray b, XArray c) => NativeHelper.ElementwiseOps(a, b, c, ElementwiseFunc.Fma);
public static XArray FDim(XArray a, XArray b) => NativeHelper.ElementwiseOps(a, b, ElementwiseFunc.FDim);
public static XArray Sign(XArray x) => throw new NotImplementedException();
public IntPtr GetBufferStart(XArray tensor) { return(PtrAdd(NativePtr, tensor.storageOffset * tensor.DataType.Size())); }
public XArray Take(XArray indices, int axis = -1, string mode = "raise") { throw new NotImplementedException(); }
public XArray Put(XArray indices, XArray v, string mode = "raise") { throw new NotImplementedException(); }
public XArray Choose(XArray choices, string mode = "raise") { throw new NotImplementedException(); }
public static XArray Maximum(XArray a, XArray b) => NativeHelper.ElementwiseOps(a, b, ElementwiseFunc.Maximum);
public static XArray Nan2Num(XArray x, int?axis = null) { return(NativeHelper.ReduceAll(x, ReduceFunc.Nan2Num)); }
public static XArray Clip(XArray x, double min, double max) => NativeHelper.Clip(x, min, max);
public XArray ArgPartition(XArray kth, int axis = -1) { throw new NotImplementedException(); }
public static XArray Abs(XArray x) => NativeHelper.ElementwiseOps(x, ElementwiseFunc.Abs);
public static XArray Where(XArray cond, XArray x, XArray y) { return(NativeHelper.ElementwiseOps(cond, x, y, ElementwiseFunc.Where)); }