@Namespace(value="cv::dnn") public static class opencv_dnn.RNNLayer extends opencv_dnn.Layer
Accepts two inputs \f$x_t\f$ and \f$h_{t-1}\f$ and compute two outputs \f$o_t\f$ and \f$h_t\f$.
- input: should contain packed input \f$x_t\f$. - output: should contain output \f$o_t\f$ (and \f$h_t\f$ if setProduceHiddenOutput() is set to true).
input[0] should have shape [T, N, data_dims] where T and N is number of timestamps and number of independent samples of \f$x_t\f$ respectively.
output[0] will have shape [T, N, \f$N_o\f$], where \f$N_o\f$ is number of rows in \f$ W_{xo} \f$ matrix.
If setProduceHiddenOutput() is set to true then \p output[1] will contain a Mat with shape [T, N, \f$N_h\f$], where \f$N_h\f$ is number of rows in \f$ W_{hh} \f$ matrix.
| Constructor and Description |
|---|
RNNLayer(org.bytedeco.javacpp.Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static opencv_dnn.RNNLayer |
create(opencv_dnn.LayerParams params)
Creates instance of RNNLayer
|
void |
setProduceHiddenOutput() |
void |
setProduceHiddenOutput(boolean produce)
\brief If this flag is set to true then layer will produce \f$ h_t \f$ as second output.
|
void |
setWeights(opencv_core.Mat Wxh,
opencv_core.Mat bh,
opencv_core.Mat Whh,
opencv_core.Mat Who,
opencv_core.Mat bo)
Setups learned weights.
|
applyHalideScheduler, blobs, blobs, finalize, finalize, finalize, forward_fallback, forward_fallback, forward_fallback, forward, forward, forward, forward, getFLOPS, getMemoryShapes, getScaleShift, inputNameToIndex, inputNameToIndex, name, name, outputNameToIndex, outputNameToIndex, preferableTarget, preferableTarget, run, setActivation, setParamsFrom, supportBackend, tryAttach, tryFuse, type, type, unsetAttachedclear, empty, getDefaultName, position, read, save, save, write, write, writeaddress, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic RNNLayer(org.bytedeco.javacpp.Pointer p)
Pointer.Pointer(Pointer).@opencv_core.Ptr public static opencv_dnn.RNNLayer create(@Const @ByRef opencv_dnn.LayerParams params)
public void setWeights(@Const @ByRef
opencv_core.Mat Wxh,
@Const @ByRef
opencv_core.Mat bh,
@Const @ByRef
opencv_core.Mat Whh,
@Const @ByRef
opencv_core.Mat Who,
@Const @ByRef
opencv_core.Mat bo)
Recurrent-layer behavior on each step is defined by current input \f$ x_t \f$, previous state \f$ h_t \f$ and learned weights as follows: \f{eqnarray*}{ h_t &= tanh&(W_{hh} h_{t-1} + W_{xh} x_t + b_h), \\ o_t &= tanh&(W_{ho} h_t + b_o), \f}
Wxh - is \f$ W_{xh} \f$ matrixbh - is \f$ b_{h} \f$ vectorWhh - is \f$ W_{hh} \f$ matrixWho - is \f$ W_{xo} \f$ matrixbo - is \f$ b_{o} \f$ vectorpublic void setProduceHiddenOutput(@Cast(value="bool")
boolean produce)
public void setProduceHiddenOutput()
Copyright © 2018. All rights reserved.