Example #1
0
        public string ProcessMessage(Command msgObj, SyftController ctrl)
        {
            switch (msgObj.functionCall)
            {
            case "forward":
            {
                var input  = ctrl.getTensor(int.Parse(msgObj.tensorIndexParams[0]));
                var result = this.Forward(input);
                return(result.Id + "");
            }

            case "params":
            {
                string out_str = "";

                for (int i = 0; i < models.Count; i++)
                {
                    List <int> model_params = controller.getModel(models[i]).getParameters();
                    for (int j = 0; j < model_params.Count; j++)
                    {
                        out_str += model_params[j].ToString() + ",";
                    }
                }

                for (int i = 0; i < parameters.Count; i++)
                {
                    out_str += parameters[i].ToString() + ",";
                }
                return(out_str);
            }
            }

            return(ProcessMessageLocal(msgObj, ctrl));
        }
Example #2
0
        protected override string ProcessMessageLocal(Command msgObj, SyftController ctrl)
        {
            switch (msgObj.functionCall)
            {
            case "add":
            {
                // TODO: Handle adding layers better
                var input = (Layer)ctrl.getModel(int.Parse(msgObj.tensorIndexParams[0]));
                Debug.LogFormat("<color=magenta>Layer Added to Sequential:</color> {0}", input.Id);
                this.AddLayer(input);
                return(input.Id + "");
            }

            case "models":
            {
                string out_str = "";

                for (int i = 0; i < this.layers.Count; i++)
                {
                    out_str += this.layers[i].ToString() + ",";
                }
                return(out_str);
            }

            default:
            {
                return("Model.processMessage not Implemented:" + msgObj.functionCall);
            }
            }
        }
Example #3
0
 public override string ProcessMessageLocal(Command msgObj, SyftController ctrl)
 {
     switch (msgObj.functionCall)
     {
     case "add":
     {
         var input = ctrl.getModel(int.Parse(msgObj.tensorIndexParams[0]));
         Debug.LogFormat("<color=magenta>Model Added to Sequential:</color> {0}", input.Id);
         this.AddModel(input);
         return(input.Id + "");
     }
     }
     return("Model.processMessage not Implemented:" + msgObj.functionCall);
 }