Exemple #1
0
        internal Gpu4DTensor(CudaProvider provider, IReadOnlyList <I3DTensor> tensorList)
        {
            var first = tensorList.First();

            _cuda    = provider;
            _rows    = first.RowCount;
            _columns = first.ColumnCount;
            _depth   = first.Depth;
            _count   = tensorList.Count;
            provider.Register(this);

            _data       = _cuda.CreateZeroMatrix(_rows * _columns * _depth, _count);
            _subVector  = new Lazy <List <GpuVector[]> >(_GetSubVectors);
            _tensorInfo = new Lazy <TensorInput>(_GetInput);

            for (var i = 0; i < _count; i++)
            {
                _data.Column(i).AddInPlace(tensorList[i].ConvertToVector());
            }

#if DEBUG
            if (_id == _badAlloc)
            {
                Debugger.Break();
            }
#endif
        }