Ejemplo n.º 1
0
        protected override void ConvertVariable(ComputeVariable _variable)
        {
            var variable = _variable as Variable.AffineVariable;

            BatchCount = variable.BatchCount;

            InWidth       = variable.InWidth;
            InHeight      = variable.InHeight;
            InputChannels = variable.InputChannels;

            OutWidth       = variable.OutWidth;
            OutHeight      = variable.OutHeight;
            OutputChannels = variable.OutputChannels;

            InSize  = variable.InSize;
            InArea  = variable.InArea;
            InTotal = variable.InTotal;

            OutSize  = variable.OutSize;
            OutArea  = variable.OutArea;
            OutTotal = variable.OutTotal;

            OptimizerType = variable.OptimizerType;
            Rho           = variable.Rho;

            Weight = variable.Weight.Data;

            Input      = variable.Input.Data;
            Output     = variable.Output.Data;
            Sigma      = variable.Sigma.Data;
            Propagator = variable.Propagator.Data;

            Error      = variable.Error;
            Difference = variable.WeightDifference;
        }
Ejemplo n.º 2
0
        public void AddConvolution(int outch, int kernelsize, int expand,
                                   Utility.Types.Optimizer type = Utility.Types.Optimizer.Adam, double scale = 1, double rho = 0.0005)
        {
            int inw, inh, inch;

            GetLayerInputInfomation(out inw, out inh, out inch);

            AddLayer(new Layer.Convolution(true)
            {
                Variable = new DedicatedFunction.Variable.ConvolutionVariable()
                {
                    BatchCount    = BatchCount,
                    InputChannels = inch,
                    InWidth       = inw,
                    InHeight      = inh,

                    OutputChannels = outch,
                    OutScale       = scale,

                    KernelSize    = kernelsize,
                    KernelExpand  = expand,
                    OptimizerType = type,
                    Rho           = rho,
                }.Confirm(Instance),
            }.Confirm());
        }
Ejemplo n.º 3
0
        public static OptimizerBase CreateInstance(Utility.Types.Optimizer type, List <Components.RNdMatrix> sender, Components.Real[] weight)
        {
            OptimizerBase instance = null;

            switch (type)
            {
            case Utility.Types.Optimizer.Adam:
                instance = new Adam(sender, weight);
                break;

            case Utility.Types.Optimizer.AdaSelf:
                instance = new AdaSelf(sender, weight);
                break;

            default:
                break;
            }
            return(instance);
        }
Ejemplo n.º 4
0
        protected override void ConvertVariable(ComputeVariable _variable)
        {
            var variable = _variable as Variable.ConvolutionVariable;

            BatchCount = variable.BatchCount;

            InWidth       = variable.InWidth;
            InHeight      = variable.InHeight;
            InputChannels = variable.InputChannels;

            OutScale       = (float)variable.OutScale;
            OutWidth       = variable.OutWidth;
            OutHeight      = variable.OutHeight;
            OutputChannels = variable.OutputChannels;

            InSize  = variable.InSize;
            InArea  = variable.InArea;
            InTotal = variable.InTotal;

            OutSize  = variable.OutSize;
            OutArea  = variable.OutArea;
            OutTotal = variable.OutTotal;

            KernelSize   = variable.KernelSize;
            KernelArea   = variable.KernelArea;
            KernelLength = variable.KernelLength;
            KernelExpand = variable.KernelExpand;

            OptimizerType = variable.OptimizerType;
            rho           = variable.Rho;

            Input        = variable.Input.Data;
            Output       = variable.Output.Data;
            Sigma        = variable.Sigma.Data;
            Propagator   = variable.Propagator.Data;
            WeightKernel = variable.WeightKernel.Data;
            WeightBias   = variable.WeightBias.Data;

            Error      = variable.Error;
            Difference = variable.WeightDifference;
        }
Ejemplo n.º 5
0
        public void AddAffine(int outcount, Utility.Types.Optimizer type = Utility.Types.Optimizer.Adam, double rho = 0.0005)
        {
            int inw, inh, inch;

            GetLayerInputInfomation(out inw, out inh, out inch);

            AddLayer(new Layer.Affine(true)
            {
                Variable = new DedicatedFunction.Variable.AffineVariable()
                {
                    BatchCount    = BatchCount,
                    InputChannels = inch,
                    InWidth       = inw,
                    InHeight      = inh,

                    OutputChannels = 1,
                    OutWidth       = 1,
                    OutHeight      = outcount,

                    OptimizerType = type,
                    Rho           = rho,
                }.Confirm(Instance),
            }.Confirm());
        }