コード例 #1
0
ファイル: criterion.py プロジェクト: YanMeng991/BigDL-1
 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)
コード例 #2
0
ファイル: criterion.py プロジェクト: YanMeng991/BigDL-1
 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