Skip to content

Support for type checking dataclass properties #342

Description

@sbodenstein

Suppose you have a dataclass:

@jaxtyped(typechecker=typechecker)
@dataclass
class MyDataclass:
    x: Float[Array, "n"]

  @property
  def plus1(self) -> Float[Array, "n"]:
     return self.x + 1.0

There is no way AFAIK how to enforce that "n" is derived from the class definition. Is there a way to enforce this? And is this a feature that would make sense? Note also symbolic shapes cannot be expressed with checking, eg. Float[Array, "n+1"] would fail as n is undefined in the function input.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions