dislib.data.util#

dislib.data.util.compute_bottom_right_shape(a: Array)[source]#

Computes a shape of the bottom right block. :Parameters: a (ds-array) – The array to pad.

Returns:

  • size0 (int) – size of the first dimension

  • size1 (int) – size of the second dimension

dislib.data.util.decoder_helper(class_name, obj)[source]#
dislib.data.util.encoder_helper(obj)[source]#
dislib.data.util.pad(a: Array, pad_width, **kwargs)[source]#

Pad array blocks with the desired value.

Parameters:
  • a (array_like of rank N) – The array to pad.

  • pad_width (((top, bottom), (left, right))) – Number of values padded to the edges of each axis.

  • constant_value (scalar, optional) – The value to set in the padded rows and columns. Default is 0.

dislib.data.util.pad_last_blocks_with_zeros(a: Array)[source]#

Pad array blocks with zeros. :Parameters: a (ds-array) – The array to pad.

dislib.data.util.remove_last_columns(a: Array, n_columns)[source]#

Removes last columns from the right-most blocks of the ds-array.

Parameters:
  • a (ds-array) – The array to remove columns from.

  • n_columns (int) – The number of columns to remove.

Raises:

ValueError – if n_columns >= the width of the right-most blocks

dislib.data.util.remove_last_rows(a: Array, n_rows)[source]#

Removes last rows from the bottom blocks of the ds-array.

Parameters:
  • a (ds-array) – The array to remove rows from.

  • n_rows (int) – The number of rows to remove.

dislib.data.util.sync_obj(obj)[source]#

Recursively synchronizes the Future objects of a list or dictionary by using compss_wait_on(obj).