コード例 #1
0
        public static ConstantTensor Constant(Matrix <float> value)
        {
            ConstantTensor newTensor = new ConstantTensor(value, typeof(float));
            int            count     = Tensors.Count(t => t.Value is ConstantTensor);

            return((ConstantTensor)AddTensor(newTensor, count));
        }
コード例 #2
0
        public static ConstantTensor Constant(params float[] values)
        {
            ConstantTensor newTensor = new ConstantTensor(Matrix <float> .Build.Dense(1, values.Length, (int x, int y) => values[y]), typeof(float));
            int            count     = Tensors.Count(t => t.Value is ConstantTensor);

            return((ConstantTensor)AddTensor(newTensor, count));
        }
コード例 #3
0
        public static ConstantTensor Constant(object value, Type type)
        {
            float          convertedValue = (float)Convert.ChangeType(value, typeof(float));
            ConstantTensor newTensor      = new ConstantTensor(Matrix <float> .Build.Dense(1, 1, convertedValue), type);
            int            count          = Tensors.Count(t => t.Value is ConstantTensor);

            return((ConstantTensor)AddTensor(newTensor, count));
        }