Skip to main content
Log in

Mojo function

rebind

rebind(v: Symbol, out_dims: List[Dim, 0], message: String) -> Symbol

Rebinds a symbolic tensor to a specified set of dimensions.

This does not mutate the symbolic tensor passed in, but instead adds a runtime assert that the input symbolic shape is equivalent to out_dims shape. For example, if the input tensor shape has dynamic/unknown sizes, this will assert a fixed sizes that may be required for a subsequent operation.

Args:

  • v (Symbol): The input symbolic tensor to rebind.
  • out_dims (List[Dim, 0]): The symbolic shape to assert for v, as a list of Dim values.
  • message (String): The message printed if the rebind fails at runtime.

Returns:

A symbolic tensor with the same elements and shape as the given tensor, but with the symbolic shape asserted to out_dims.

Was this page helpful?