code: def tile(cls, op):
      if op.inputs:
          if has_unknown_shape(*op.inputs):
              yield
      tensor = op.outputs[0]
  
      # op can be TensorDiag or TensorEye
      k = op.k
      nsplits = op._get_nsplits(op)
  
      fx = lambda x, y: x - y + k
      cum_size = [np.cumsum(s).tolist() for s in nsplits]
      out_chunks = []
      for out_idx in itertools.product(
          *[range(len(s)) for s in nsplits]
      ):
          i, j = out_idx
          ld_pos = cum_size[0][i] - 1, cum_size[1][j] - nsplits[1][j]
          ru_pos = cum_size[0][i] - nsplits[0][i], cum_size[1][j] - 1
  
          ld_fx = fx(*ld_pos)
          ru_fx = fx(*ru_pos)
  
          chunk_shape = (nsplits[0][i], nsplits[1][j])
          if (ld_fx > 0 and ru_fx > 0) or (ld_fx < 0 and ru_fx < 0):
              # does not cross, fill with zeros
              chunk_op = TensorZeros(
                  dtype=op.dtype,
                  gpu=op.gpu,
                  sparse=op.sparse,
                  shape=chunk_shape,
                  order=tensor.order.value,
              )
              chunk = chunk_op.new_chunk(
                  None, shape=chunk_shape, index=out_idx
              )
          else:
              lu_pos = ru_pos[0], ld_pos[1]
              chunk_k = fx(*lu_pos)
              chunk = op._get_chunk(op, chunk_k, chunk_shape, out_idx)
  
          out_chunks.append(chunk)
  
      new_op = op.copy()
      return new_op.new_tensors(
          op.inputs, tensor.shape, chunks=out_chunks, nsplits=nsplits
      )
  
imports: import itertools
  import numpy
  from ...None import opcodes
  from ...serialization.serializables import KeyField, Int32Field
  from ...utils import has_unknown_shape
  from ..core import TENSOR_TYPE
  from ...lib.sparse import diag
  from ...lib.sparse.core import issparse, get_array_module, get_sparse_module
  from ...lib import sparse
  from ..core import TensorOrder
  from ..array_utils import create_array
  from .core import TensorHasInput
  from .zeros import TensorZeros
  from .array import tensor
label_desc: Use image node_id 4 for calling the TensorDiagBase obj's underlying member method code with example usage: obj.tile(cls, op) and returns: new_op