code: def test_flow_invertibility(
      bijection_func,
      batch_shape,
      event_shape,
  ):
      input_shape = batch_shape + event_shape
      bijection = bijection_func(event_shape=event_shape)
      bijection.initialize()
      inp = nd.random.randn(*input_shape)
      y_hat = bijection.f(bijection.f_inv(inp))
      x_hat = bijection.f_inv(bijection.f(inp))
      assert allclose(
          inp, y_hat, rtol=1.0e-4
      ), f"y and y_hat did not match: y = {inp}, y_hat = {y_hat}"
      assert allclose(
          inp, x_hat, rtol=1.0e-4
      ), f"x and x_hat did not match: x = {inp}, x_hat = {x_hat}"
  
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 2 for calling a global function with example usage: test_flow_invertibility(bijection_func, batch_shape, event_shape) without return types