Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 27
Leverage dpctl.tensor.iinfo() and dpctl.tensor.finfo() implementation.#1582
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
186fef9
Leverage dpctl.tensor.iinfo() and dpctl.tensor.finfo() implementation.
npolina4 e320e2d
Address comment for dpnp.iinfo and dpnp.finfo functions
npolina4 279e72c
Update dpnp_iface_types.py
npolina4 03bcf83
Merge branch 'master' into iinfo_finfo
npolina4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -34,8 +34,11 @@ | ||
| This module provides public type interface file for the library | ||
| """ | ||
| import dpctl.tensor as dpt | ||
| import numpy | ||
| from dpnp.dpnp_array import dpnp_array | ||
| __all__ = [ | ||
| "bool", | ||
| "bool_", | ||
| @@ -50,12 +53,14 @@ | ||
| "dtype", | ||
| "e", | ||
| "euler_gamma", | ||
| "finfo", | ||
| "float", | ||
| "float_", | ||
| "float16", | ||
| "float32", | ||
| "float64", | ||
| "floating", | ||
| "iinfo", | ||
| "inexact", | ||
| "Inf", | ||
| "inf", | ||
| @@ -140,6 +145,85 @@ | ||
| PZERO = numpy.PZERO | ||
| def finfo(dtype): | ||
| """ | ||
| Returns machine limits for floating-point data types. | ||
| For full documentation refer to :obj:`numpy.finfo`. | ||
| Parameters | ||
| ---------- | ||
| dtype : dtype, dpnp_array | ||
| Floating-point dtype or an array with floating point data type. | ||
| If complex, the information is about its component data type. | ||
| Returns | ||
| ------- | ||
| out : finfo_object | ||
| An object have the following attributes | ||
| * bits: int | ||
| number of bits occupied by dtype. | ||
| * dtype: dtype | ||
| real-valued floating-point data type. | ||
| * eps: float | ||
| difference between 1.0 and the next smallest representable | ||
| real-valued floating-point number larger than 1.0 according | ||
| to the IEEE-754 standard. | ||
| * epsneg: float | ||
| difference between 1.0 and the next smallest representable real-valued | ||
| floating-point number smaller than 1.0 according to the IEEE-754 | ||
| standard. | ||
| * max: float | ||
| largest representable real-valued number. | ||
| * min: float | ||
| smallest representable real-valued number. | ||
| * precision: float | ||
| the approximate number of decimal digits to which this kind of | ||
| floating point type is precise. | ||
| * resolution: float | ||
| the approximate decimal resolution of this type. | ||
| * tiny: float | ||
| an alias for `smallest_normal` | ||
| * smallest_normal: float | ||
| smallest positive real-valued floating-point number with | ||
| full precision. | ||
| """ | ||
| if isinstance(dtype, dpnp_array): | ||
| dtype = dtype.dtype | ||
npolina4 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| return dpt.finfo(dtype) | ||
| def iinfo(dtype): | ||
| """ | ||
| Returns machine limits for integer data types. | ||
| For full documentation refer to :obj:`numpy.iinfo`. | ||
| Parameters | ||
| ---------- | ||
| dtype : dtype, dpnp_array | ||
| Integer dtype or an array with integer dtype. | ||
| Returns | ||
| ------- | ||
| out : iinfo_object | ||
| An object with the following attributes | ||
| * bits: int | ||
| number of bits occupied by the data type | ||
| * dtype: dtype | ||
| integer data type. | ||
| * max: int | ||
| largest representable number. | ||
| * min: int | ||
| smallest representable number. | ||
| """ | ||
| if isinstance(dtype, dpnp_array): | ||
| dtype = dtype.dtype | ||
| return dpt.iinfo(dtype) | ||
| def isscalar(obj): | ||
| """ | ||
| Returns True if the type of `obj` is a scalar type. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.