Open ljulliar opened 6 years ago
In other words int he MXNet Ruby interface are we happy with the class call or do we want to also systematically define the instance method call as well.
If I define NDArray#sqrt as
def sqrt(*args, **kwargs)
Ops.sqrt(self, *args, **kwargs)
end
We can chose to use either
z = MXNet::NDArray.sqrt(x)
or
z = x.sqrt
Shall we systematize such definition of instance methods ?
@ljulliar please follow the implementation of Python binding.
On MXNet::NDArray#sqrt, the corresponding python's implementation is:
def sqrt(self, *args, **kwargs)
return op.sqrt(self, *args, **kwargs)
So you can write in Ruby as:
def sqrt(*args, **kwargs)
Ops.sqrt(self, *args, **kwargs)
end
I was about to write the spec for NDArray#sqrt when I realized that as it is today I can only call:
z = MXNet::NDArray.sqrt(x)
which means NDArray.sqrt (class method)I guess for #sqrt to work I need to implement
in NDArray Ruby class, right ?