code: def _hessian_vector_product(flat_grads, params, vec):
      """Compute hessian vector product efficiently by backprop."""
      vec = vec.detach()
      grads = torch.autograd.grad(
          [torch.sum(flat_grads * vec)], params, retain_graph=True
      )
      assert all(
          grad is not None for grad in grads
      ), "The Hessian-vector product contains None."
      return _flatten_and_concat_variables(grads)
  
imports: import collections
  import random
  from logging import getLogger
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
  import pfrl
  from pfrl import agent
  from pfrl.agents.ppo import _compute_explained_variance, _make_dataset, _make_dataset_recurrent, _yield_minibatches, _yield_subset_of_sequences_with_fixed_number_of_items
  from pfrl.utils import clip_l2_grad_norm_
  from pfrl.utils.batch_states import batch_states
  from pfrl.utils.mode_of_distribution import mode_of_distribution
  from pfrl.utils.recurrent import concatenate_recurrent_states, flatten_sequences_time_first, get_recurrent_state_at, mask_recurrent_state_at, one_step_forward, pack_and_forward
label_desc: Use image node_id 5 for calling a global function with example usage: _hessian_vector_product(flat_grads, params, vec) and returns: _flatten_and_concat_variables