Operator overload of Nd4j INDArray <#C01DZU7PW73|k...
# mathematics
f
Operator overload of Nd4j INDArray #kotlindl
I'm trying to use Deeplearning4j nd4j similar to
NumPy
with operator overloading
message has been deleted
so cool!
a
Operator overloading should not be abused. For nd4j bindings you can look here: https://www.github.com/mipt-npm/kmath/tree/dev/kmath-nd4j. But it is in early stage.
👍 1
f
I'm trying to understand kotlin concepts such as extension functions, operator overloading, multiple construction classes. Why do you use a block called field to use Nd4j objects with Kmath instead of doing the operator overloading directly?
a
Because we can't allow for operators on specific objects to interfere with the other ones. This is exactly the point, in ND4J environment, you operate with ND4J structures, in, say Torch (not yet present) environment, you operate with torch structures. They do not interfere.
f
But it’s possible to create methods to interact Nd4j and Kmath data with let’s say Torch ndarrays?
a
Yes, this is exactly, what @Ролан is doing now. Kmath (in it current incarnation) is designed to allow mixing different library representations in one program with minimal overhead,
🦜 1
f
Awesome!
I could not use the Kmath library. I follow the Gradle dependencies but when I am going to use the lib, there is no import
a
Do you mean in Jupyter or in the project? We will update plugins in a large release after kotlin 1.5
f
Intellij
a
it should be space.kscience.kmath. package. please refer to examples in dev branch since you are using dev dependency.
f
Ah ok! I’m going to try it now. I followed the examples from the first link you posted in this thread
a
We've changed things a lot because of move from jcenter and the documentation is still a sore point.
f
What are dependencies should I install in Gradle to use the example above?
a
ND4J relies on some native dependenicies, so this part of build is relevant