padding.h#

Functions handling padding.

Functions

void nvte_multi_padding(
size_t num_tensors,
const NVTETensor *input_list,
NVTETensor *output_list,
const int *padded_num_rows_list,
cudaStream_t stream,
)#

Padding multiple tensors.

NOTE: Padding mode only support bottom.

For example, 3x3 matrix pad to 4x3 matrix.

source | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 |

destination | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | 0 | 0 | 0 |

Parameters:
  • num_tensors[in] Number of tensors.

  • input_list[in] List of 2D input tensors.

  • output_list[inout] List of padded tensors. Dimensions match tensors in input_list.

  • padded_num_rows_list[in] List of padded num rows corresponding to input tensors.

  • stream[in] CUDA stream used for the operation.

void nvte_multi_unpadding(
size_t num_tensors,
const NVTETensor *input_list,
NVTETensor *output_list,
const int *unpadded_num_rows_list,
cudaStream_t stream,
)#

Unpadding multiple tensors (reverse operation of padding).

NOTE: Unpadding mode only removes bottom rows.

For example, 4x3 matrix unpad to 3x3 matrix.

source | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | 0 | 0 | 0 |

destination | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 |

Parameters:
  • num_tensors[in] Number of tensors.

  • input_list[in] List of 2D padded input tensors.

  • output_list[inout] List of unpadded tensors. Dimensions match original unpadded tensors.

  • unpadded_num_rows_list[in] List of unpadded num rows corresponding to input tensors.

  • stream[in] CUDA stream used for the operation.