/// <summary>コンストラクタ</summary> public QuaternionConvolution1D(int inwidth, int inchannels, int outchannels, int kwidth, int stride, bool gradmode = false, int batch = 1) { if (stride < 1) { throw new ArgumentException(nameof(stride)); } if (inchannels % 4 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(inchannels), inchannels, 4)); } if (outchannels % 4 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(outchannels), outchannels, 4)); } int outwidth = (inwidth - kwidth) / stride + 1; this.arguments = new List <(ArgumentType type, Shape shape)> { (ArgumentType.In, Shape.Map1D(inchannels, inwidth, batch)), (ArgumentType.In, Shape.Kernel1D(inchannels, outchannels / 4, kwidth)), (ArgumentType.Out, Shape.Map1D(outchannels, outwidth, batch)), }; this.InChannels = inchannels; this.OutChannels = outchannels; this.KernelWidth = kwidth; this.Stride = stride; this.GradMode = gradmode; this.Batch = batch; }
/// <summary>コンストラクタ</summary> public TrivectorDeconvolution3D(int outwidth, int outheight, int outdepth, int inchannels, int outchannels, int kwidth, int kheight, int kdepth, int stride, bool gradmode = false, int batch = 1) { if (stride < 1) { throw new ArgumentException(nameof(stride)); } if (inchannels % 3 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(inchannels), inchannels, 3)); } if (outchannels % 3 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(outchannels), outchannels, 3)); } int inwidth = (outwidth - kwidth) / stride + 1; int inheight = (outheight - kheight) / stride + 1; int indepth = (outdepth - kdepth) / stride + 1; this.arguments = new List <(ArgumentType type, Shape shape)> { (ArgumentType.In, Shape.Map3D(inchannels, inwidth, inheight, indepth, batch)), (ArgumentType.In, Shape.Kernel3D(outchannels / 3 * 4, inchannels / 3, kwidth, kheight, kdepth)), (ArgumentType.Out, Shape.Map3D(outchannels, outwidth, outheight, outdepth, batch)), }; this.InChannels = inchannels; this.OutChannels = outchannels; this.KernelWidth = kwidth; this.KernelHeight = kheight; this.KernelDepth = kdepth; this.Stride = stride; this.GradMode = gradmode; this.Batch = batch; }
/// <summary>コンストラクタ</summary> public ComplexKernelProduct3D(int inwidth, int inheight, int indepth, int inchannels, int outchannels, int kwidth, int kheight, int kdepth, int stride, bool transpose = false, int batch = 1) { if (stride < 1) { throw new ArgumentException(nameof(stride)); } if (inchannels % 2 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(inchannels), inchannels, 2)); } if (outchannels % 2 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(outchannels), outchannels, 2)); } int outwidth = (inwidth - kwidth) / stride + 1; int outheight = (inheight - kheight) / stride + 1; int outdepth = (indepth - kdepth) / stride + 1; this.arguments = new List <(ArgumentType type, Shape shape)> { (ArgumentType.In, Shape.Map3D(inchannels, inwidth, inheight, indepth, batch)), (ArgumentType.In, Shape.Map3D(outchannels, outwidth, outheight, outdepth, batch)), (ArgumentType.Out, Shape.Kernel3D(inchannels, outchannels / 2, kwidth, kheight, kdepth)), }; this.InChannels = inchannels; this.OutChannels = outchannels; this.KernelWidth = kwidth; this.KernelHeight = kheight; this.KernelDepth = kdepth; this.Stride = stride; this.Transpose = transpose; this.Batch = batch; }
/// <summary>コンストラクタ</summary> public ComplexConvolution2D(int inwidth, int inheight, int inchannels, int outchannels, int kwidth, int kheight, int stride, bool gradmode = false, int batch = 1) { if (stride < 1) { throw new ArgumentException(nameof(stride)); } if (inchannels % 2 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(inchannels), inchannels, 2)); } if (outchannels % 2 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(outchannels), outchannels, 2)); } int outwidth = (inwidth - kwidth) / stride + 1; int outheight = (inheight - kheight) / stride + 1; this.arguments = new List <(ArgumentType type, Shape shape)> { (ArgumentType.In, Shape.Map2D(inchannels, inwidth, inheight, batch)), (ArgumentType.In, Shape.Kernel2D(inchannels, outchannels / 2, kwidth, kheight)), (ArgumentType.Out, Shape.Map2D(outchannels, outwidth, outheight, batch)), }; this.InChannels = inchannels; this.OutChannels = outchannels; this.KernelWidth = kwidth; this.KernelHeight = kheight; this.Stride = stride; this.GradMode = gradmode; this.Batch = batch; }
/// <summary>コンストラクタ</summary> public TrivectorKernelProduct1D(int inwidth, int inchannels, int outchannels, int kwidth, int stride, bool transpose = false, int batch = 1) { if (stride < 1) { throw new ArgumentException(nameof(stride)); } if (inchannels % 3 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(inchannels), inchannels, 3)); } if (outchannels % 3 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(outchannels), outchannels, 3)); } int outwidth = (inwidth - kwidth) / stride + 1; this.arguments = new List <(ArgumentType type, Shape shape)> { (ArgumentType.In, Shape.Map1D(inchannels, inwidth, batch)), (ArgumentType.In, Shape.Map1D(outchannels, outwidth, batch)), (ArgumentType.In, Shape.Kernel1D(inchannels / 3 * 4, outchannels / 3, kwidth)), (ArgumentType.Out, Shape.Kernel1D(inchannels / 3 * 4, outchannels / 3, kwidth)), }; this.InChannels = inchannels; this.OutChannels = outchannels; this.KernelWidth = kwidth; this.Stride = stride; this.Transpose = transpose; this.Batch = batch; }
/// <summary>コンストラクタ</summary> public ComplexDense(int inchannels, int outchannels, bool gradmode = false, int batch = 1) { if (inchannels % 2 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(inchannels), inchannels, 2)); } if (outchannels % 2 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(outchannels), outchannels, 2)); } this.arguments = new List <(ArgumentType type, Shape shape)> { (ArgumentType.In, Shape.Map0D(inchannels, batch)), (ArgumentType.In, Shape.Kernel0D(inchannels, outchannels / 2)), (ArgumentType.Out, Shape.Map0D(outchannels, batch)), }; this.InChannels = inchannels; this.OutChannels = outchannels; this.GradMode = gradmode; this.Batch = batch; }
/// <summary>コンストラクタ</summary> public QuaternionKernelProductDense(int inchannels, int outchannels, bool transpose = false, int batch = 1) { if (inchannels % 4 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(inchannels), inchannels, 4)); } if (outchannels % 4 != 0) { throw new ArgumentException(ExceptionMessage.ArgumentMultiple(nameof(outchannels), outchannels, 4)); } this.arguments = new List <(ArgumentType type, Shape shape)> { (ArgumentType.In, Shape.Map0D(inchannels, batch)), (ArgumentType.In, Shape.Map0D(outchannels, batch)), (ArgumentType.Out, Shape.Kernel0D(inchannels, outchannels / 4)) }; this.InChannels = inchannels; this.OutChannels = outchannels; this.Transpose = transpose; this.Batch = batch; }