code: def _shape_tensor(shape):
      """Convert to an int32 or int64 tensor, defaulting to int64 if empty."""
      if isinstance(shape, (tuple, list)) and not shape:
          dtype = dtypes.int64
      else:
          dtype = None
      return ops.convert_to_tensor(shape, dtype=dtype, name="shape")
  
imports: from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import sharded_variable
  from tensorflow.python.distribute import values_util
  from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import gen_stateful_random_ops
  from tensorflow.python.ops import gen_stateless_random_ops_v2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops_util
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import stateless_random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.trackable import autotrackable
  from tensorflow.python.util import nest
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 9 for calling a global function with example usage: _shape_tensor(shape) and returns: ops