Example #1
0
        /// <summary>
        /// Computes the complementary error function of input.
        /// </summary>
        /// <param name="input">The input tensor</param>
        /// <returns></returns>
        public static TorchTensor erfc(TorchTensor input)
        {
            var res = THSSpecial_erfc(input.Handle);

            if (res == IntPtr.Zero)
            {
                Torch.CheckForErrors();
            }
            return(new TorchTensor(res));
        }
Example #2
0
        /// <summary>
        /// Computes input * log1p(other). Similar to SciPy’s scipy.special.xlog1py.
        /// </summary>
        /// <param name="input">The input tensor</param>
        /// <param name="other"></param>
        /// <returns></returns>
        public static TorchTensor xlog1py(TorchTensor input, TorchTensor other)
        {
            var res = THSSpecial_xlog1py(input.Handle, other.Handle);

            if (res == IntPtr.Zero)
            {
                Torch.CheckForErrors();
            }
            return(new TorchTensor(res));
        }
Example #3
0
 public static TorchTensor matrix_rank(TorchTensor input, double?tol = null, bool hermitian = false)
 {
     unsafe {
         var res = THSLinalg_matrix_rank(input.Handle, tol ?? double.NegativeInfinity, tol.HasValue, hermitian);
         if (res == IntPtr.Zero)
         {
             Torch.CheckForErrors();
         }
         return(new TorchTensor(res));
     }
 }
Example #4
0
        public static TorchTensor tensorsolve(TorchTensor input, TorchTensor other, long[] dims)
        {
            unsafe
            {
                fixed(long *pdims = dims)
                {
                    var res = THSLinalg_tensorsolve(input.Handle, other.Handle, (IntPtr)pdims, dims.Length);

                    if (res == IntPtr.Zero)
                    {
                        Torch.CheckForErrors();
                    }
                    return(new TorchTensor(res));
                }
            }
        }
Example #5
0
        public static TorchTensor norm(TorchTensor input, long[]?dims = null, bool keepdim = false)
        {
            unsafe
            {
                fixed(long *pdims = dims)
                {
                    var res = THSLinalg_norm_opt(input.Handle, (IntPtr)pdims, dims is null ? 0 : dims.Length, keepdim);

                    if (res == IntPtr.Zero)
                    {
                        Torch.CheckForErrors();
                    }
                    return(new TorchTensor(res));
                }
            }
        }