code: def delete(arr, obj, axis=None):
      """
      Return a new array with sub-arrays along an axis deleted. For a one
      dimensional array, this returns those entries not returned by
      `arr[obj]`.
  
      Parameters
      ----------
      arr : array_like
          Input array.
      obj : slice, int or array of ints
          Indicate indices of sub-arrays to remove along the specified axis.
      axis : int, optional
          The axis along which to delete the subarray defined by `obj`.
          If `axis` is None, `obj` is applied to the flattened array.
  
      Returns
      -------
      out : mars.tensor
          A copy of `arr` with the elements specified by `obj` removed. Note
          that `delete` does not occur in-place. If `axis` is None, `out` is
          a flattened array.
  
      Examples
      --------
      >>> import mars.tensor as mt
      >>> arr = mt.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])
      >>> arr.execute()
      array([[ 1,  2,  3,  4],
             [ 5,  6,  7,  8],
             [ 9, 10, 11, 12]])
      >>> mt.delete(arr, 1, 0).execute()
      array([[ 1,  2,  3,  4],
             [ 9, 10, 11, 12]])
      >>> mt.delete(arr, np.s_[::2], 1).execute()
      array([[ 2,  4],
             [ 6,  8],
             [10, 12]])
      >>> mt.delete(arr, [1,3,5], None).execute()
      array([ 1,  3,  5,  7,  8,  9, 10, 11, 12])
      """
      arr = astensor(arr)
      arr = astensor(arr)
      if getattr(obj, "ndim", 0) > 1:  # pragma: no cover
          raise ValueError(
              "index array argument obj to insert must be one dimensional or scalar"
          )
  
      if axis is None:
          # if axis is None, array will be flatten
          arr_size = arr.size
          idx_length = calc_object_length(obj, size=arr_size)
          shape = (arr_size - idx_length,)
      else:
          validate_axis(arr.ndim, axis)
          idx_length = calc_object_length(obj, size=arr.shape[axis])
          shape = tuple(
              s - idx_length if i == axis else s
              for i, s in enumerate(arr.shape)
          )
  
      op = TensorDelete(index_obj=obj, axis=axis, dtype=arr.dtype)
      return op(arr, obj, shape)
  
imports: from collections import defaultdict
  import numpy
  from ...None import opcodes
  from ...core import ENTITY_TYPE, recursive_tile
  from ...serialization.serializables import Int32Field, Int64Field, AnyField, KeyField
  from ...utils import has_unknown_shape
  from ..datasource import tensor
  from ..operands import TensorHasInput, TensorOperandMixin
  from ..utils import filter_inputs, validate_axis, slice_split, calc_object_length
label_desc: Use image node_id 1 for calling a global function with example usage: delete(arr, obj, axis) and returns: op