Download - Nd4 j slides.pptx
![Page 1: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/1.jpg)
ND4J
ND-ARRAYS FOR JAVA
SCIENTIFIC COMPUTING ON THE JVM
![Page 2: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/2.jpg)
Why another scientific library?
![Page 3: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/3.jpg)
Different libraries:
JVM:
● Jblas (not
maintained)
● Breeze (scala)
● Spire (scala)
● Core.matrix(clojure)
● Netlib blas
● N + 1 pure java
impls
Real scientific
environments (no
fragmentation!):
● octave/matlab
● numpy
● R
● Theano
![Page 4: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/4.jpg)
Blas and NDArrays
BLAS - Basic Linear Algebra Sub programs. Underlies EVERY fast
matrix lib out there.
NDArrays - matrices, tensors, math is done on axes (eg: rows/cols)
![Page 5: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/5.jpg)
Matlab/Octave
a = ones(5,5)
a =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
octave:2> sum(a,1)
ans =
5 5 5 5 5
![Page 6: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/6.jpg)
Numpy
>>> import numpy as np
>>> a = np.ones((5,5))
>>> np.sum(a,axis=1)
array([ 5., 5., 5., 5., 5.])
![Page 7: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/7.jpg)
Nd4j java/scala
import org.nd4j.api.linalg.DSL._
import org.nd4j.linalg.api.ndarray.INDArray
import org.nd4j.linalg.factory.Nd4j
val a = Nd4j.ones(5,5)
println Nd4j.sum(a,1)
[5.0, 5.0, 5.0, 5.0, 5.0]
![Page 8: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/8.jpg)
Blas Implementations
● Cublas (cuda)
● Openblas
● Intel MKL(cpu)
● Nvblas(cuda)
● Clblas(opencl)
● ATLAS(CPU)
● LAPACK(CPU)
![Page 9: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/9.jpg)
ND4J
A DISTRIBUTED FRAMEWORK
FOR MATRIX MANIPULATION
NATIVE
JBLAS
GPU
JCUDA ??
WITH SWAPPABLE BACKENDS…
![Page 10: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/10.jpg)
Core Concepts
● DataBuffer - A DataBuffer is a storage abstraction. A raw buffer
could be an nio buffer or a jcuda buffer. This allows for backend
optimal storage.
● FFTInstance - An instantiation of FFT. Every hardware maker has
their own impls.
● ConvolutionInstance - An instantiation of Convolution. Same as FFT
● Complex Numbers - (An abstraction over different libs)
● BlasWrapper - An interface to a blas backend (blas is a standard for
cripe sakes!)
● Op - Some sort of a mathematical operation (dot product, element
wise addition,negation,..)
● Garbage Collector (WIP) - Native resource handling where needed
![Page 11: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/11.jpg)
Other Features
● Loss Functions
● Adaptive learning rates
● Solvers (LBFGS,Conjugate gradient,Hessian Free,SGD)
● RNG: (DIfferent distributions based on apache math)
![Page 12: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/12.jpg)
ND4J
ND4J IS PORTABLE
& CROSS-PLATFORM
DESKTOP CLOUD MOBILE
![Page 13: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/13.jpg)
ND4J
ND4J SUPPORTS
JAVA
SCAL
A CLOJURE
![Page 14: Nd4 j slides.pptx](https://reader036.vdocument.in/reader036/viewer/2022082607/55a6863f1a28abd9088b4658/html5/thumbnails/14.jpg)
ND4J
FAMILIAR SEMANTICS
NUMPY
MATLA
B
SCIKIT-
LEARN