Ejemplo n.º 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)
Ejemplo n.º 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