mrkn / mxnet.rb

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

Crash After Calling `MXNet::NDArray.new` #27

Closed toddsundsted closed 6 years ago

toddsundsted commented 6 years ago

Something as simple as the following causes a crash locally, for me:

$ ./bin/console
[1] pry(main)> MXNet::NDArray.new

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 (including inspecting the resulting instance).

There isn't any obvious use case for MXNet::NDArray.new and the Python API doesn't have an equivalent, so I simply redefined it to raise an error in the following PR: https://github.com/mrkn/mxnet.rb/pull/26