Example #1
0
 def backward(self, input, target):
     """
     NB: It's for debug only, please use optimizer.optimize() in production.
     Performs a back-propagation step through the criterion, with respect to the given input.
     :param input: ndarray or list of ndarray
     :param target: ndarray or list of ndarray
     :return: ndarray
     """
     output = callBigDlFunc(self.bigdl_type, "criterionBackward",
                            self.value, Model.check_input(input),
                            Model.check_input(target))
     return Model.convert_output(output)
Example #2
0
 def forward(self, input, target):
     """
     NB: It's for debug only, please use optimizer.optimize() in production.
     Takes an input object, and computes the corresponding loss of the criterion,
     compared with `target`
     :param input: ndarray or list of ndarray
     :param target: ndarray or list of ndarray
     :return: value of loss
     """
     output = callBigDlFunc(self.bigdl_type, "criterionForward", self.value,
                            Model.check_input(input),
                            Model.check_input(target))
     return output
Example #3
0
 def optimize(self):
     """
     Do an optimization. 
     """
     jmodel = callJavaFunc(SparkContext.getOrCreate(), self.value.optimize)
     from nn.layer import Model
     return Model.of(jmodel)
Example #4
0
 def optimize(self):
     """
     Do an optimization. 
     """
     jmodel = callJavaFunc(SparkContext.getOrCreate(), self.value.optimize)
     from nn.layer import Model
     return Model.of(jmodel)
Example #5
0
 def optimize(self):
     """
     Do an optimization. 
     """
     jmodel = callJavaFunc(get_spark_context(), self.value.optimize)
     from nn.layer import Model
     return Model.of(jmodel)