code: def num_non_tensor_nodes(block):
      num_non_tensor = 0
      for node in block.nodes():
          kind = node.kind()
          # GetAttr don't provide useful signal here, since they are non-optimizable except with freezing
          # Constant is not executed, bailouts should be a separate tests, don't provide useful signal here
          if (
              kind == "prim::Constant"
              or "prim::Bailout" in kind
              or "GetAttr" in kind
          ):
              continue
          for b in node.blocks():
              num_non_tensor += num_non_tensor_nodes(b)
          tensor_out = False
          for out in node.outputs():
              if "Tensor" in str(out.type()):
                  tensor_out = True
                  break
          num_non_tensor += int(not tensor_out)
      return num_non_tensor
  
file_path: pytorch/test/jit/test_complexity.py
imports: import contextlib
  import os
  import sys
  import unittest
  import torch
  from torch.testing._internal.jit_utils import JitTestCase, enable_profiling_mode
  from torch.testing._internal.jit_metaprogramming_utils import try_get_nn_module_compiled_mod_and_inputs, get_nn_mod_test_name, get_all_nn_module_tests, nn_functional_tests, get_nn_functional_compiled_fn_and_inputs
  from torch.testing._internal.common_utils import run_tests, set_default_dtype, suppress_warnings, IS_FBCODE
label_desc: Use image node_id 2 for calling a global function with example usage: num_non_tensor_nodes(block) and returns: num_non_tensor