public TensorBase(void *ptr, long length, bool returned, TensorConfig conf) { this.Array = ptr; this.Length = length; this.ArrayReturned = returned; this.Config = conf; }
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; }
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; }
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; }
public Tensor(Shape s, TensorConfig devconfig) { Initialize(s, devconfig); }
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. }