code: def _transform_tensor_assign(op, block):
      shape = mb.shape(x=op.x, before_op=op)
      dim_prod = mb.reduce_prod(x=shape, before_op=op)
      ref_indices = mb.range_1d(
          end=dim_prod, start=0, step=1, before_op=op
      )
      ref_indices = mb.reshape(x=ref_indices, shape=shape, before_op=op)
      ref_sliced_indices = mb.slice_by_index(
          x=ref_indices,
          begin=op.begin,
          end=op.end,
          stride=op.stride,
          begin_mask=op.begin_mask,
          end_mask=op.end_mask,
          squeeze_mask=op.squeeze_mask,
          before_op=op,
      )
      flatten_indices = mb.reshape(
          x=ref_sliced_indices, shape=[-1], before_op=op
      )
      flatten_updates = mb.reshape(
          x=op.updates, shape=[-1], before_op=op
      )
      flatten_data = mb.reshape(x=op.x, shape=[-1], before_op=op)
      new_data = mb.scatter(
          data=flatten_data,
          indices=flatten_indices,
          updates=flatten_updates,
          mode="update",
          before_op=op,
      )
      new_data = mb.reshape(x=new_data, shape=shape, before_op=op)
  
      op.enclosing_block.replace_uses_of_var_after_op(
          anchor_op=op, old_var=op.outputs[0], new_var=new_data
      )
      # Remove all the ops at once
      block.remove_ops([op])
  
file_path: coremltools/coremltools/converters/mil/frontend/torch/ssa_passes/torch_tensor_assign_to_core.py
imports: from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 2 for calling a global function with example usage: _transform_tensor_assign(op, block) without return types