code: def _adjust_chunk_sizes(cls, op, X, Y, out):
      max_x_chunk_size = max(X.nsplits[0])
      max_y_chunk_size = max(Y.nsplits[0])
      itemsize = out.dtype.itemsize
      max_chunk_bytes = max_x_chunk_size * max_y_chunk_size * itemsize
      chunk_store_limit = op.chunk_store_limit * 2  # scale 2 times
      if max_chunk_bytes > chunk_store_limit:
          adjust_succeeded = False
          # chunk is too huge, try to rechunk X and Y
          if X.shape[0] > Y.shape[0]:
              # y is smaller, rechunk y is more efficient
              expected_y_chunk_size = max(
                  int(chunk_store_limit / itemsize / max_x_chunk_size),
                  1,
              )
              if (
                  max_x_chunk_size * expected_y_chunk_size * itemsize
                  <= chunk_store_limit
              ):
                  adjust_succeeded = True
                  Y = yield from recursive_tile(
                      Y.rechunk({0: expected_y_chunk_size})
                  )
          else:
              # x is smaller, rechunk x is more efficient
              expected_x_chunk_size = max(
                  int(chunk_store_limit / itemsize / max_y_chunk_size),
                  1,
              )
              if (
                  max_y_chunk_size * expected_x_chunk_size * itemsize
                  <= chunk_store_limit
              ):
                  adjust_succeeded = True
                  X = yield from recursive_tile(
                      X.rechunk({0: expected_x_chunk_size})
                  )
  
          if not adjust_succeeded:
              expected_chunk_size = max(
                  int(np.sqrt(chunk_store_limit / itemsize)), 1
              )
              X = yield from recursive_tile(
                  X.rechunk({0: expected_chunk_size})
              )
              Y = yield from recursive_tile(
                  Y.rechunk({0: expected_chunk_size})
              )
  
      return X, Y
  
file_path: mars/mars/learn/metrics/pairwise/core.py
imports: import itertools
  import numpy
  from ....core import recursive_tile
  from ....serialization.serializables import Int64Field
  from ....tensor.operands import TensorOperand, TensorOperandMixin
  from ....tensor import tensor
  from ....utils import has_unknown_shape
  from ...utils import check_array
label_desc: Use image node_id 6 for calling the PairwiseDistances obj's underlying member method code with example usage: obj._adjust_chunk_sizes(cls, op, X, Y, out) and returns: X,  Y