def __init_subclass__(cls, **kwargs):
    """Checks that new subclasses of Layer have wrapped ``__call__`` if needed."""  # pylint: disable=line-too-long
    super().__init_subclass__(**kwargs)
    if cls.__call__ is not Layer.__call__ and (
        cls.input_structure is not Layer.input_structure
        or cls.output_structure is not Layer.output_structure
    ):
      if not hasattr(cls.__call__, "__penzai_checked_layer_call__"):
        raise TypeError(
            "Subclasses of Layer that override `input_structure` or"
            " `output_structure` should decorate `__call__` with"
            " `checked_layer_call` to ensure that these structures are checked."
            " (If you are checking the inputs and output structures manually,"
            " or want to opt-out for some other reason, you can alternatively"
            " decorate with"
            " `penzai.deprecated.v1.core.layer.unchecked_layer_call`.)"
        )
Checks that new subclasses of Layer have wrapped ``__call__`` if needed.
penzai/deprecated/v1/core/layer.py