class_docstr: Tests the correctness of the Y = Restructure({nested}) transformation.
class_docstr_tok: ["Tests","the","correctness","of","the","Y","=","Restructure","(","{","nested","}",")","transformation","."]
code: def testStructureToStructure(self):
      bij = restructure.Restructure(
          input_structure={"foo": [0, 1], "bar": 2, "baz": (3, 4)},
          output_structure={"zip": [1, 2, 3], "zap": 0, "zop": 4},
      )
  
      x = {
          "foo": [0.0, [1.0]],
          "bar": [[2.0]],
          "baz": ([[[3.0]]], [[[[4.0]]]]),
      }
      x_ndims = {"foo": [0, 1], "bar": 2, "baz": (3, 4)}
  
      y = {
          "zip": [[1.0], [[2.0]], [[[3.0]]]],
          "zap": 0.0,
          "zop": [[[[4.0]]]],
      }
      y_ndims = {"zip": [1, 2, 3], "zap": 0, "zop": 4}
  
      # Invert assertion arguments to infer structure from bijector output.
      self.assertAllEqualNested(bij.forward(x), y, check_types=True)
      self.assertAllEqualNested(bij.inverse(y), x, check_types=True)
  
      self.assertAllEqualNested(
          0.0, self.evaluate(bij.forward_log_det_jacobian(x, x_ndims))
      )
      self.assertAllEqualNested(
          0.0, self.evaluate(bij.inverse_log_det_jacobian(y, y_ndims))
      )
  
file_path: probability/tensorflow_probability/python/bijectors/restructure_test.py
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import restructure
  from tensorflow_probability.python.distributions import joint_distribution_named
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 4 for calling the RestructureBijectorTest obj's underlying member method code with example usage: obj.testStructureToStructure() without return types