コード例 #1
0
 public TensorBase(void *ptr, long length, bool returned, TensorConfig conf)
 {
     this.Array         = ptr;
     this.Length        = length;
     this.ArrayReturned = returned;
     this.Config        = conf;
 }
コード例 #2
0
        public TensorBase(long length, TensorConfig conf)
        {
            this.Length        = length;
            this.ArrayReturned = false;
            this.Config        = conf;
            var ptr = TensorPool.GetDevicePool(this.Config.Device).Rent(length, this.Config.GetUnitLength());

            this.Array = ptr;
        }
コード例 #3
0
ファイル: Tensor.cs プロジェクト: faruknane/PerformanceWork
        public Tensor(Shape s, TensorBase tbase)
        {
            if (s.TotalSize > tbase.Length)
            {
                throw new Exception("Can't create a tensor larger than its base!");
            }

            this.Shape  = s;
            this.Config = tbase.Config;
            this.Base   = tbase;
        }
コード例 #4
0
 public long GetUnitLength()
 {
     return(TensorConfig.GetUnitLength(this.NumType));
 }
コード例 #5
0
 public DisposedTensorBase(GCHandle handle, long length, bool returned, TensorConfig conf) : base((void *)handle.AddrOfPinnedObject(), length, returned, conf)
 {
     this.Handle = handle;
 }
コード例 #6
0
ファイル: Tensor.cs プロジェクト: faruknane/PerformanceWork
 public Tensor(Shape s, TensorConfig devconfig)
 {
     Initialize(s, devconfig);
 }
コード例 #7
0
ファイル: Tensor.cs プロジェクト: faruknane/PerformanceWork
 protected Tensor(Shape s, void *ptr, TensorConfig devconfig)
 {
     this.Shape  = s;
     this.Config = devconfig;
     this.Base   = new TensorBase(ptr, s.TotalSize, true, devconfig);//means that the array wont be returned to the pool.
 }