IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

pad_constant

def pad_constant[dtype: DType, paddings_type: DType, constant_type: DType](output: TileTensor[dtype, linear_idx_type=output.linear_idx_type, element_size=output.element_size], input: TileTensor[dtype, linear_idx_type=input.linear_idx_type, element_size=input.element_size], paddings: UnsafePointer[Scalar[paddings_type]], constant: Scalar[constant_type])

Fill output with values from input, and edges padded with constant based on paddings.

Example: var input_shape = (X, Y, Z) var paddings = [x0, x1, y0, y1, z0, z1]

out[x, y, z] = input[x - x0, y - y0, z - z0] if x ∈ [x0, x0 + X] && y ∈ [y0, y0 + Y] && z ∈ [z0, z0 + Z] else constant

Args: