You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import numpy as np
X = np.ones((10,10))
Y = np.ones((10,10))
x, y = jl.MyModule.compute_something(X, Y, -1.0, 1.0, -1.0, 1.0)
where I call a Julia function defined in the MyModule module. I am getting the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Julia: MethodError: no method matching compute_something(::PythonCall.PyArray{Float64, 2, Float64, true, false}, ::PythonCall.PyArray{Float64, 2, Float64, true, false}, ::Float64, ::Float64, ::Float64, ::Float64)
Closest candidates are:
compute_something(!Matched::Matrix{T}, !Matched::Matrix{T}, ::T, ::T, ::T, ::T) where T<:Real at /opt/julia/compute_something:362
Does this mean that I need to define a new method for compute_something() with ::PythonCall.PyArray arguments? Can I avoid doing that? From the documentation it is not clear what to do in this situation.
The text was updated successfully, but these errors were encountered:
That's one way. Probably a better way is to change the signature of your function to
compute_something(::AbstractMatrix{T}, ::AbstractMatrix{T}, ::T, ::T, ::T, ::T) where {T<:Real}
so that it can take any matrix type. There are lots of matrix types in Julia (see subtypes(AbstractMatrix)) of which Matrix is only one, and your function probably doesn't care what kind of matrix it got.
Let's consider the code fragment
where I call a Julia function defined in the
MyModule
module. I am getting the errorDoes this mean that I need to define a new method for
compute_something()
with::PythonCall.PyArray
arguments? Can I avoid doing that? From the documentation it is not clear what to do in this situation.The text was updated successfully, but these errors were encountered: