code: def ConvertNumpyArrayToLiteral(value):
      """Converts a Numpy array or a nested tuple thereof to an XLA literal."""
      if isinstance(value, tuple):
          literal = xla_data_pb2.LiteralProto()
          literal.shape.CopyFrom(
              xla_shape.CreateShapeFromNumpy(value).message
          )
          for component in value:
              component_literal = literal.tuple_literals.add()
              component_literal.CopyFrom(
                  ConvertNumpyArrayToLiteral(component)
              )
          return literal
      else:
          return _ConvertNumpyArrayToLiteral(value)
  
imports: import numpy
  from local_xla.xla import xla_data_pb2
  from xla.python_api import types_
  from xla.python_api import xla_shape
label_desc: Use image node_id 3 for calling a global function with example usage: ConvertNumpyArrayToLiteral(value) and returns: literal, _ConvertNumpyArrayToLiteral