//傾きの初期化 public void ClearGrad() { this.Grad = new RealArray(this.Data.Length); //カウンタをリセット this.TrainCount = 0; }
public void Dispose() { Data?.Dispose(); Data = null; Grad?.Dispose(); Grad = null; }
public NdArray(params int[] shape) { this.Data = new RealArray(ShapeToArrayLength(shape)); this.Shape = shape.ToArray(); this.Length = Data.Length; this.BatchCount = 1; this.Grad = new RealArray(this.Length); this.TrainCount = 0; }
public NdArray(Real[] data, int[] shape, int batchCount = 1, Function parentFunc = null) { this.Shape = shape.ToArray(); this.Length = data.Length / batchCount; this.BatchCount = batchCount; this.Data = new RealArray(data.ToArray()); this.Grad = new RealArray(this.Length * batchCount); this.TrainCount = 0; this.ParentFunc = parentFunc; }
public NdArray(RealArray data, RealArray grad, int[] shape, int batchCount = 1, Function parentFunc = null) { this.Shape = shape.ToArray(); this.Length = data.Length / batchCount; this.BatchCount = batchCount; this.Data = data; this.Grad = grad; this.TrainCount = 0; this.ParentFunc = parentFunc; }
public NdArray(int[] shape, int batchCount, Function parentFunc = null) { this.Shape = shape.ToArray(); this.Length = ShapeToArrayLength(this.Shape); this.BatchCount = batchCount; this.Data = new RealArray(this.Length * batchCount); this.Grad = new RealArray(this.Length * batchCount); this.TrainCount = 0; this.ParentFunc = parentFunc; }
public NdArray(Array data, Function parentFunc = null) { Real[] resultData = Real.GetArray(data); int[] resultShape = new int[data.Rank]; for (int i = 0; i < data.Rank; i++) { resultShape[i] = data.GetLength(i); } this.Data = new RealArray(resultData); this.Shape = resultShape; this.Length = Data.Length; this.Grad = new RealArray(this.Length); this.BatchCount = 1; this.TrainCount = 0; this.ParentFunc = parentFunc; }
public DeviceSwitchHandler(RealArray obj, ComputeDeviceTypes type) { this.obj = obj; this.type = type; }
public string ToString(RealArray array) { return(ToString(array.GetArray())); }
public static NdArray Convert(RealArray data, int[] shape, int batchCount, Function parentFunc = null) { return(new NdArray(data, shape, batchCount, parentFunc)); }