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

[PLAN] Support conversion between Numo::NArray and Cumo::NArray #87

Open
sonots opened this issue Jun 21, 2018 · 1 comment
Open

[PLAN] Support conversion between Numo::NArray and Cumo::NArray #87

sonots opened this issue Jun 21, 2018 · 1 comment

Comments

@sonots
Copy link
Owner

sonots commented Jun 21, 2018

POLICY: NO MONKEY PATCH to Numo.

Assume numo_a is an Numo::Int32, and cumo_a is Cumo::Int32.

(1)

Cumo::DFloat.cast(a_cumo) #=> Cumo::DFloat
Cumo::DFloat.cast(a_numo) #=> Cumo::DFloat (Note that casting dtype)
a_cumo.cast_to(Cumo::DFloat) #=> Cumo::DFloat
a_cumo.cast_to(Numo::DFloat) #=> Numo::DFloat (Note that casting dtype)

(2)

Cumo::NArray.from_numo(numo_a) #=> Cumo::Int32
Cumo::NArray.to_numo(cumo_a) #=> Numo::Int32
cumo_a.to_numo #=> Numo::Int32 # optional
cumo_a.store(numo_a) # optional

(2) is my design choice because (1) makes confuse us as Numo::DFloat.cast(a_cumo) may work (but, actually not). Also, (1) has to support converting dtypes, and we have to customize cast method which is already existing.

I will implement only from_numo and to_numo class methods first.


references: cupy http://docs-cupy.chainer.org/en/stable/tutorial/basic.html

cupy.asarray(a_cupy) #=> cupy.ndarray
cupy.asarray(a_numpy) #=> cupy.ndarray
cupy.asnumpy(a_cupy) #=> numpy.ndarray
@sonots
Copy link
Owner Author

sonots commented Jun 21, 2018

#83 must be resolved to do this. resolved

@sonots sonots changed the title Support conversion between Numo::NArray and Cumo::NArray [PLAN] Support conversion between Numo::NArray and Cumo::NArray Mar 23, 2019
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

No branches or pull requests

1 participant