code: def type_inference(self):
      num_indices = self.indices.shape[0]
      num_values = self.value.shape[0]
      if num_values != num_indices:
          raise ValueError(
              "Cannot scatter {} values to {} indices".format(
                  num_values, num_indices
              )
          )
      list_elem_type = self.ls.elem_type
      value_type = self.value.sym_type
      dynamic_length = self.ls.dynamic_length
      init_length = self.ls.init_length
  
      elem_type = types.tensor(
          value_type.get_primitive(), value_type.get_shape()[1:]
      )
      if list_elem_type == types.unknown:
          # fill in the elem type using value's type info.
          return types.list(
              elem_type,
              dynamic_length=dynamic_length,
              init_length=init_length,
          )
      if not types.is_subtype(elem_type, list_elem_type):
          msg = (
              "Elem type mismatch: ls elem type {} vs "
              + "value type {}"
          )
          raise ValueError(msg.format(list_elem_type, elem_type))
      return self.ls.sym_type
  
imports: import six
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.types.type_mapping import numpy_val_to_builtin_val, is_subtype
  import copy
  from coremltools.converters.mil.mil import Block, SYMBOL, NONE
  from coremltools.converters.mil.mil.var import Var
  from coremltools.converters.mil.mil import get_new_symbol
  from ._op_reqs import *
  import logging
label_desc: Use image node_id 2 for calling the list_scatter obj's underlying member method code with example usage: obj.type_inference() and returns: self, types