code: def test_base_types():
      test_value = list([np.random.random((4, 2))])
      out_value = map_nested_structure(
          test_value,
          mapping=lambda x: torch.from_numpy(x),
          in_place=True,
      )
  
      def foo(elem):
          elem[0] = elem[0] * 2
  
      foo(test_value)
      assert test_value is out_value
      assert test_value[0] is out_value[0]
      assert isinstance(out_value[0], torch.Tensor)
      assert isinstance(test_value[0], torch.Tensor)
  
      # test in_place false
      test_value = list([np.random.random((4, 2))])
      out_value = map_nested_structure(
          test_value,
          mapping=lambda x: torch.from_numpy(x),
          in_place=False,
      )
  
      foo(test_value)
      assert test_value is not out_value
      assert test_value[0] is not out_value[0]
      assert isinstance(out_value[0], torch.Tensor)
      assert isinstance(test_value[0], np.ndarray)
  
file_path: maze/maze/test/perception/test_perception_utils.py
imports: import numpy
  import pytest
  import torch
  from gym import spaces
  from maze.perception.perception_utils import flatten_spaces, observation_spaces_to_in_shapes, map_nested_structure, convert_to_torch, convert_to_numpy, stack_and_flatten_spaces
label_desc: Use image node_id 6 for calling a global function with example usage: test_base_types() without return types