Пример #1
0
        public static TensorOld <TOut> Cast <TIn, TOut>(this TensorOld <TIn> t, Func <TIn, TOut> converter = null)
        {
            if (converter == null)
            {
                converter = NumericUtils.GetNumericConverter <TIn, TOut>();
            }

            TensorOld <TOut> result = new TensorOld <TOut>(t.ShapeDimensions.ToArray());

            result.SetSpan(t.TheSpan.Select(item => converter(item)));

            return(result);
        }