mrkn / mxnet.rb

MXNet binding for Ruby
MIT License
48 stars 10 forks source link

NDArray stype access #51

Open tjad opened 3 years ago

tjad commented 3 years ago

The code looks clean to me, changing no existing functionality. However, upon addition of this code, the functionality of NDArray breaks such that initialization of NDArray fills with random values when using .zeros, .ones, .array etc, it is also no longer possible to make assignments to the array correctly. It is as if the array handle is bad.

You will notice there are no code changes, only additions. The closest code change is addition of a local variable mStorageType.

To reproduce, checkout code and run in IRB

require 'mxnet'

a = MXNet::NDArray.ones(5)

[-1.80243e+08, 4.57118e-41, -1.80256e+08, 4.57118e-41, 0] <MXNet::NDArray 5 @cpu(0)>

Whichever initializer I use, the result is similar.

tjad commented 3 years ago

@mrkn This task is complete with tests.

mrkn commented 3 years ago

@tjad Sorry, I'm still busy to work for fiddle and ruby 3.0. Please wait for a moment.