Example #1
0
        protected override void ConvertVariable(ComputeVariable _variable)
        {
            var variable = _variable as Variable.ReshapeVariable;

            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;

            Sigma      = variable.Sigma.Data;
            Propagator = variable.Propagator.Data;
        }
Example #2
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;
        }
Example #3
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;

            Weight = variable.Weight.Data;

            Input  = variable.Input.Data;
            Output = variable.Output.Data;
        }
Example #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;

            Input        = variable.Input.Data;
            Output       = variable.Output.Data;
            WeightKernel = variable.WeightKernel.Data;
            WeightBias   = variable.WeightBias.Data;
        }
 protected override void UpdateWithCondition(bool ForceUpdate, ComputeVariable variable)
 {
     if (ForceUpdate || UpdateConditionCheck(variable))
     {
         Update(BatchCounter, variable);
     }
 }
Example #6
0
        protected override void ConvertVariable(ComputeVariable _variable)
        {
            var variable = _variable as Variable.PoolingVariable;

            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;

            CompressSize = variable.CompressSize;
            ExpandSize   = variable.ExpandSize;

            Sigma      = variable.Sigma.Data;
            Propagator = variable.Propagator.Data;
            Map        = variable.Map.Data;

            Error = variable.Error;
        }
Example #7
0
 public void OptionCreater(ComputeVariable variable)
 {
     if (!OptionCreated)
     {
         Variable = variable;
         ConvertVariable(variable);
         CreateOption();
         OptionCreated = true;
     }
 }
Example #8
0
        protected override void ConvertVariable(ComputeVariable variable)
        {
            connectWeight          = variable.Parameter[0].Instance;
            axsonConnectCount      = variable.Parameter[1].Instance;
            axsonConnectStartIndex = variable.Parameter[2].Instance;
            axsonConnectMatrix     = variable.Parameter[3].Instance;

            cellCount   = (int)variable["CellCount"].Value;
            neuronCount = (int)variable["NeuronCount"].Value;
        }
Example #9
0
        protected override void ConvertVariable(ComputeVariable variable)
        {
            px      = variable.Parameter[0].Instance;
            py      = variable.Parameter[1].Instance;
            pz      = variable.Parameter[2].Instance;
            paxson  = variable.Parameter[3].Instance;
            phasRef = variable.Parameter[4].Instance;

            count        = (int)variable["count"].Value;
            connectcount = (int)variable["connectcount"].Value;
        }
Example #10
0
        protected override void GpuFunction(ComputeVariable variable)
        {
            int len  = variable[0].Infomation.ArrayLength;
            int area = 10000;

            using (Cloo.ComputeBuffer <Real> _input = ConvertBuffer(variable[0].Instance))
                using (Cloo.ComputeBuffer <Real> _output = ConvertBuffer(variable[1].Instance))
                {
                    SetParameter(_input);
                    SetParameter(_output);
                    SetParameter(len, ValueMode.INT);
                    SetParameter(area, ValueMode.INT);
                    Execute(len);
                    ReadBuffer(_output, ref variable[1].Instance.Array.Data);
                }
        }
Example #11
0
        public void Do(bool ForceUpdate, ComputeVariable variable)
        {
            DateTime start = DateTime.Now;

            try
            {
                _cParam = variable.Parameter;
                ConvertVariable(variable);
                ProcessFunction();
                UpdateWithCondition(ForceUpdate, variable);

                ClearGpuParameter();
            }
            catch (Exception ex)
            {
                State.ExceptionState(ex);
            }
            StepElapsedSpan = (DateTime.Now - start);
        }
Example #12
0
        protected override void ConvertVariable(ComputeVariable _variable)
        {
            var variable = _variable as Variable.ConvolutionValiable;

            variable.Output = new Components.RNdMatrix(variable.BatchCount, variable.OutputChannels, variable.Width, variable.Height);

            width  = variable.Width;
            height = variable.Height;
            ich    = variable.InputChannels;
            och    = variable.OutputChannels;
            batch  = variable.BatchCount;

            input  = variable.Input.Data;
            output = variable.Output.Data;

            kernel  = variable.WeightKernel.Data;
            ksize   = variable.KernekSize;
            karea   = 2 * ksize + 1;
            klength = karea * karea;
        }
Example #13
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;
        }
Example #14
0
        protected override void ConvertVariable(ComputeVariable variable)
        {
            cellValue              = variable.Parameter[0].Instance;
            cellSignal             = variable.Parameter[1].Instance;
            cellActivity           = variable.Parameter[2].Instance;
            cellState              = variable.Parameter[3].Instance;
            connectWeight          = variable.Parameter[4].Instance;
            cellEnergy             = variable.Parameter[5].Instance;
            axsonConnectCount      = variable.Parameter[6].Instance;
            axsonConnectStartIndex = variable.Parameter[7].Instance;
            axsonConnectMatrix     = variable.Parameter[8].Instance;
            resValue    = variable.Parameter[9].Instance;
            resSignal   = variable.Parameter[10].Instance;
            resActivity = variable.Parameter[11].Instance;
            resState    = variable.Parameter[12].Instance;

            cellCount = (int)variable["CellCount"].Value;
            energy    = (float)variable["Energy"].Value;
            denergy   = (float)variable["dEnergy"].Value;
            mp        = (float)MP_Param;
            actrho    = (float)ActRho_Param;
        }
Example #15
0
        protected override void CpuFunction(ComputeVariable variable)
        {
            Real[] input  = variable[0].Instance.Array.Data;
            Real[] output = variable[1].Instance.Array.Data;

            int len  = variable[0].Infomation.ArrayLength;
            int area = 10000;

            for (int i0 = 0; i0 < len; i0++)
            {
                int min, max;
                if (i0 - area > 0)
                {
                    min = i0 - area;
                }
                else
                {
                    min = 0;
                }
                if (i0 + area < len)
                {
                    max = i0 + area;
                }
                else
                {
                    max = len - 1;
                }
                output[i0] = 0;

                for (int i = min; i < max; i++)
                {
                    output[i0] += (input[i]);
                }
                output[i0] /= (max - min);
            }
        }
Example #16
0
 protected virtual void UpdateWithCondition(bool ForceUpdate, ComputeVariable variable)
 {
 }
 public abstract void Update(int count, ComputeVariable variable);
 protected abstract bool UpdateConditionCheck(ComputeVariable parameter);
Example #19
0
 protected abstract void ConvertVariable(ComputeVariable _variable);