Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add type constraint for array creation primitives #205

Open
mehmetozsoy-synnada opened this issue Feb 19, 2025 · 0 comments
Open
Labels
good first issue Good for newcomers

Comments

@mehmetozsoy-synnada
Copy link
Collaborator

mehmetozsoy-synnada commented Feb 19, 2025

Feature Request

Describe the Feature

In Mithril, currently there are some primitives that creates array such as:

  • Arange
  • Eye
  • EyeComplement

these models take Dtype as an input, which is a Mithril specific enum type. Dtype, as its name suggests, determines type of output tensor. Therefore, it can also determine logical types of output connection at logical level.

Examples

Dtype.int32 -> Tensor[int]
Dtype.float32 -> Tensor[float]
Dtype.bool -> Tensor[bool]

Right now, Mithril does not support this feature. So as to support this feature, a specific implementation of Dtype constraint is needed.

Motivation

Implementing this feature will increase the type inference capability of Mithril. Which will benefit in multiple ways:

  • catching user errors early
  • helping the compiler

Proposed Solution

  • Write a dtype_constraint

  • Takes following inputs:

    • output: IOHyperEdge
    • Dtype: IOHyperEdge
  • will operate between value of Dtype and type of output. Therefore, it will be both type and value constraint.

  • Implement the logic and add this constraint to all array creation models.

  • Add tests to cover its logic and its integration.

Alternatives Considered

N/A

Additional Context

N/A

@mehmetozsoy-synnada mehmetozsoy-synnada added the good first issue Good for newcomers label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant