Exemple #1
0
 public void create(ComputeSystem.DeviceType type)
 {
     csogmaneoPINVOKE.Resources_create__SWIG_2(swigCPtr, (int)type);
     if (csogmaneoPINVOKE.SWIGPendingException.Pending)
     {
         throw csogmaneoPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #2
0
 public void create(ComputeSystem.DeviceType type, int platformIndex, int deviceIndex)
 {
     csogmaneoPINVOKE.Resources_create__SWIG_0(swigCPtr, (int)type, platformIndex, deviceIndex);
     if (csogmaneoPINVOKE.SWIGPendingException.Pending)
     {
         throw csogmaneoPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #3
0
        public bool create(ComputeSystem.DeviceType type)
        {
            bool ret = csogmaneoPINVOKE.ComputeSystem_create__SWIG_3(swigCPtr, (int)type);

            if (csogmaneoPINVOKE.SWIGPendingException.Pending)
            {
                throw csogmaneoPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #4
0
        public bool create(ComputeSystem.DeviceType type, int platformIndex, int deviceIndex)
        {
            bool ret = csogmaneoPINVOKE.ComputeSystem_create__SWIG_1(swigCPtr, (int)type, platformIndex, deviceIndex);

            if (csogmaneoPINVOKE.SWIGPendingException.Pending)
            {
                throw csogmaneoPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #5
0
        static void Main(string[] args)
        {
            int numSimSteps = 500;

            ComputeSystem.DeviceType deviceType = ComputeSystem.DeviceType._gpu;

            Resources _res = new Resources();

            _res.create(deviceType);

            Architect arch = new Architect();

            arch.initialize(1234, _res);

            // Input size (width and height)
            int w = 4;
            int h = 4;

            ParameterModifier inputParams = arch.addInputLayer(new Vec2i(w, h));

            inputParams.setValue("in_p_alpha", 0.02f);
            inputParams.setValue("in_p_radius", 16);

            for (int i = 0; i < 2; i++)
            {
                ParameterModifier layerParams = arch.addHigherLayer(new Vec2i(36, 36), SparseFeaturesType._chunk);
                layerParams.setValue("sfc_chunkSize", new Vec2i(6, 6));
                layerParams.setValue("sfc_ff_radius", 12);
                layerParams.setValue("hl_poolSteps", 2);
                layerParams.setValue("sfc_weightAlpha", 0.02f);
                layerParams.setValue("sfc_biasAlpha", 0.001f);
                layerParams.setValue("p_alpha", 0.08f);
                layerParams.setValue("p_beta", 0.16f);
                layerParams.setValue("p_radius", 16);
            }

            Hierarchy hierarchy = arch.generateHierarchy();

            ValueField2D inputField = new ValueField2D(new Vec2i(w, h));

            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    inputField.setValue(new Vec2i(x, y), (y * w) + x);
                }
            }

            vectorvf inputVector = new vectorvf();

            inputVector.Add(inputField);

            System.Console.WriteLine("Stepping the hierarchy...");
            for (int i = 0; i < numSimSteps; i++)
            {
                hierarchy.simStep(inputVector, true);
            }

            vectorvf prediction = hierarchy.getPredictions();

            System.Console.Write("Input      :");
            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    System.Console.Write(" " + inputField.getValue(new Vec2i(x, y)).ToString("n2"));
                }
            }
            System.Console.WriteLine();

            System.Console.Write("Prediction :");
            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    System.Console.Write(" " + prediction[0].getValue(new Vec2i(x, y)).ToString("n2"));
                }
            }
            System.Console.WriteLine();
        }
Exemple #6
0
 public Resources(ComputeSystem.DeviceType type) : this(csogmaneoPINVOKE.new_Resources__SWIG_3((int)type), true)
 {
 }
Exemple #7
0
 public Resources(ComputeSystem.DeviceType type, int platformIndex) : this(csogmaneoPINVOKE.new_Resources__SWIG_2((int)type, platformIndex), true)
 {
 }