コード例 #1
0
        public Pooling(Shape inputShape, Shape outputShape, Shape kernelShape, Array <int> strides, IOperation poolOp, double padVal = 0.0) : base(outputShape)
        {
            InputShape  = inputShape;
            KernelShape = kernelShape;
            Strides     = strides;
            PoolOp      = poolOp;
            PadVal      = padVal;

            Paddings = Padder.CalcPadding(inputShape, outputShape, kernelShape, strides, true);

            PaddedShape = inputShape.Pad(Paddings);
        }
コード例 #2
0
        public Convolutional(Shape inputShape, Shape outputShape, Shape kernelShape, Array <int> strides, IActivation activation,
                             IInitializer?weightInit = null, IInitializer?biasInit = null, double padVal = 0.0)
            : base(outputShape, activation, weightInit, biasInit)
        {
            ValidateChannels(inputShape, outputShape, kernelShape, strides);

            InputShape  = inputShape;
            KernelShape = kernelShape;
            Strides     = strides;
            PadVal      = padVal;

            Paddings = Padder.CalcPadding(inputShape, outputShape, kernelShape, strides, false);

            PaddedShape = inputShape.Pad(Paddings);

            KernelsNum = outputShape.Dims[0] / inputShape.Dims[0];

            Kernels = new Array <Kernel>(KernelsNum, () => new Kernel(kernelShape));

            Neurons = new Array <Neuron>(outputShape.Volume, () => new CNeuron());
        }