code: def test_jacobian(bijection_func, batch_shape, event_shape):
      def jacobian(bijection, y):
          y.attach_grad()
          with autograd.record():
              x = bijection.f_inv(y)
          return jacobian_autograd(y, x)
  
      input_shape = batch_shape + event_shape
      bijection = bijection_func(event_shape=event_shape)
      bijection.initialize()
      inp = nd.random.randn(*input_shape)
  
      correct_ladj = -log_abs_det(jacobian(bijection, inp))
  
      # restart outputs, and accumulate intermediate
      # output by calling f_inv, for ladj calculation
      x = bijection.f_inv(inp)
      output_ladj = bijection.log_abs_det_jac(x, inp)
      assert allclose(
          output_ladj, correct_ladj, atol=1.0e-4, rtol=1.0e-4
      )
  
file_path: gluonts/test/mx/distribution/test_flows.py
imports: from functools import partial
  import numpy
  import pytest
  import mxnet.ndarray
  from mxnet import autograd
  from gluonts.mx.distribution.iresnet import iresnet, log_abs_det
label_desc: Use image node_id 5 for calling a global function with example usage: test_jacobian(bijection_func, batch_shape, event_shape) and returns: jacobian_autograd