Skip to main content

Mojo function

layer_norm_shape

layer_norm_shape[dtype: DType, single_thread_blocking_override: Bool](input: LayoutTensor[dtype, 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], gamma: LayoutTensor[dtype, Layout.row_major(1), origin], beta: LayoutTensor[dtype, Layout.row_major(1), origin], epsilon: Scalar[dtype]) -> IndexList[layout.rank()]

Compute the output shape of a layer_norm operation.

Parameters:

  • dtype (DType): Type of the input tensors.
  • single_thread_blocking_override (Bool): If True, then the operation is run synchronously using a single thread.

Args:

  • input (LayoutTensor): The input tensor.
  • gamma (LayoutTensor): The tensor for gamma coefficient.
  • beta (LayoutTensor): The tensor for beta coefficient.
  • epsilon (Scalar): The tensor for epsilon coefficient.

Returns:

IndexList: The output shape.

Was this page helpful?