Skip to main content
Log in

Mojo function

pad_shape

pad_shape[input_rank: Int, input_type: DType, paddings_type: DType, single_thread_blocking_override: Bool](input_buf: NDBuffer[input_type, input_rank, origin], paddings_buf: NDBuffer[paddings_type, 1, origin]) -> Index[input_rank]

Compute the output shape of a pad operation, and assert the inputs are compatible.

Parameters:

  • input_rank (Int): Rank of the input tensor.
  • input_type (DType): Type of the input tensor.
  • paddings_type (DType): Type of the padding tensor.
  • single_thread_blocking_override (Bool): If True, then the operation is run synchronously using a single thread.

Args:

  • input_buf (NDBuffer[input_type, input_rank, origin]): The tensor to pad.
  • paddings_buf (NDBuffer[paddings_type, 1, origin]): The paddings tensor, of shape (input_rank, 2).

Returns:

The output shape.