Beispiel #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];
            }
        }
Beispiel #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));
        }
Beispiel #3
0
 public static bool operator <(Tensor <T> left, T right)
 {
     return(SimdOps <T> .Less(left.InternalArray, right));
 }
Beispiel #4
0
 public static bool operator >(T left, Tensor <T> right)
 {
     return(SimdOps <T> .Less(right.InternalArray, left));
 }