pub struct LSTMLayer { /* private fields */ }
Expand description
LSTM recurrent layer
Implementations§
Trait Implementations§
Source§impl AlgorithmTrait for LSTMLayer
impl AlgorithmTrait for LSTMLayer
Source§impl AlgorithmTraitConst for LSTMLayer
impl AlgorithmTraitConst for LSTMLayer
fn as_raw_Algorithm(&self) -> *const c_void
Source§fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>
fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>
Stores algorithm parameters in a file storage
Source§fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
Stores algorithm parameters in a file storage Read more
Source§fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
@deprecated Read more
Source§fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>
fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>
👎Deprecated:
§Note
Deprecated: ## Note
This alternative version of AlgorithmTraitConst::write_with_name function uses the following default values for its arguments: Read more
Source§fn empty(&self) -> Result<bool>
fn empty(&self) -> Result<bool>
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
Source§fn save(&self, filename: &str) -> Result<()>
fn save(&self, filename: &str) -> Result<()>
Saves the algorithm to a file.
In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
Source§fn get_default_name(&self) -> Result<String>
fn get_default_name(&self) -> Result<String>
Returns the algorithm string identifier.
This string is used as top level xml/yml node tag when the object is saved to a file or string.
Source§impl Boxed for LSTMLayer
impl Boxed for LSTMLayer
Source§unsafe fn from_raw(ptr: <LSTMLayer as OpenCVFromExtern>::ExternReceive) -> Self
unsafe fn from_raw(ptr: <LSTMLayer as OpenCVFromExtern>::ExternReceive) -> Self
Wrap the specified raw pointer Read more
Source§fn into_raw(self) -> <LSTMLayer as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <LSTMLayer as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying raw pointer while consuming this wrapper. Read more
Source§fn as_raw(&self) -> <LSTMLayer as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <LSTMLayer as OpenCVTypeExternContainer>::ExternSend
Return the underlying raw pointer. Read more
Source§fn as_raw_mut(
&mut self,
) -> <LSTMLayer as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <LSTMLayer as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying mutable raw pointer Read more
Source§impl LSTMLayerTrait for LSTMLayer
impl LSTMLayerTrait for LSTMLayer
fn as_raw_mut_LSTMLayer(&mut self) -> *mut c_void
Source§fn set_weights(
&mut self,
wh: &impl MatTraitConst,
wx: &impl MatTraitConst,
b: &impl MatTraitConst,
) -> Result<()>
fn set_weights( &mut self, wh: &impl MatTraitConst, wx: &impl MatTraitConst, b: &impl MatTraitConst, ) -> Result<()>
👎Deprecated: Use LayerParams::blobs instead.
Deprecated: Use LayerParams::blobs instead.
Set trained weights for LSTM layer. Read more
Source§fn set_out_shape(&mut self, out_tail_shape: &MatShape) -> Result<()>
fn set_out_shape(&mut self, out_tail_shape: &MatShape) -> Result<()>
Specifies shape of output blob which will be [[
T
], N
] + @p outTailShape.
@details If this parameter is empty or unset then @p outTailShape = [Wh
.size(0)] will be used,
where Wh
is parameter from setWeights(). Read moreSource§fn set_out_shape_def(&mut self) -> Result<()>
fn set_out_shape_def(&mut self) -> Result<()>
Specifies shape of output blob which will be [[
T
], N
] + @p outTailShape.
@details If this parameter is empty or unset then @p outTailShape = [Wh
.size(0)] will be used,
where Wh
is parameter from setWeights(). Read moreSource§fn set_use_timstamps_dim(&mut self, use_: bool) -> Result<()>
fn set_use_timstamps_dim(&mut self, use_: bool) -> Result<()>
👎Deprecated: Use flag
produce_cell_output
in LayerParams.Deprecated: Use flag
produce_cell_output
in LayerParams.
Specifies either interpret first dimension of input blob as timestamp dimension either as sample. Read moreSource§fn set_use_timstamps_dim_def(&mut self) -> Result<()>
fn set_use_timstamps_dim_def(&mut self) -> Result<()>
👎Deprecated: Use flag
produce_cell_output
in LayerParams.Deprecated: Use flag
produce_cell_output
in LayerParams.
Specifies either interpret first dimension of input blob as timestamp dimension either as sample. Read moreSource§fn set_produce_cell_output(&mut self, produce: bool) -> Result<()>
fn set_produce_cell_output(&mut self, produce: bool) -> Result<()>
👎Deprecated: Use flag
use_timestamp_dim
in LayerParams.Deprecated: Use flag
use_timestamp_dim
in LayerParams.
If this flag is set to true then layer will produce @f$ c_t @f$ as second output.
@details Shape of the second output is the same as first output. Read moreSource§fn set_produce_cell_output_def(&mut self) -> Result<()>
fn set_produce_cell_output_def(&mut self) -> Result<()>
👎Deprecated: Use flag
use_timestamp_dim
in LayerParams.Deprecated: Use flag
use_timestamp_dim
in LayerParams.
If this flag is set to true then layer will produce @f$ c_t @f$ as second output.
@details Shape of the second output is the same as first output. Read morefn input_name_to_index(&mut self, input_name: &str) -> Result<i32>
fn output_name_to_index(&mut self, output_name: &str) -> Result<i32>
Source§impl LSTMLayerTraitConst for LSTMLayer
impl LSTMLayerTraitConst for LSTMLayer
fn as_raw_LSTMLayer(&self) -> *const c_void
Source§impl LayerTrait for LSTMLayer
impl LayerTrait for LSTMLayer
fn as_raw_mut_Layer(&mut self) -> *mut c_void
Source§fn set_blobs(&mut self, val: Vector<Mat>)
fn set_blobs(&mut self, val: Vector<Mat>)
List of learned parameters must be stored here to allow read them by using Net::getParam().
Source§fn set_name(&mut self, val: &str)
fn set_name(&mut self, val: &str)
Name of the layer instance, can be used for logging or other internal purposes.
Source§fn set_type(&mut self, val: &str)
fn set_type(&mut self, val: &str)
Type name which was used for creating layer by layer factory.
Source§fn set_preferable_target(&mut self, val: i32)
fn set_preferable_target(&mut self, val: i32)
prefer target for layer forwarding
Source§fn finalize(
&mut self,
inputs: &impl ToInputArray,
outputs: &mut impl ToOutputArray,
) -> Result<()>
fn finalize( &mut self, inputs: &impl ToInputArray, outputs: &mut impl ToOutputArray, ) -> Result<()>
Computes and sets internal parameters according to inputs, outputs and blobs. Read more
Source§fn forward_mat(
&mut self,
input: &mut Vector<Mat>,
output: &mut Vector<Mat>,
internals: &mut Vector<Mat>,
) -> Result<()>
fn forward_mat( &mut self, input: &mut Vector<Mat>, output: &mut Vector<Mat>, internals: &mut Vector<Mat>, ) -> Result<()>
👎Deprecated: Use Layer::forward(InputArrayOfArrays, OutputArrayOfArrays, OutputArrayOfArrays) instead
Given the @p input blobs, computes the output @p blobs. Read more
Source§fn forward(
&mut self,
inputs: &impl ToInputArray,
outputs: &mut impl ToOutputArray,
internals: &mut impl ToOutputArray,
) -> Result<()>
fn forward( &mut self, inputs: &impl ToInputArray, outputs: &mut impl ToOutputArray, internals: &mut impl ToOutputArray, ) -> Result<()>
Given the @p input blobs, computes the output @p blobs. Read more
Source§fn try_quantize(
&mut self,
scales: &Vector<Vector<f32>>,
zeropoints: &Vector<Vector<i32>>,
params: &mut impl LayerParamsTrait,
) -> Result<bool>
fn try_quantize( &mut self, scales: &Vector<Vector<f32>>, zeropoints: &Vector<Vector<i32>>, params: &mut impl LayerParamsTrait, ) -> Result<bool>
Tries to quantize the given layer and compute the quantization parameters required for fixed point implementation. Read more
Source§fn forward_fallback(
&mut self,
inputs: &impl ToInputArray,
outputs: &mut impl ToOutputArray,
internals: &mut impl ToOutputArray,
) -> Result<()>
fn forward_fallback( &mut self, inputs: &impl ToInputArray, outputs: &mut impl ToOutputArray, internals: &mut impl ToOutputArray, ) -> Result<()>
Given the @p input blobs, computes the output @p blobs. Read more
Source§fn finalize_mat_to(
&mut self,
inputs: &Vector<Mat>,
outputs: &mut Vector<Mat>,
) -> Result<()>
fn finalize_mat_to( &mut self, inputs: &Vector<Mat>, outputs: &mut Vector<Mat>, ) -> Result<()>
👎Deprecated: Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead
Computes and sets internal parameters according to inputs, outputs and blobs. Read more
Source§fn finalize_mat(&mut self, inputs: &Vector<Mat>) -> Result<Vector<Mat>>
fn finalize_mat(&mut self, inputs: &Vector<Mat>) -> Result<Vector<Mat>>
👎Deprecated: Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead
Computes and sets internal parameters according to inputs, outputs and blobs. Read more
Source§fn run(
&mut self,
inputs: &Vector<Mat>,
outputs: &mut Vector<Mat>,
internals: &mut Vector<Mat>,
) -> Result<()>
fn run( &mut self, inputs: &Vector<Mat>, outputs: &mut Vector<Mat>, internals: &mut Vector<Mat>, ) -> Result<()>
👎Deprecated: This method will be removed in the future release.
Allocates layer and computes output. Read more
Source§fn input_name_to_index(&mut self, input_name: &str) -> Result<i32>
fn input_name_to_index(&mut self, input_name: &str) -> Result<i32>
Returns index of input blob into the input array. Read more
Source§fn output_name_to_index(&mut self, output_name: &str) -> Result<i32>
fn output_name_to_index(&mut self, output_name: &str) -> Result<i32>
Returns index of output blob in output array. Read more
Source§fn support_backend(&mut self, backend_id: i32) -> Result<bool>
fn support_backend(&mut self, backend_id: i32) -> Result<bool>
Ask layer if it support specific backend for doing computations. Read more
Source§fn init_halide(
&mut self,
inputs: &Vector<Ptr<BackendWrapper>>,
) -> Result<Ptr<BackendNode>>
fn init_halide( &mut self, inputs: &Vector<Ptr<BackendWrapper>>, ) -> Result<Ptr<BackendNode>>
Returns Halide backend node. Read more
fn init_ngraph( &mut self, inputs: &Vector<Ptr<BackendWrapper>>, nodes: &Vector<Ptr<BackendNode>>, ) -> Result<Ptr<BackendNode>>
fn init_vk_com( &mut self, inputs: &Vector<Ptr<BackendWrapper>>, outputs: &mut Vector<Ptr<BackendWrapper>>, ) -> Result<Ptr<BackendNode>>
fn init_webnn( &mut self, inputs: &Vector<Ptr<BackendWrapper>>, nodes: &Vector<Ptr<BackendNode>>, ) -> Result<Ptr<BackendNode>>
Source§unsafe fn init_cuda(
&mut self,
context: *mut c_void,
inputs: &Vector<Ptr<BackendWrapper>>,
outputs: &Vector<Ptr<BackendWrapper>>,
) -> Result<Ptr<BackendNode>>
unsafe fn init_cuda( &mut self, context: *mut c_void, inputs: &Vector<Ptr<BackendWrapper>>, outputs: &Vector<Ptr<BackendWrapper>>, ) -> Result<Ptr<BackendNode>>
Returns a CUDA backend node Read more
Source§unsafe fn init_tim_vx(
&mut self,
tim_vx_info: *mut c_void,
inputs_wrapper: &Vector<Ptr<BackendWrapper>>,
outputs_wrapper: &Vector<Ptr<BackendWrapper>>,
is_last: bool,
) -> Result<Ptr<BackendNode>>
unsafe fn init_tim_vx( &mut self, tim_vx_info: *mut c_void, inputs_wrapper: &Vector<Ptr<BackendWrapper>>, outputs_wrapper: &Vector<Ptr<BackendWrapper>>, is_last: bool, ) -> Result<Ptr<BackendNode>>
Returns a TimVX backend node Read more
Source§fn init_cann(
&mut self,
inputs: &Vector<Ptr<BackendWrapper>>,
outputs: &Vector<Ptr<BackendWrapper>>,
nodes: &Vector<Ptr<BackendNode>>,
) -> Result<Ptr<BackendNode>>
fn init_cann( &mut self, inputs: &Vector<Ptr<BackendWrapper>>, outputs: &Vector<Ptr<BackendWrapper>>, nodes: &Vector<Ptr<BackendNode>>, ) -> Result<Ptr<BackendNode>>
Returns a CANN backend node Read more
Source§fn try_attach(&mut self, node: &Ptr<BackendNode>) -> Result<Ptr<BackendNode>>
fn try_attach(&mut self, node: &Ptr<BackendNode>) -> Result<Ptr<BackendNode>>
Implement layers fusing. Read more
Source§fn set_activation(&mut self, layer: &Ptr<ActivationLayer>) -> Result<bool>
fn set_activation(&mut self, layer: &Ptr<ActivationLayer>) -> Result<bool>
Tries to attach to the layer the subsequent activation layer, i.e. do the layer fusion in a partial case. Read more
Source§fn try_fuse(&mut self, top: &mut Ptr<Layer>) -> Result<bool>
fn try_fuse(&mut self, top: &mut Ptr<Layer>) -> Result<bool>
Try to fuse current layer with a next one Read more
Source§fn unset_attached(&mut self) -> Result<()>
fn unset_attached(&mut self) -> Result<()>
“Detaches” all the layers, attached to particular layer.
fn update_memory_shapes(&mut self, inputs: &Vector<MatShape>) -> Result<bool>
fn set_params_from(&mut self, params: &impl LayerParamsTraitConst) -> Result<()>
Source§impl LayerTraitConst for LSTMLayer
impl LayerTraitConst for LSTMLayer
fn as_raw_Layer(&self) -> *const c_void
Source§fn blobs(&self) -> Vector<Mat>
fn blobs(&self) -> Vector<Mat>
List of learned parameters must be stored here to allow read them by using Net::getParam().
Source§fn name(&self) -> String
fn name(&self) -> String
Name of the layer instance, can be used for logging or other internal purposes.
Source§fn preferable_target(&self) -> i32
fn preferable_target(&self) -> i32
prefer target for layer forwarding
Source§fn apply_halide_scheduler(
&self,
node: &mut Ptr<BackendNode>,
inputs: &Vector<Mat>,
outputs: &Vector<Mat>,
target_id: i32,
) -> Result<()>
fn apply_halide_scheduler( &self, node: &mut Ptr<BackendNode>, inputs: &Vector<Mat>, outputs: &Vector<Mat>, target_id: i32, ) -> Result<()>
Automatic Halide scheduling based on layer hyper-parameters. Read more
Source§fn get_scale_shift(
&self,
scale: &mut impl MatTrait,
shift: &mut impl MatTrait,
) -> Result<()>
fn get_scale_shift( &self, scale: &mut impl MatTrait, shift: &mut impl MatTrait, ) -> Result<()>
Returns parameters of layers with channel-wise multiplication and addition. Read more
Source§fn get_scale_zeropoint(
&self,
scale: &mut f32,
zeropoint: &mut i32,
) -> Result<()>
fn get_scale_zeropoint( &self, scale: &mut f32, zeropoint: &mut i32, ) -> Result<()>
Returns scale and zeropoint of layers Read more
fn get_memory_shapes( &self, inputs: &Vector<MatShape>, required_outputs: i32, outputs: &mut Vector<MatShape>, internals: &mut Vector<MatShape>, ) -> Result<bool>
fn get_flops( &self, inputs: &Vector<MatShape>, outputs: &Vector<MatShape>, ) -> Result<i64>
impl Send for LSTMLayer
Auto Trait Implementations§
impl Freeze for LSTMLayer
impl RefUnwindSafe for LSTMLayer
impl !Sync for LSTMLayer
impl Unpin for LSTMLayer
impl UnwindSafe for LSTMLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Helper function to call OpenCV functions that allow in-place modification of a
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold
. Read more