コード例 #1
0
        public MatrixOutput(CudaProvider cuda, int rows, int columns, int count, bool setToZero)
        {
            //_cuda = cuda;
            _rows    = rows;
            _columns = columns;

            for (var i = 0; i < count; i++)
            {
                _data.Add(setToZero
                    ? cuda.CreateZeroMatrix(rows, columns)
                    : cuda.CreateMatrix(rows, columns)
                          );
            }
            _ptr = _data.Cast <GpuMatrix>().Select(m => m.Memory.DevicePointer).ToArray();
        }
コード例 #2
0
ファイル: TensorOutput.cs プロジェクト: prosa100/brightwire
        public TensorOutput(CudaProvider cuda, int rows, int columns, int depth, int count, bool setToZero)
        {
            _cuda    = cuda;
            _rows    = rows;
            _columns = columns;
            _depth   = depth;
            _count   = count;

            // allocate space for the output
            _data = setToZero
                ? cuda.CreateZeroMatrix(rows * columns * depth, count)
                : cuda.CreateMatrix(rows * columns * depth, count)
            ;

            // get the pointers
            for (var i = 0; i < count; i++)
            {
                var tensor = _data.Column(i).Split(depth).Cast <GpuVector>().Select(v => v.Memory).ToArray();
                _ptr.Add(tensor);
            }
        }