public class Transforms extends Object
Modifier and Type | Method and Description |
---|---|
static INDArray |
abs(INDArray ndArray)
Abs function
|
static INDArray |
abs(INDArray ndArray,
boolean dup)
Abs function
|
static INDArray |
acos(INDArray arr) |
static INDArray |
acos(INDArray in,
boolean copy) |
static INDArray |
allCosineDistances(@NonNull INDArray d1,
@NonNull INDArray d2,
int... dimensions) |
static INDArray |
allCosineSimilarities(@NonNull INDArray d1,
@NonNull INDArray d2,
int... dimensions) |
static INDArray |
allEuclideanDistances(@NonNull INDArray d1,
@NonNull INDArray d2,
int... dimensions) |
static INDArray |
allManhattanDistances(@NonNull INDArray d1,
@NonNull INDArray d2,
int... dimensions) |
static INDArray |
and(INDArray x,
INDArray y) |
static INDArray |
asin(INDArray arr) |
static INDArray |
asin(INDArray in,
boolean copy) |
static INDArray |
atan(INDArray arr) |
static INDArray |
atan(INDArray in,
boolean copy) |
static INDArray |
atan2(@NonNull INDArray x,
@NonNull INDArray y)
Atan2 operation, new INDArray instance will be returned
Note the order of x and y parameters is opposite to that of
Math.atan2(double, double) |
static INDArray |
atanh(INDArray in)
Sin function
|
static INDArray |
atanh(INDArray in,
boolean copy)
Sin function
|
protected static long[] |
broadcastResultShape(INDArray first,
INDArray second) |
static INDArray |
ceil(INDArray arr) |
static INDArray |
ceil(INDArray in,
boolean copy) |
static INDArray |
ceiling(INDArray ndArray)
Binary matrix of whether the number at a given index is greater than
|
static INDArray |
ceiling(INDArray ndArray,
boolean copyOnOps)
Ceiling function
|
static INDArray |
cos(INDArray in) |
static INDArray |
cos(INDArray in,
boolean copy) |
static INDArray |
cosh(INDArray in) |
static INDArray |
cosh(INDArray in,
boolean copy) |
static double |
cosineDistance(@NonNull INDArray d1,
@NonNull INDArray d2) |
static double |
cosineSim(@NonNull INDArray d1,
@NonNull INDArray d2)
Cosine similarity
|
static INDArray |
cross(INDArray x,
INDArray y) |
static INDArray |
dot(INDArray x,
INDArray y)
Dot product, new INDArray instance will be returned.
Note that the Nd4J design is different from Numpy. |
static INDArray |
elu(INDArray arr) |
static INDArray |
elu(INDArray in,
boolean copy) |
static INDArray |
eluDerivative(INDArray arr,
INDArray grad) |
static INDArray |
eluDerivative(INDArray in,
INDArray grad,
boolean copy) |
static INDArray |
eps(INDArray ndArray) |
static double |
euclideanDistance(@NonNull INDArray d1,
@NonNull INDArray d2) |
static INDArray |
exp(INDArray ndArray)
Run the exp operation
|
static INDArray |
exp(INDArray ndArray,
boolean dup)
Exp function
|
static INDArray |
expm1(INDArray ndArray,
boolean dup)
Elementwise exponential - 1 function
|
static INDArray |
floor(INDArray ndArray)
Binary matrix of whether the number at a given index is greater than
|
static INDArray |
floor(INDArray ndArray,
boolean dup)
Floor function
|
static INDArray |
greaterThanOrEqual(INDArray first,
INDArray ndArray)
1 if greater than or equal to 0 otherwise (at each element)
|
static INDArray |
greaterThanOrEqual(INDArray first,
INDArray ndArray,
boolean dup)
Eps function
|
static double |
hammingDistance(@NonNull INDArray d1,
@NonNull INDArray d2) |
static INDArray |
hardSigmoid(INDArray arr,
boolean dup) |
static INDArray |
hardTanh(INDArray ndArray) |
static INDArray |
hardTanh(INDArray ndArray,
boolean dup)
Hard tanh
|
static INDArray |
hardTanhDerivative(INDArray ndArray) |
static INDArray |
hardTanhDerivative(INDArray ndArray,
boolean dup)
Hard tanh
|
static INDArray |
identity(INDArray ndArray) |
static INDArray |
identity(INDArray ndArray,
boolean dup)
Identity function
|
static INDArray |
isMax(INDArray input) |
static INDArray |
isMax(INDArray input,
DataType dataType) |
static INDArray |
isMax(INDArray input,
INDArray output) |
static double |
jaccardDistance(@NonNull INDArray d1,
@NonNull INDArray d2) |
static INDArray |
leakyRelu(INDArray arr) |
static INDArray |
leakyRelu(INDArray in,
boolean copy) |
static INDArray |
leakyRelu(INDArray arr,
double cutoff) |
static INDArray |
leakyRelu(INDArray in,
double cutoff,
boolean copy) |
static INDArray |
leakyReluDerivative(INDArray arr,
double cutoff) |
static INDArray |
leakyReluDerivative(INDArray in,
double cutoff,
boolean copy) |
static INDArray |
lessThanOrEqual(INDArray first,
INDArray ndArray)
1 if less than or equal to 0 otherwise (at each element)
|
static INDArray |
lessThanOrEqual(INDArray first,
INDArray ndArray,
boolean dup)
Eps function
|
static INDArray |
log(INDArray ndArray) |
static INDArray |
log(INDArray ndArray,
boolean dup)
Log function
|
static INDArray |
log(INDArray ndArray,
double base)
Log on arbitrary base
|
static INDArray |
log(INDArray ndArray,
double base,
boolean duplicate)
Log on arbitrary base
|
static INDArray |
log1p(INDArray ndArray,
boolean dup)
Log of x + 1 function
|
static double |
manhattanDistance(@NonNull INDArray d1,
@NonNull INDArray d2) |
static INDArray |
max(INDArray ndArray,
double k)
Maximum function with a scalar
|
static INDArray |
max(INDArray ndArray,
double k,
boolean dup)
Maximum function with a scalar
|
static INDArray |
max(INDArray first,
INDArray second)
Element wise maximum function between 2 INDArrays
|
static INDArray |
max(INDArray first,
INDArray second,
boolean dup)
Element wise maximum function between 2 INDArrays
|
static INDArray |
min(INDArray ndArray,
double k)
Maximum function with a scalar
|
static INDArray |
min(INDArray ndArray,
double k,
boolean dup)
Minimum function with a scalar
|
static INDArray |
min(INDArray first,
INDArray second)
Element wise minimum function between 2 INDArrays
|
static INDArray |
min(INDArray first,
INDArray second,
boolean dup)
Element wise minimum function between 2 INDArrays
|
static INDArray |
mpow(INDArray in,
int n,
boolean dup)
Raises a square matrix to a power n, which can be positive, negative, or zero.
|
static INDArray |
neg(INDArray ndArray)
Returns the negative of an ndarray
|
static INDArray |
neg(INDArray ndArray,
boolean dup)
Negative
|
static INDArray |
normalizeZeroMeanAndUnitVariance(INDArray toNormalize)
Normalize data to zero mean and unit variance
substract by the mean and divide by the standard deviation
|
static INDArray |
not(INDArray x) |
static INDArray |
or(INDArray x,
INDArray y) |
static INDArray |
pow(INDArray ndArray,
INDArray power)
Element-wise power function - x^y, performed element-wise.
|
static INDArray |
pow(INDArray ndArray,
INDArray power,
boolean dup)
Element-wise power function - x^y, performed element-wise
|
static INDArray |
pow(INDArray ndArray,
Number power)
Pow function
|
static INDArray |
pow(INDArray ndArray,
Number power,
boolean dup)
Pow function
|
static INDArray |
relu(INDArray arr) |
static INDArray |
relu(INDArray in,
boolean copy) |
static INDArray |
relu6(INDArray arr) |
static INDArray |
relu6(INDArray in,
boolean copy) |
static INDArray |
reverse(INDArray x,
boolean dup) |
static INDArray |
round(INDArray ndArray)
Rounding function
|
static INDArray |
round(INDArray ndArray,
boolean dup)
Rounding function
|
static INDArray |
sigmoid(INDArray ndArray)
Sigmoid function
|
static INDArray |
sigmoid(INDArray ndArray,
boolean dup)
Sigmoid function
|
static INDArray |
sigmoidDerivative(INDArray ndArray)
Sigmoid function
|
static INDArray |
sigmoidDerivative(INDArray ndArray,
boolean dup)
Sigmoid function
|
static INDArray |
sign(INDArray toSign)
Signum function of this ndarray
|
static INDArray |
sign(INDArray toSign,
boolean dup)
Signum function of this ndarray
|
static INDArray |
sin(INDArray in)
Sin function
|
static INDArray |
sin(INDArray in,
boolean copy)
Sin function
|
static INDArray |
sinh(INDArray in)
Sinh function
|
static INDArray |
sinh(INDArray in,
boolean copy)
Sinh function
|
static INDArray |
softmax(INDArray arr) |
static INDArray |
softmax(INDArray in,
boolean copy) |
static INDArray |
softPlus(INDArray arr) |
static INDArray |
softPlus(INDArray in,
boolean copy) |
static INDArray |
softsign(INDArray arr) |
static INDArray |
softsign(INDArray in,
boolean copy) |
static INDArray |
softsignDerivative(INDArray arr) |
static INDArray |
softsignDerivative(INDArray in,
boolean copy) |
static INDArray |
sqrt(INDArray ndArray)
Sqrt function
|
static INDArray |
sqrt(INDArray ndArray,
boolean dup)
Sqrt function
|
static INDArray |
stabilize(INDArray ndArray,
double k) |
static INDArray |
stabilize(INDArray ndArray,
double k,
boolean dup)
Stabilize to be within a range of k
|
static INDArray |
step(INDArray arr) |
static INDArray |
step(INDArray in,
boolean copy) |
static INDArray |
tan(INDArray ndArray)
Element-wise tan function.
|
static INDArray |
tan(INDArray ndArray,
boolean dup)
Element-wise tan function.
|
static INDArray |
tanh(INDArray ndArray)
Tanh function
|
static INDArray |
tanh(INDArray ndArray,
boolean dup)
Tanh function
|
static INDArray |
timesOneMinus(INDArray in,
boolean copy)
out = in * (1-in)
|
static INDArray |
unitVec(INDArray toScale)
Scale by 1 / norm2 of the matrix
|
static INDArray |
xor(INDArray x,
INDArray y) |
public static double cosineSim(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2)
d1
- the first vectord2
- the second vectorpublic static double cosineDistance(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2)
public static double hammingDistance(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2)
public static double jaccardDistance(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2)
public static INDArray allCosineSimilarities(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2, int... dimensions)
public static INDArray allCosineDistances(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2, int... dimensions)
public static INDArray allEuclideanDistances(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2, int... dimensions)
public static INDArray allManhattanDistances(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2, int... dimensions)
public static INDArray dot(INDArray x, INDArray y)
x
- the first vectory
- the second vectorpublic static double manhattanDistance(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2)
d1
- d2
- public static INDArray atan2(@NonNull @NonNull INDArray x, @NonNull @NonNull INDArray y)
Math.atan2(double, double)
x
- the abscissa coordinatey
- the ordinate coordinatepublic static double euclideanDistance(@NonNull @NonNull INDArray d1, @NonNull @NonNull INDArray d2)
d1
- d2
- public static INDArray normalizeZeroMeanAndUnitVariance(INDArray toNormalize)
toNormalize
- the ndarray to normalizepublic static INDArray unitVec(INDArray toScale)
toScale
- the ndarray to scalepublic static INDArray neg(INDArray ndArray)
ndArray
- the ndarray to take the negative ofpublic static INDArray floor(INDArray ndArray)
ndArray
- public static INDArray ceiling(INDArray ndArray)
ndArray
- public static INDArray ceiling(INDArray ndArray, boolean copyOnOps)
ndArray
- copyOnOps
- public static INDArray sign(INDArray toSign)
toSign
- public static INDArray stabilize(INDArray ndArray, double k)
ndArray
- k
- public static INDArray sin(INDArray in, boolean copy)
in
- copy
- public static INDArray atanh(INDArray in, boolean copy)
in
- copy
- public static INDArray sinh(INDArray in, boolean copy)
in
- copy
- public static INDArray leakyReluDerivative(INDArray in, double cutoff, boolean copy)
public static INDArray timesOneMinus(INDArray in, boolean copy)
in
- Input arraycopy
- If true: copy. False: apply in-placepublic static INDArray exp(INDArray ndArray)
ndArray
- public static INDArray hardTanh(INDArray ndArray, boolean dup)
ndArray
- the inputdup
- whether to duplicate the ndarray and return it as the resultpublic static INDArray hardTanhDerivative(INDArray ndArray, boolean dup)
ndArray
- the inputdup
- whether to duplicate the ndarray and return it as the resultpublic static INDArray pow(INDArray ndArray, Number power)
ndArray
- the ndarray to raise hte power ofpower
- the power to raise bypublic static INDArray pow(INDArray ndArray, INDArray power)
ndArray
- the ndarray to raise to the power ofpower
- the power to raise bypublic static INDArray pow(INDArray ndArray, INDArray power, boolean dup)
ndArray
- the ndarray to raise to the power ofpower
- the power to raise bydup
- if true:public static INDArray round(INDArray ndArray)
ndArray
- public static INDArray sigmoid(INDArray ndArray)
ndArray
- public static INDArray sigmoid(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray sigmoidDerivative(INDArray ndArray)
ndArray
- public static INDArray sigmoidDerivative(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray tan(INDArray ndArray)
ndArray
- Input arraypublic static INDArray tan(INDArray ndArray, boolean dup)
ndArray
- Input arraypublic static INDArray log(INDArray ndArray, double base)
ndArray
- base
- public static INDArray log(INDArray ndArray, double base, boolean duplicate)
ndArray
- base
- public static INDArray greaterThanOrEqual(INDArray first, INDArray ndArray)
first
- ndArray
- public static INDArray lessThanOrEqual(INDArray first, INDArray ndArray)
first
- ndArray
- public static INDArray lessThanOrEqual(INDArray first, INDArray ndArray, boolean dup)
ndArray
- public static INDArray greaterThanOrEqual(INDArray first, INDArray ndArray, boolean dup)
ndArray
- public static INDArray floor(INDArray ndArray, boolean dup)
ndArray
- public static INDArray sign(INDArray toSign, boolean dup)
toSign
- public static INDArray max(INDArray ndArray, double k, boolean dup)
ndArray
- tbe ndarrayk
- dup
- public static INDArray max(INDArray ndArray, double k)
ndArray
- tbe ndarrayk
- public static INDArray max(INDArray first, INDArray second, boolean dup)
first
- second
- dup
- public static INDArray max(INDArray first, INDArray second)
first
- second
- public static INDArray min(INDArray ndArray, double k, boolean dup)
ndArray
- tbe ndarrayk
- dup
- public static INDArray min(INDArray ndArray, double k)
ndArray
- tbe ndarrayk
- public static INDArray min(INDArray first, INDArray second, boolean dup)
first
- second
- dup
- public static INDArray min(INDArray first, INDArray second)
first
- second
- public static INDArray stabilize(INDArray ndArray, double k, boolean dup)
ndArray
- tbe ndarrayk
- dup
- public static INDArray abs(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray exp(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray expm1(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray identity(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray pow(INDArray ndArray, Number power, boolean dup)
ndArray
- power
- dup
- public static INDArray round(INDArray ndArray, boolean dup)
ndArray
- the ndarraydup
- public static INDArray sqrt(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray tanh(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray log(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray log1p(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray neg(INDArray ndArray, boolean dup)
ndArray
- dup
- public static INDArray mpow(INDArray in, int n, boolean dup)
If n is zero, the identity matrix is returned.
If n is negative, the matrix is inverted and raised to the abs(n) power.
in
- A square matrix to raise to an integer power, which will be changed if dup is false.n
- The integer power to raise the matrix to.dup
- If dup is true, the original input is unchanged.Copyright © 2021. All rights reserved.