class_docstr: Tests for various tree utilities.
class_docstr_tok: ["Tests","for","various","tree","utilities","."]
code: def test_fast_map_structure_with_path(self):
      structure = {
          "a": {"b": np.array([0.0])},
          "c": (np.array([1.0]), np.array([2.0])),
          "d": [np.array(3.0), np.array(4.0)],
      }
  
      def map_fn(path: Sequence[str], x: np.ndarray, y: np.ndarray):
          return x + y + len(path)
  
      single_arg_map_fn = functools.partial(map_fn, y=np.array([0.0]))
  
      expected_mapped_structure = tree.map_structure_with_path(
          single_arg_map_fn, structure
      )
      mapped_structure = tree_utils.fast_map_structure_with_path(
          single_arg_map_fn, structure
      )
      self.assertEqual(mapped_structure, expected_mapped_structure)
  
      expected_double_mapped_structure = tree.map_structure_with_path(
          map_fn, structure, mapped_structure
      )
      double_mapped_structure = tree_utils.fast_map_structure_with_path(
          map_fn, structure, mapped_structure
      )
      self.assertEqual(
          double_mapped_structure, expected_double_mapped_structure
      )
  
file_path: acme/acme/utils/tree_utils_test.py
imports: import functools
  from typing import Sequence
  from acme.utils import tree_utils
  import numpy
  import tree
  from absl.testing import absltest
label_desc: Use image node_id 3 for calling the SequenceStackTest obj's underlying member method code with example usage: obj.test_fast_map_structure_with_path() and returns: unknown