-
Notifications
You must be signed in to change notification settings - Fork 22
Add dtype and manipulation functions #1566
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fabf886
Add dtype functions
npolina4 c02823f
Add atleast 2d and 3d, vstack, repeat, and broadcast_arrays functions
npolina4 f6738ff
address comments
npolina4 1faf3cc
Merge branch 'master' into dtype_functions
npolina4 86e052c
Add more tests
npolina4 c442a9e
Skip test with random on Iris Xe
npolina4 fa06664
Removed broadcast_arrays tests from skip list
npolina4 de1788b
Merge branch 'master' into dtype_functions
npolina4 485fb60
Clean up dpnp_astype and dpnp_flatten functions
npolina4 201a8a3
Old implementation removed
npolina4 589f947
address comments
npolina4 cb1b909
Merge branch 'master' into dtype_functions
npolina4 5164a7b
fix pre-commit
npolina4 ab8e482
fix pre-commit
npolina4 9182767
fix pre-commit
npolina4 30a3434
fix pre-commit
npolina4 df4bbfa
Merge branch 'master' into dtype_functions
npolina4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -151,29 +151,16 @@ def asnumpy(input, order="C"): | |
|
||
def astype(x1, dtype, order="K", casting="unsafe", subok=True, copy=True): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neither numpy or cupy has |
||
"""Copy the array with data type casting.""" | ||
if isinstance(x1, dpnp_array): | ||
return x1.astype(dtype, order=order, casting=casting, copy=copy) | ||
|
||
if isinstance(x1, dpt.usm_ndarray): | ||
return dpt.astype(x1, dtype, order=order, casting=casting, copy=copy) | ||
|
||
x1_desc = get_dpnp_descriptor(x1, copy_when_nondefault_queue=False) | ||
if not x1_desc: | ||
pass | ||
elif order != "K": | ||
pass | ||
elif casting != "unsafe": | ||
pass | ||
elif not subok: | ||
pass | ||
elif not copy: | ||
pass | ||
elif x1_desc.dtype == numpy.complex128 or dtype == numpy.complex128: | ||
pass | ||
elif x1_desc.dtype == numpy.complex64 or dtype == numpy.complex64: | ||
if subok is not True: | ||
pass | ||
else: | ||
return dpnp_astype(x1_desc, dtype).get_pyobj() | ||
if isinstance(x1, dpnp_array): | ||
return x1.astype(dtype, order=order, casting=casting, copy=copy) | ||
|
||
if isinstance(x1, dpt.usm_ndarray): | ||
return dpt.astype( | ||
x1, dtype, order=order, casting=casting, copy=copy | ||
) | ||
|
||
return call_origin( | ||
numpy.ndarray.astype, | ||
|
Oops, something went wrong.
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.