Ejemplo n.º 1
0
        public Shape(params int[] dims)
        {
            if (dims.Length == 0)
            {
                Rank   = 0;
                Volume = 0;
                Dims   = Array.Empty <int>();
                return;
            }

            if (SimdOps <int> .Less(dims, 1))
            {
                throw new ArgumentOutOfRangeException($"{nameof(dims)} must be in range >= 1.");
            }

            Rank = dims.Length;

            Dims = dims.AsSpan().ToArray();

            Volume = 1;

            for (int i = 0; i < dims.Length; i++)
            {
                Volume *= dims[i];
            }
        }
Ejemplo n.º 2
0
        public static bool operator <(Tensor <T> left, Tensor <T> right)
        {
            if (left.Shape != right.Shape)
            {
                throw new ShapeMismatchException(nameof(right));
            }

            return(SimdOps <T> .Less(left.InternalArray, right.InternalArray));
        }
Ejemplo n.º 3
0
 public static bool operator <(Tensor <T> left, T right)
 {
     return(SimdOps <T> .Less(left.InternalArray, right));
 }
Ejemplo n.º 4
0
 public static bool operator >(T left, Tensor <T> right)
 {
     return(SimdOps <T> .Less(right.InternalArray, left));
 }