Esempio n. 1
0
    def backpropagate(self, ext, module, g_inp, g_out, backproped):
        Curvature.check_loss_hessian(
            self.derivatives.hessian_is_psd(), curv_type=ext.get_curv_type()
        )

        H_func = self.make_loss_hessian_func(ext)
        H_loss = H_func(module, g_inp, g_out)

        return H_loss
Esempio n. 2
0
    def backpropagate(self, ext, module, g_inp, g_out, backproped):
        Curvature.check_loss_hessian(
            self.derivatives.hessian_is_psd(),
            curv_type=ext.get_curv_type()
        )

        hessian_strategy = ext.get_loss_hessian_strategy()
        H_func = self.LOSS_HESSIAN_GETTERS[hessian_strategy]
        H_loss = H_func(module, g_inp, g_out)

        return H_loss
Esempio n. 3
0
    def backpropagate(self, ext, module, g_inp, g_out, backproped):
        Curvature.check_loss_hessian(self.derivatives.hessian_is_psd(),
                                     curv_type=ext.get_curv_type())

        CMP = self.derivatives.hessian_matrix_product(module, g_inp, g_out)
        return CMP