qml.templates.utils.check_shape

check_shape(inpt, target_shape, msg, bound=None)[source]

Check that the shape of inpt is equal to target_shape.

Parameters
  • inpt (list) – input to a qnode

  • target_shape (tuple[int]) – expected shape of inpt

  • msg (str) – error message to display if the shapes are different

  • bound (str) – If ‘max’ or ‘min’, the target shape is merely required to be a bound on the input shape

Returns

shape of inpt

Return type

tuple

Raises

ValueError