https://kotlinlang.org logo
#mathematics
Title
# mathematics
f

Filipe Duarte

04/17/2021, 1:25 AM
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

altavir

04/17/2021, 5:43 AM
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

Filipe Duarte

04/17/2021, 1:39 PM
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

altavir

04/17/2021, 2:03 PM
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

Filipe Duarte

04/17/2021, 2:22 PM
But it’s possible to create methods to interact Nd4j and Kmath data with let’s say Torch ndarrays?
a

altavir

04/17/2021, 2:24 PM
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

Filipe Duarte

04/17/2021, 2:30 PM
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

altavir

04/22/2021, 3:23 PM
Do you mean in Jupyter or in the project? We will update plugins in a large release after kotlin 1.5
f

Filipe Duarte

04/22/2021, 3:25 PM
Intellij
a

altavir

04/22/2021, 3:27 PM
it should be space.kscience.kmath. package. please refer to examples in dev branch since you are using dev dependency.
f

Filipe Duarte

04/22/2021, 3:49 PM
Ah ok! I’m going to try it now. I followed the examples from the first link you posted in this thread
a

altavir

04/22/2021, 3:50 PM
We've changed things a lot because of move from jcenter and the documentation is still a sore point.
f

Filipe Duarte

04/22/2021, 10:40 PM
What are dependencies should I install in Gradle to use the example above?
a

altavir

04/23/2021, 7:01 AM
ND4J relies on some native dependenicies, so this part of build is relevant
7 Views