def fisher_vector_product(self, vector, kl_divergence_gradient, model):
assert not vector.requires_grad, "<STR_LIT>"<EOL>dot_product = vector @ kl_divergence_gradient<EOL>double_gradient = torch.autograd.grad(dot_product, model.policy_parameters(), retain_graph=True)<EOL>fvp = p2v(x.contiguous() for x in double_gradient)<EOL>return fvp + vector * self.cg_damping<EOL>
Calculate product Hessian @ vector