def initialize_with_value(
      self, value: T, check_structure: bool = True, strict_dtype: bool = True
  ) -> Parameter[T]:
    """Directly initializes the parameter with particular value.

    This can be used to bypass the initializer function and set the value
    directly, which can be useful for loading from checkpoints (for instance).

    Args:
      value: Value to set.
      check_structure: Whether to check that the value matches the expected
        structure.
      strict_dtype: Whether to check that the value matches the expected dtype.
        Ignored unless ``check_structure`` is True.

    Returns:
      An initialized parameter with the given value.
    """
    if check_structure:
      if strict_dtype:
        pattern = self.value_structure
      else:
        pattern = (
            selectors.select(self.value_structure)
            .at_instances_of(shapecheck.ArraySpec)
            .apply(lambda s: dataclasses.replace(s, dtype=np.generic))
        )
      shapecheck.check_structure(value=value, pattern=pattern)
    return Parameter(value, self.name)
Directly initializes the parameter with particular value.

    This can be used to bypass the initializer function and set the value
    directly, which can be useful for loading from checkpoints (for instance).

    Args:
      value: Value to set.
      check_structure: Whether to check that the value matches the expected
        structure.
      strict_dtype: Whether to check that the value matches the expected dtype.
        Ignored unless ``check_structure`` is True.

    Returns:
      An initialized parameter with the given value.
    
penzai/deprecated/v1/nn/parameters.py