示例#1
0
        /// <summary>
        /// Creates a new NdArray filled with ones (1).
        /// </summary>
        /// <param name="device">The device to create the NdArray on.</param>
        /// <param name="shape">The shape of the new NdArray.</param>
        /// <returns>The new NdArray.</returns>
        public static NdArray <T> Ones(IDevice device, int[] shape)
        {
            var newArray = new NdArray <T>(shape, device);

            newArray.FillConst(Primitives.One <T>());

            return(newArray);
        }
示例#2
0
        /// <summary>
        /// Creates a new NdArray filled with the specified value.
        /// </summary>
        /// <param name="device">The device to create the NdArray on.</param>
        /// <param name="shape">The shape of the new NdArray.</param>
        /// <param name="value">The value to fill the new NdArray with.</param>
        /// <returns>The new NdArray.</returns>
        public static NdArray <TF> Filled <TF>(IDevice device, int[] shape, TF value)
        {
            var newArray = new NdArray <TF>(shape, device);

            newArray.FillConst(value);

            return(newArray);
        }