Skip to main content

Mojo function

pad_shape

pad_shape[input_type: DType, paddings_type: DType, single_thread_blocking_override: Bool](input_buf: LayoutTensor[input_type, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment], paddings_buf: LayoutTensor[paddings_type, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment]) -> IndexList[layout.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.
  • single_thread_blocking_override (Bool): If True, then the operation is run synchronously using a single thread.

Args:

  • input_buf (LayoutTensor[input_type, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment]): The tensor to pad.
  • paddings_buf (LayoutTensor[paddings_type, layout, origin, address_space=address_space, element_layout=element_layout, layout_int_type=layout_int_type, linear_idx_type=linear_idx_type, masked=masked, alignment=alignment]): The paddings tensor, of shape (input_rank, 2).

Returns:

The output shape.

Was this page helpful?