|
@@ -51,6 +51,7 @@ type RemoteControl struct {
|
|
|
weightsQueue chan *LayerMatrix
|
|
|
stateQueue chan int
|
|
|
mutex sync.Mutex
|
|
|
+ config *Configuration
|
|
|
}
|
|
|
|
|
|
func (rw *RemoteControl) Init(nn *neuralnetwork.NeuralNetwork) {
|
|
@@ -59,6 +60,10 @@ func (rw *RemoteControl) Init(nn *neuralnetwork.NeuralNetwork) {
|
|
|
rw.biasesQueue = make(chan *LayerMatrix, 5)
|
|
|
rw.weightsQueue = make(chan *LayerMatrix, 5)
|
|
|
rw.stateQueue = make(chan int, 2)
|
|
|
+ rw.config = &Configuration{}
|
|
|
+ for _, size := range rw.nn.Sizes {
|
|
|
+ rw.config.Sizes = append(rw.config.Sizes, int32(size))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func (rw *RemoteControl) UpdateActivations(l int, a *mat.Dense) {
|
|
@@ -110,12 +115,7 @@ func NewLayerMatrix(l int, dense *mat.Dense, contentType LayerMatrix_ContentType
|
|
|
}
|
|
|
|
|
|
func (rw *RemoteControl) GetConfiguration(context.Context, *None) (*Configuration, error) {
|
|
|
- config := &Configuration{}
|
|
|
-
|
|
|
- for _, size := range rw.nn.Sizes {
|
|
|
- config.Sizes = append(config.Sizes, int32(size))
|
|
|
- }
|
|
|
- return config, nil
|
|
|
+ return rw.config, nil
|
|
|
}
|
|
|
|
|
|
func (rw *RemoteControl) Activations(_ *None, srv RemoteControl_ActivationsServer) error {
|
|
@@ -127,6 +127,7 @@ func (rw *RemoteControl) Activations(_ *None, srv RemoteControl_ActivationsServe
|
|
|
default:
|
|
|
}
|
|
|
msg := <-rw.activationsQueue
|
|
|
+ fmt.Println("Send Activations")
|
|
|
srv.Send(msg)
|
|
|
}
|
|
|
}
|
|
@@ -140,6 +141,7 @@ func (rw *RemoteControl) Biases(_ *None, srv RemoteControl_BiasesServer) error {
|
|
|
default:
|
|
|
}
|
|
|
msg := <-rw.biasesQueue
|
|
|
+ fmt.Println("Send Biases")
|
|
|
srv.Send(msg)
|
|
|
}
|
|
|
}
|
|
@@ -153,6 +155,7 @@ func (rw *RemoteControl) Weights(_ *None, srv RemoteControl_WeightsServer) error
|
|
|
default:
|
|
|
}
|
|
|
msg := <-rw.weightsQueue
|
|
|
+ fmt.Println("Send Weights")
|
|
|
srv.Send(msg)
|
|
|
}
|
|
|
}
|