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

Update dtype argument for keras_core.Input #948

Closed
wants to merge 1 commit into from

Conversation

SuryanarayanaY
Copy link
Contributor

@SuryanarayanaY SuryanarayanaY commented Oct 11, 2023

At present,the API keras_core.input documentation states that the argument dtype to be passed as a string such as 'tf.float32' etc. However if we pass tf.dtypes.DType such as tf.float32,tf.float64 or a torch.dtype such as torch.float32,torch.float64 it will works as well as the internal code calls keras_core.backend.standardize_dtype which can convert tf.float32 or torch.float32 to string such as 'float32'.

IMO, its better to mention this is documentation that this API can also handle both tf.dtypes.DType and torch.dtype so that users are aware of this and they are free to choose any of the above ways to pass value to dtype.

Attached gist as reference for the above exercise.

At present,the API keras_core.input documentation states that the argument dtype to be passed as a string such as 'tf.float32' etc. However if we pass `tf.dtypes.DType` such as `tf.float32`,`tf.float64` or  a `torch.dtype` such as `torch.float32`,`torch.float64` it will works as well as the internal code calls keras_core.backend.standardize_dtype which can convert `tf.float32` or `torch.float32` to string such as 'float32'.

IMO, its better to mention this is documentation that this API can also handle both `tf.dtypes.DType` and `torch.dtype` so that users are aware of this and they are free to choose any of the above ways to pass value to dtype.
@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (3a464f9) 83.75% compared to head (567dbaa) 60.56%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #948       +/-   ##
===========================================
- Coverage   83.75%   60.56%   -23.19%     
===========================================
  Files         319      319               
  Lines       28879    28879               
  Branches     5529     5529               
===========================================
- Hits        24189    17492     -6697     
- Misses       3172    10044     +6872     
+ Partials     1518     1343      -175     
Flag Coverage Δ
keras_core 60.56% <ø> (-23.09%) ⬇️
keras_core-jax ?
keras_core-numpy 60.56% <ø> (ø)
keras_core-tensorflow ?
keras_core-torch ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
keras_core/layers/core/input_layer.py 90.90% <ø> (ø)

... and 176 files with indirect coverage changes

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

@SuryanarayanaY
Copy link
Contributor Author

APologies. PR created by mistake here as source code link points it to here.

Created a fresh PR in keras-team/keras with PR No. #18599 and hence closing here.

Thanks!

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.

1 participant