Пример #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
        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));
 }
 public DisposedTensorBase(GCHandle handle, long length, bool returned, TensorConfig conf) : base((void *)handle.AddrOfPinnedObject(), length, returned, conf)
 {
     this.Handle = handle;
 }
Пример #6
0
 public Tensor(Shape s, TensorConfig devconfig)
 {
     Initialize(s, devconfig);
 }
Пример #7
0
 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.
 }