pyspark/bigdl/nn/layer.py
def backward(self, input, grad_output):
        """
        NB: It's for debug only, please use optimizer.optimize() in production.
        Performs a back-propagation step through the module, with respect to the given input. In
        general this method makes the assumption forward(input) has been called before, with the same
        input. This is necessary for optimization reasons. If you do not respect this rule, backward()
        will compute incorrect gradients.

        :param input: ndarray or list of ndarray or JTensor or list of JTensor.
        :param grad_output: ndarray or list of ndarray or JTensor or list of JTensor.
        :return: ndarray or list of ndarray
        """
        jinput, input_is_table = self.check_input(input)
        jgrad_output, grad_output_is_table = self.check_input(grad_output)
        output = callBigDlFunc(self.bigdl_type,
                               "modelBackward",
                               self.value,
                               jinput,
                               input_is_table,
                               jgrad_output,
                               grad_output_is_table)
        return self.convert_output(output)
def backward(self, input, grad_output):
        """
        NB: It's for debug only, please use optimizer.optimize() in production.
        Performs a back-propagation step through the module, with respect to the given input. In
        general this method makes the assumption forward(input) has been called before, with the same
        input. This is necessary for optimization reasons. If you do not respect this rule, backward()
        will compute incorrect gradients.

        :param input: ndarray or list of ndarray or JTensor or list of JTensor.
        :param grad_output: ndarray or list of ndarray or JTensor or list of JTensor.
        :return: ndarray or list of ndarray
        """
        jinput, input_is_table = self.check_input(input)
        jgrad_output, grad_output_is_table = self.check_input(grad_output)
        output = callBigDlFunc(self.bigdl_type,
                               "modelBackward",
                               self.value,
                               jinput,
                               input_is_table,
                               jgrad_output,
                               grad_output_is_table)
        return self.convert_output(output)
NB: It's for debug only, please use optimizer.optimize() in production.
        Performs a back-propagation step through the module, with respect to the given input. In
        general this method makes the assumption forward(input) has been called before, with the same
        input. This is necessary for optimization reasons. If you do not respect this rule, backward()
        will compute incorrect gradients.

        :param input: ndarray or list of ndarray or JTensor or list of JTensor.
        :param grad_output: ndarray or list of ndarray or JTensor or list of JTensor.
        :return: ndarray or list of ndarray