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 testDictToStructure(self):
      bij = restructure.Restructure(
          {"foo": ["b", "c"], "bar": "a", "baz": ("d", "e")}
      )
  
      x = {"a": [1, 2, 3], "b": [4, 5, 6], "c": 7.0, "d": 8.0, "e": 9.0}
      x_ndims = {"a": 1, "b": 1, "c": 0, "d": 0, "e": 0}
  
      y = {"foo": [[4, 5, 6], 7.0], "bar": [1, 2, 3], "baz": (8.0, 9.0)}
      y_ndims = {"foo": [1, 0], "bar": 1, "baz": (0, 0)}
  
      # 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 2 for calling the RestructureBijectorTest obj's underlying member method code with example usage: obj.testDictToStructure() without return types