Skip to main content

Mojo function

pad_shape

pad_shape[input_type: DType, paddings_type: DType](input_buf: TileTensor[input_type, input_buf.LayoutType, input_buf.origin, address_space=input_buf.address_space, linear_idx_type=input_buf.linear_idx_type, element_size=input_buf.element_size], paddings_buf: TileTensor[paddings_type, paddings_buf.LayoutType, paddings_buf.origin, address_space=paddings_buf.address_space, linear_idx_type=paddings_buf.linear_idx_type, element_size=paddings_buf.element_size]) -> IndexList[TileTensor[input_type, input_buf.LayoutType, input_buf.origin, address_space=input_buf.address_space, linear_idx_type=input_buf.linear_idx_type, element_size=input_buf.element_size].rank]

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

Parameters:

  • ​input_type (DType): Type of the input tensor.
  • ​paddings_type (DType): Type of the padding tensor.

Args:

  • ​input_buf (TileTensor): The tensor to pad.
  • ​paddings_buf (TileTensor): The paddings tensor, of shape (input_rank, 2).

Returns:

IndexList: The output shape.

Was this page helpful?