Package org.nd4j.autodiff.samediff.ops
Class SDRNN
- java.lang.Object
-
- org.nd4j.autodiff.samediff.ops.SDOps
-
- org.nd4j.autodiff.samediff.ops.SDRNN
-
public class SDRNN extends SDOps
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SDVariable
gru(String name, SDVariable x, SDVariable hLast, SDVariable Wx, SDVariable Wh, SDVariable biases)
The GRU operation.SDVariable
gru(SDVariable x, SDVariable hLast, SDVariable Wx, SDVariable Wh, SDVariable biases)
The GRU operation.SDVariable[]
gruCell(String[] names, SDVariable x, SDVariable hLast, GRUWeights GRUWeights)
The GRU cell.SDVariable[]
gruCell(SDVariable x, SDVariable hLast, GRUWeights GRUWeights)
The GRU cell.SDVariable
lstmblock(String name, SDVariable maxTSLength, SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM blockSDVariable
lstmblock(String name, SDVariable x, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM blockSDVariable
lstmblock(SDVariable maxTSLength, SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM blockSDVariable
lstmblock(SDVariable x, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM blockSDVariable[]
lstmCell(String[] names, SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM cell.SDVariable[]
lstmCell(SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM cell.SDVariable[]
lstmLayer(String[] names, SDVariable x, SDVariable cLast, SDVariable yLast, SDVariable maxTSLength, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN accelerationSDVariable[]
lstmLayer(String[] names, SDVariable x, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN accelerationSDVariable[]
lstmLayer(SDVariable x, SDVariable cLast, SDVariable yLast, SDVariable maxTSLength, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN accelerationSDVariable[]
lstmLayer(SDVariable x, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN accelerationSDVariable
sru(String name, SDVariable x, SDVariable initialC, SDVariable mask, SRUWeights SRUWeights)
The SRU layer.SDVariable
sru(String name, SDVariable x, SDVariable initialC, SRUWeights SRUWeights)
The SRU layer.SDVariable
sru(SDVariable x, SDVariable initialC, SDVariable mask, SRUWeights SRUWeights)
The SRU layer.SDVariable
sru(SDVariable x, SDVariable initialC, SRUWeights SRUWeights)
The SRU layer.SDVariable
sruCell(String name, SDVariable x, SDVariable cLast, SRUWeights SRUWeights)
The SRU layer.SDVariable
sruCell(SDVariable x, SDVariable cLast, SRUWeights SRUWeights)
The SRU layer.
-
-
-
Constructor Detail
-
SDRNN
public SDRNN(SameDiff sameDiff)
-
-
Method Detail
-
gru
public SDVariable gru(SDVariable x, SDVariable hLast, SDVariable Wx, SDVariable Wh, SDVariable biases)
The GRU operation. Gated Recurrent Unit - Cho et al. 2014.- Parameters:
x
- input [time, bS, nIn] (NUMERIC type)hLast
- initial cell output (at time step = 0) [bS, nOut] (NUMERIC type)Wx
- input-to-hidden weights, [nIn, 3*nOut] (NUMERIC type)Wh
- hidden-to-hidden weights, [nOut, 3*nOut] (NUMERIC type)biases
- biases, [3*nOut] (NUMERIC type)- Returns:
- h cell outputs [time, bS, nOut], that is per each time step (NUMERIC type)
-
gru
public SDVariable gru(String name, SDVariable x, SDVariable hLast, SDVariable Wx, SDVariable Wh, SDVariable biases)
The GRU operation. Gated Recurrent Unit - Cho et al. 2014.- Parameters:
name
- name May be null. Name for the output variablex
- input [time, bS, nIn] (NUMERIC type)hLast
- initial cell output (at time step = 0) [bS, nOut] (NUMERIC type)Wx
- input-to-hidden weights, [nIn, 3*nOut] (NUMERIC type)Wh
- hidden-to-hidden weights, [nOut, 3*nOut] (NUMERIC type)biases
- biases, [3*nOut] (NUMERIC type)- Returns:
- h cell outputs [time, bS, nOut], that is per each time step (NUMERIC type)
-
gruCell
public SDVariable[] gruCell(SDVariable x, SDVariable hLast, GRUWeights GRUWeights)
The GRU cell. Does a single time step operation- Parameters:
x
- Input, with shape [batchSize, inSize] (NUMERIC type)hLast
- Output of the previous cell/time step, with shape [batchSize, numUnits] (NUMERIC type)GRUWeights
- Configuration Object
-
gruCell
public SDVariable[] gruCell(String[] names, SDVariable x, SDVariable hLast, GRUWeights GRUWeights)
The GRU cell. Does a single time step operation- Parameters:
names
- names May be null. Arrays of names for the output variables.x
- Input, with shape [batchSize, inSize] (NUMERIC type)hLast
- Output of the previous cell/time step, with shape [batchSize, numUnits] (NUMERIC type)GRUWeights
- Configuration Object
-
lstmCell
public SDVariable[] lstmCell(SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM cell. Does a single time step operation.- Parameters:
x
- Input, with shape [batchSize, inSize] (NUMERIC type)cLast
- Previous cell state, with shape [batchSize, numUnits] (NUMERIC type)yLast
- revious cell output, with shape [batchSize, numUnits] (NUMERIC type)LSTMWeights
- Configuration ObjectLSTMConfiguration
- Configuration Object
-
lstmCell
public SDVariable[] lstmCell(String[] names, SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM cell. Does a single time step operation.- Parameters:
names
- names May be null. Arrays of names for the output variables.x
- Input, with shape [batchSize, inSize] (NUMERIC type)cLast
- Previous cell state, with shape [batchSize, numUnits] (NUMERIC type)yLast
- revious cell output, with shape [batchSize, numUnits] (NUMERIC type)LSTMWeights
- Configuration ObjectLSTMConfiguration
- Configuration Object
-
lstmLayer
public SDVariable[] lstmLayer(SDVariable x, SDVariable cLast, SDVariable yLast, SDVariable maxTSLength, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN acceleration- Parameters:
x
- Input, with shape dependent on the data format (in config). (NUMERIC type)cLast
- Previous/initial cell state, with shape [batchSize, numUnits] (NUMERIC type)yLast
- Previous/initial cell output, with shape [batchSize, numUnits] (NUMERIC type)maxTSLength
- maxTSLength with shape [batchSize] (NUMERIC type)LSTMLayerWeights
- Configuration ObjectLSTMLayerConfig
- Configuration Object
-
lstmLayer
public SDVariable[] lstmLayer(String[] names, SDVariable x, SDVariable cLast, SDVariable yLast, SDVariable maxTSLength, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN acceleration- Parameters:
names
- names May be null. Arrays of names for the output variables.x
- Input, with shape dependent on the data format (in config). (NUMERIC type)cLast
- Previous/initial cell state, with shape [batchSize, numUnits] (NUMERIC type)yLast
- Previous/initial cell output, with shape [batchSize, numUnits] (NUMERIC type)maxTSLength
- maxTSLength with shape [batchSize] (NUMERIC type)LSTMLayerWeights
- Configuration ObjectLSTMLayerConfig
- Configuration Object
-
lstmLayer
public SDVariable[] lstmLayer(SDVariable x, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN acceleration- Parameters:
x
- Input, with shape dependent on the data format (in config). (NUMERIC type)LSTMLayerWeights
- Configuration ObjectLSTMLayerConfig
- Configuration Object
-
lstmLayer
public SDVariable[] lstmLayer(String[] names, SDVariable x, LSTMLayerWeights LSTMLayerWeights, LSTMLayerConfig LSTMLayerConfig)
Long Short-Term Memory layer - Hochreiter 1997.
SUPPORTS following data formats:
for unidirectional:
TNS: shapes [timeLength, numExamples, inOutSize]
NST: shapes [numExamples, inOutSize, timeLength]
NTS: shapes [numExamples, timeLength, inOutSize]
for bidirectional:
T2NS: shapes [timeLength, 2, numExamples, inOutSize] (for ONNX)
SUPPORTS following direction modes:
FWD: forward
BWD: backward
BIDIR_SUM: bidirectional sum
BIDIR_CONCAT: bidirectional concat
BIDIR_EXTRA_DIM: bidirectional extra output dim (in conjunction with format dataFormat - T2NS)
You may use different gate configurations:
specify gate/cell/out aplha/beta and numbers of activations for gate/cell/out described in activations enum
("RELU","SIGMOID","AFFINE","LEAKY_RELU","THRESHHOLD_RELU","SCALED_TAHN","HARD_SIGMOID","ELU","SOFTSIGN","SOFTPLUS")
Also this layer supports MKLDNN (DNNL) and cuDNN acceleration- Parameters:
names
- names May be null. Arrays of names for the output variables.x
- Input, with shape dependent on the data format (in config). (NUMERIC type)LSTMLayerWeights
- Configuration ObjectLSTMLayerConfig
- Configuration Object
-
lstmblock
public SDVariable lstmblock(SDVariable maxTSLength, SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM block- Parameters:
maxTSLength
- (NUMERIC type)x
- Input, with shape dependent on the data format (in config). (NUMERIC type)cLast
- Previous/initial cell state, with shape [batchSize, numUnits] (NUMERIC type)yLast
- Previous/initial cell output, with shape [batchSize, numUnits] (NUMERIC type)LSTMWeights
- Configuration ObjectLSTMConfiguration
- Configuration Object- Returns:
- output The layer's outputs. (NUMERIC type)
-
lstmblock
public SDVariable lstmblock(String name, SDVariable maxTSLength, SDVariable x, SDVariable cLast, SDVariable yLast, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM block- Parameters:
name
- name May be null. Name for the output variablemaxTSLength
- (NUMERIC type)x
- Input, with shape dependent on the data format (in config). (NUMERIC type)cLast
- Previous/initial cell state, with shape [batchSize, numUnits] (NUMERIC type)yLast
- Previous/initial cell output, with shape [batchSize, numUnits] (NUMERIC type)LSTMWeights
- Configuration ObjectLSTMConfiguration
- Configuration Object- Returns:
- output The layer's outputs. (NUMERIC type)
-
lstmblock
public SDVariable lstmblock(SDVariable x, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM block- Parameters:
x
- Input, with shape dependent on the data format (in config). (NUMERIC type)LSTMWeights
- Configuration ObjectLSTMConfiguration
- Configuration Object- Returns:
- output The layer's outputs. (NUMERIC type)
-
lstmblock
public SDVariable lstmblock(String name, SDVariable x, LSTMWeights LSTMWeights, LSTMConfiguration LSTMConfiguration)
The LSTM block- Parameters:
name
- name May be null. Name for the output variablex
- Input, with shape dependent on the data format (in config). (NUMERIC type)LSTMWeights
- Configuration ObjectLSTMConfiguration
- Configuration Object- Returns:
- output The layer's outputs. (NUMERIC type)
-
sru
public SDVariable sru(SDVariable x, SDVariable initialC, SDVariable mask, SRUWeights SRUWeights)
The SRU layer. Does a single time step operation.- Parameters:
x
- Input, with shape [batchSize, inSize] (NUMERIC type)initialC
- Initial cell state, with shape [batchSize, inSize] (NUMERIC type)mask
- An optional dropout mask, with shape [batchSize, inSize] (NUMERIC type)SRUWeights
- Configuration Object- Returns:
- output The cell's outputs.. (NUMERIC type)
-
sru
public SDVariable sru(String name, SDVariable x, SDVariable initialC, SDVariable mask, SRUWeights SRUWeights)
The SRU layer. Does a single time step operation.- Parameters:
name
- name May be null. Name for the output variablex
- Input, with shape [batchSize, inSize] (NUMERIC type)initialC
- Initial cell state, with shape [batchSize, inSize] (NUMERIC type)mask
- An optional dropout mask, with shape [batchSize, inSize] (NUMERIC type)SRUWeights
- Configuration Object- Returns:
- output The cell's outputs.. (NUMERIC type)
-
sru
public SDVariable sru(SDVariable x, SDVariable initialC, SRUWeights SRUWeights)
The SRU layer. Does a single time step operation.- Parameters:
x
- Input, with shape [batchSize, inSize] (NUMERIC type)initialC
- Initial cell state, with shape [batchSize, inSize] (NUMERIC type)SRUWeights
- Configuration Object- Returns:
- output The cell's outputs.. (NUMERIC type)
-
sru
public SDVariable sru(String name, SDVariable x, SDVariable initialC, SRUWeights SRUWeights)
The SRU layer. Does a single time step operation.- Parameters:
name
- name May be null. Name for the output variablex
- Input, with shape [batchSize, inSize] (NUMERIC type)initialC
- Initial cell state, with shape [batchSize, inSize] (NUMERIC type)SRUWeights
- Configuration Object- Returns:
- output The cell's outputs.. (NUMERIC type)
-
sruCell
public SDVariable sruCell(SDVariable x, SDVariable cLast, SRUWeights SRUWeights)
The SRU layer. Does a single time step operation.- Parameters:
x
- Input, with shape [batchSize, inSize] (NUMERIC type)cLast
- Previous cell state, with shape [batchSize, inSize] (NUMERIC type)SRUWeights
- Configuration Object- Returns:
- output The cell's outputs. (NUMERIC type)
-
sruCell
public SDVariable sruCell(String name, SDVariable x, SDVariable cLast, SRUWeights SRUWeights)
The SRU layer. Does a single time step operation.- Parameters:
name
- name May be null. Name for the output variablex
- Input, with shape [batchSize, inSize] (NUMERIC type)cLast
- Previous cell state, with shape [batchSize, inSize] (NUMERIC type)SRUWeights
- Configuration Object- Returns:
- output The cell's outputs. (NUMERIC type)
-
-