コード例 #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
コード例 #3
0
 def optimize(self):
     """
     Do an optimization. 
     """
     jmodel = callJavaFunc(SparkContext.getOrCreate(), self.value.optimize)
     from nn.layer import Model
     return Model.of(jmodel)
コード例 #4
0
ファイル: optimizer.py プロジェクト: Kim-Seongjung/BigDL
 def optimize(self):
     """
     Do an optimization. 
     """
     jmodel = callJavaFunc(SparkContext.getOrCreate(), self.value.optimize)
     from nn.layer import Model
     return Model.of(jmodel)
コード例 #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)