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

Type check for kwargs #22

Merged
merged 6 commits into from
Mar 10, 2024
Merged

Type check for kwargs #22

merged 6 commits into from
Mar 10, 2024

Conversation

MartinuzziFrancesco
Copy link
Member

Addresses #21

@MartinuzziFrancesco MartinuzziFrancesco linked an issue Mar 8, 2024 that may be closed by this pull request
Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.47%. Comparing base (63010b1) to head (ed1bddf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
- Coverage   96.52%   96.47%   -0.05%     
==========================================
  Files           4        4              
  Lines         144      142       -2     
==========================================
- Hits          139      137       -2     
  Misses          5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -38,6 +39,7 @@ end

function identity_init(rng::AbstractCuRNG, ::Type{T}, dims::Integer...;
gain::Number=1, shift::Integer=0) where {T <: Number}
gain = gain isa T ? gain : convert(T, gain)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to check for this. The compiler is smart enough to get rid of these

Copy link
Member Author

@MartinuzziFrancesco MartinuzziFrancesco Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also get rid of this then?

Copy link
Member Author

@MartinuzziFrancesco MartinuzziFrancesco Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the T(gain) specifically

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry scratch that, I misunderstood

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant gain isa T ? gain : convert(T, gain) can be written as T(gain) and the compiler should be smart to remove it if the types match.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see, should I take that approach with all of the checks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@avik-pal
Copy link
Member

There is some eyntax error, probably ; gain was written as ; T(gain) instead of ; gain=T(gain)

@MartinuzziFrancesco
Copy link
Member Author

true, I forgot to fix the orthogonal call

@avik-pal avik-pal merged commit b62af48 into main Mar 10, 2024
15 checks passed
@avik-pal avik-pal deleted the fm/tc branch March 10, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add type check and conversion for kwargs
2 participants