code: def test_tree_all_any(self, pytree_impl):
      self.assertTrue(pytree_impl.tree_all(lambda x: x % 2, [1, 3]))
      self.assertFalse(pytree_impl.tree_all(lambda x: x % 2, [0, 1]))
      self.assertTrue(pytree_impl.tree_any(lambda x: x % 2, [0, 1]))
      self.assertFalse(pytree_impl.tree_any(lambda x: x % 2, [0, 2]))
      self.assertTrue(
          pytree_impl.tree_all_only(int, lambda x: x % 2, [1, 3, "a"])
      )
      self.assertFalse(
          pytree_impl.tree_all_only(int, lambda x: x % 2, [0, 1, "a"])
      )
      self.assertTrue(
          pytree_impl.tree_any_only(int, lambda x: x % 2, [0, 1, "a"])
      )
      self.assertFalse(
          pytree_impl.tree_any_only(int, lambda x: x % 2, [0, 2, "a"])
      )
  
imports: import inspect
  import re
  import unittest
  from collections import defaultdict, deque, namedtuple, OrderedDict, UserDict
  import torch
  import torch.utils._pytree
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, IS_FBCODE, parametrize, run_tests, subtest, TEST_WITH_TORCHDYNAMO, TestCase
label_desc: Use image node_id 17 for calling the TestGenericPytree obj's underlying member method code with example usage: obj.test_tree_all_any(pytree_impl) without return types