mrkn / mxnet.rb

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

Redefine `.new` to Raise an Error #26

Closed toddsundsted closed 6 years ago

toddsundsted commented 6 years ago

Invoking MXNet::NDArray.new constructs an invalid instance. Specifically, ndarray_allocate() is called but a handle is never allocated, so future calls to mxnet_ndarray_get_handle() return NULL which breaks code that doesn't deal with this case (specifically in my case the Ruby executable crashes when I try to do anything with this instance).

There isn't any obvious use case for MXNet::NDArray.new and the Python API doesn't have an equivalent, so simply redefine it to raise an error.

mrkn commented 6 years ago

Thank you for reporting the issue and proposing changes for fixing it.

I resolved it by the different way.

toddsundsted commented 6 years ago

thanks!