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)
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
def optimize(self): """ Do an optimization. """ jmodel = callJavaFunc(SparkContext.getOrCreate(), self.value.optimize) from nn.layer import Model return Model.of(jmodel)
def optimize(self): """ Do an optimization. """ jmodel = callJavaFunc(get_spark_context(), self.value.optimize) from nn.layer import Model return Model.of(jmodel)