Example #1
0
        public VolumeStorage(VolumeStorage storage, Shape newShape) : base(newShape)
        {
            if (storage == null)
            {
                throw new ArgumentNullException(nameof(storage));
            }

            if (storage._hostPointer == null)
            {
                throw new ArgumentException();
            }

            this._isOwner           = false;
            this._hostPointer       = storage._hostPointer;
            this.Shape              = newShape;
            this.Context            = storage.Context;
            this._allocatedOnDevice = storage._allocatedOnDevice;

            storage.CopyToDevice();

            this.Location     = DataLocation.Device;
            this.DeviceBuffer = new CudaDeviceVariable <float>(storage.DeviceBuffer.DevicePointer);

            this.ConvolutionBackwardFilterStorage = storage.ConvolutionBackwardFilterStorage;
            this.ConvolutionBackwardStorage       = storage.ConvolutionBackwardStorage;
            this.ConvolutionStorage  = storage.ConvolutionStorage;
            this.ReductionStorage    = storage.ReductionStorage;
            this.DropoutStorage      = storage.DropoutStorage;
            this.DropoutStateStorage = storage.DropoutStateStorage;
        }
        public VolumeStorage(VolumeStorage storage, Shape newShape) : base(newShape)
        {
            this._isOwner     = false;
            this._hostPointer = storage._hostPointer;
            this.Shape        = newShape;
            this.HostBuffer   = storage.HostBuffer;
            this.Context      = storage.Context;

            storage.CopyToDevice();

            this.Location     = DataLocation.Device;
            this.DeviceBuffer = new CudaDeviceVariable <float>(storage.DeviceBuffer.DevicePointer);
        }
Example #3
0
        public VolumeStorage(VolumeStorage storage, Shape shape)
            : this(shape, storage.Context, storage.Shape.TotalLength)
        {
            this._isOwner           = false;
            this.Location           = storage.Location;
            this.HostBuffer         = storage.HostBuffer;
            this._hostPointer       = storage._hostPointer;
            this._allocatedOnDevice = storage._allocatedOnDevice;

            storage.CopyToDevice();
            this.DeviceBuffer = new CudaDeviceVariable <float>(storage.DeviceBuffer.DevicePointer);

            this.Location = DataLocation.Device;
        }