pub struct Layer { /* private fields */ }
Expand description
This interface class allows to build new Layers - are building blocks of networks.
Each class, derived from Layer, must implement allocate() methods to declare own outputs and forward() to compute outputs. Also before using the new layer into networks you must register your layer by using one of [dnnLayerFactory] “LayerFactory” macros.
Implementations§
Trait Implementations§
source§impl AlgorithmTrait for Layer
impl AlgorithmTrait for Layer
source§impl AlgorithmTraitConst for Layer
impl AlgorithmTraitConst for Layer
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 Layer
impl Boxed for Layer
source§unsafe fn from_raw(ptr: <Layer as OpenCVFromExtern>::ExternReceive) -> Self
unsafe fn from_raw(ptr: <Layer as OpenCVFromExtern>::ExternReceive) -> Self
Wrap the specified raw pointer Read more
source§fn into_raw(self) -> <Layer as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <Layer as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying raw pointer while consuming this wrapper. Read more
source§fn as_raw(&self) -> <Layer as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <Layer as OpenCVTypeExternContainer>::ExternSend
Return the underlying raw pointer. Read more
source§fn as_raw_mut(&mut self) -> <Layer as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut(&mut self) -> <Layer as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying mutable raw pointer Read more
source§impl From<AccumLayer> for Layer
impl From<AccumLayer> for Layer
source§fn from(s: AccumLayer) -> Self
fn from(s: AccumLayer) -> Self
Converts to this type from the input type.
source§impl From<AcoshLayer> for Layer
impl From<AcoshLayer> for Layer
source§fn from(s: AcoshLayer) -> Self
fn from(s: AcoshLayer) -> Self
Converts to this type from the input type.
source§impl From<ActivationLayer> for Layer
impl From<ActivationLayer> for Layer
source§fn from(s: ActivationLayer) -> Self
fn from(s: ActivationLayer) -> Self
Converts to this type from the input type.
source§impl From<ActivationLayerInt8> for Layer
impl From<ActivationLayerInt8> for Layer
source§fn from(s: ActivationLayerInt8) -> Self
fn from(s: ActivationLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<AsinhLayer> for Layer
impl From<AsinhLayer> for Layer
source§fn from(s: AsinhLayer) -> Self
fn from(s: AsinhLayer) -> Self
Converts to this type from the input type.
source§impl From<AtanhLayer> for Layer
impl From<AtanhLayer> for Layer
source§fn from(s: AtanhLayer) -> Self
fn from(s: AtanhLayer) -> Self
Converts to this type from the input type.
source§impl From<AttentionLayer> for Layer
impl From<AttentionLayer> for Layer
source§fn from(s: AttentionLayer) -> Self
fn from(s: AttentionLayer) -> Self
Converts to this type from the input type.
source§impl From<BaseConvolutionLayer> for Layer
impl From<BaseConvolutionLayer> for Layer
source§fn from(s: BaseConvolutionLayer) -> Self
fn from(s: BaseConvolutionLayer) -> Self
Converts to this type from the input type.
source§impl From<BatchNormLayer> for Layer
impl From<BatchNormLayer> for Layer
source§fn from(s: BatchNormLayer) -> Self
fn from(s: BatchNormLayer) -> Self
Converts to this type from the input type.
source§impl From<BatchNormLayerInt8> for Layer
impl From<BatchNormLayerInt8> for Layer
source§fn from(s: BatchNormLayerInt8) -> Self
fn from(s: BatchNormLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<BlankLayer> for Layer
impl From<BlankLayer> for Layer
source§fn from(s: BlankLayer) -> Self
fn from(s: BlankLayer) -> Self
Converts to this type from the input type.
source§impl From<ChannelsPReLULayer> for Layer
impl From<ChannelsPReLULayer> for Layer
source§fn from(s: ChannelsPReLULayer) -> Self
fn from(s: ChannelsPReLULayer) -> Self
Converts to this type from the input type.
source§impl From<CompareLayer> for Layer
impl From<CompareLayer> for Layer
source§fn from(s: CompareLayer) -> Self
fn from(s: CompareLayer) -> Self
Converts to this type from the input type.
source§impl From<ConcatLayer> for Layer
impl From<ConcatLayer> for Layer
source§fn from(s: ConcatLayer) -> Self
fn from(s: ConcatLayer) -> Self
Converts to this type from the input type.
source§impl From<ConstLayer> for Layer
impl From<ConstLayer> for Layer
source§fn from(s: ConstLayer) -> Self
fn from(s: ConstLayer) -> Self
Converts to this type from the input type.
source§impl From<ConvolutionLayer> for Layer
impl From<ConvolutionLayer> for Layer
source§fn from(s: ConvolutionLayer) -> Self
fn from(s: ConvolutionLayer) -> Self
Converts to this type from the input type.
source§impl From<ConvolutionLayerInt8> for Layer
impl From<ConvolutionLayerInt8> for Layer
source§fn from(s: ConvolutionLayerInt8) -> Self
fn from(s: ConvolutionLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<CorrelationLayer> for Layer
impl From<CorrelationLayer> for Layer
source§fn from(s: CorrelationLayer) -> Self
fn from(s: CorrelationLayer) -> Self
Converts to this type from the input type.
source§impl From<CropAndResizeLayer> for Layer
impl From<CropAndResizeLayer> for Layer
source§fn from(s: CropAndResizeLayer) -> Self
fn from(s: CropAndResizeLayer) -> Self
Converts to this type from the input type.
source§impl From<CumSumLayer> for Layer
impl From<CumSumLayer> for Layer
source§fn from(s: CumSumLayer) -> Self
fn from(s: CumSumLayer) -> Self
Converts to this type from the input type.
source§impl From<DataAugmentationLayer> for Layer
impl From<DataAugmentationLayer> for Layer
source§fn from(s: DataAugmentationLayer) -> Self
fn from(s: DataAugmentationLayer) -> Self
Converts to this type from the input type.
source§impl From<DeconvolutionLayer> for Layer
impl From<DeconvolutionLayer> for Layer
source§fn from(s: DeconvolutionLayer) -> Self
fn from(s: DeconvolutionLayer) -> Self
Converts to this type from the input type.
source§impl From<DequantizeLayer> for Layer
impl From<DequantizeLayer> for Layer
source§fn from(s: DequantizeLayer) -> Self
fn from(s: DequantizeLayer) -> Self
Converts to this type from the input type.
source§impl From<DetectionOutputLayer> for Layer
impl From<DetectionOutputLayer> for Layer
source§fn from(s: DetectionOutputLayer) -> Self
fn from(s: DetectionOutputLayer) -> Self
Converts to this type from the input type.
source§impl From<EinsumLayer> for Layer
impl From<EinsumLayer> for Layer
source§fn from(s: EinsumLayer) -> Self
fn from(s: EinsumLayer) -> Self
Converts to this type from the input type.
source§impl From<EltwiseLayer> for Layer
impl From<EltwiseLayer> for Layer
source§fn from(s: EltwiseLayer) -> Self
fn from(s: EltwiseLayer) -> Self
Converts to this type from the input type.
source§impl From<EltwiseLayerInt8> for Layer
impl From<EltwiseLayerInt8> for Layer
source§fn from(s: EltwiseLayerInt8) -> Self
fn from(s: EltwiseLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<ExpandLayer> for Layer
impl From<ExpandLayer> for Layer
source§fn from(s: ExpandLayer) -> Self
fn from(s: ExpandLayer) -> Self
Converts to this type from the input type.
source§impl From<FlattenLayer> for Layer
impl From<FlattenLayer> for Layer
source§fn from(s: FlattenLayer) -> Self
fn from(s: FlattenLayer) -> Self
Converts to this type from the input type.
source§impl From<FloorLayer> for Layer
impl From<FloorLayer> for Layer
source§fn from(s: FloorLayer) -> Self
fn from(s: FloorLayer) -> Self
Converts to this type from the input type.
source§impl From<FlowWarpLayer> for Layer
impl From<FlowWarpLayer> for Layer
source§fn from(s: FlowWarpLayer) -> Self
fn from(s: FlowWarpLayer) -> Self
Converts to this type from the input type.
source§impl From<GatherElementsLayer> for Layer
impl From<GatherElementsLayer> for Layer
source§fn from(s: GatherElementsLayer) -> Self
fn from(s: GatherElementsLayer) -> Self
Converts to this type from the input type.
source§impl From<GatherLayer> for Layer
impl From<GatherLayer> for Layer
source§fn from(s: GatherLayer) -> Self
fn from(s: GatherLayer) -> Self
Converts to this type from the input type.
source§impl From<GeluApproximationLayer> for Layer
impl From<GeluApproximationLayer> for Layer
source§fn from(s: GeluApproximationLayer) -> Self
fn from(s: GeluApproximationLayer) -> Self
Converts to this type from the input type.
source§impl From<HardSigmoidLayer> for Layer
impl From<HardSigmoidLayer> for Layer
source§fn from(s: HardSigmoidLayer) -> Self
fn from(s: HardSigmoidLayer) -> Self
Converts to this type from the input type.
source§impl From<HardSwishLayer> for Layer
impl From<HardSwishLayer> for Layer
source§fn from(s: HardSwishLayer) -> Self
fn from(s: HardSwishLayer) -> Self
Converts to this type from the input type.
source§impl From<InnerProductLayer> for Layer
impl From<InnerProductLayer> for Layer
source§fn from(s: InnerProductLayer) -> Self
fn from(s: InnerProductLayer) -> Self
Converts to this type from the input type.
source§impl From<InnerProductLayerInt8> for Layer
impl From<InnerProductLayerInt8> for Layer
source§fn from(s: InnerProductLayerInt8) -> Self
fn from(s: InnerProductLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<InstanceNormLayer> for Layer
impl From<InstanceNormLayer> for Layer
source§fn from(s: InstanceNormLayer) -> Self
fn from(s: InstanceNormLayer) -> Self
Converts to this type from the input type.
source§impl From<InterpLayer> for Layer
impl From<InterpLayer> for Layer
source§fn from(s: InterpLayer) -> Self
fn from(s: InterpLayer) -> Self
Converts to this type from the input type.
source§impl From<LayerNormLayer> for Layer
impl From<LayerNormLayer> for Layer
source§fn from(s: LayerNormLayer) -> Self
fn from(s: LayerNormLayer) -> Self
Converts to this type from the input type.
source§impl From<MatMulLayer> for Layer
impl From<MatMulLayer> for Layer
source§fn from(s: MatMulLayer) -> Self
fn from(s: MatMulLayer) -> Self
Converts to this type from the input type.
source§impl From<MaxUnpoolLayer> for Layer
impl From<MaxUnpoolLayer> for Layer
source§fn from(s: MaxUnpoolLayer) -> Self
fn from(s: MaxUnpoolLayer) -> Self
Converts to this type from the input type.
source§impl From<NaryEltwiseLayer> for Layer
impl From<NaryEltwiseLayer> for Layer
source§fn from(s: NaryEltwiseLayer) -> Self
fn from(s: NaryEltwiseLayer) -> Self
Converts to this type from the input type.
source§impl From<NormalizeBBoxLayer> for Layer
impl From<NormalizeBBoxLayer> for Layer
source§fn from(s: NormalizeBBoxLayer) -> Self
fn from(s: NormalizeBBoxLayer) -> Self
Converts to this type from the input type.
source§impl From<PaddingLayer> for Layer
impl From<PaddingLayer> for Layer
source§fn from(s: PaddingLayer) -> Self
fn from(s: PaddingLayer) -> Self
Converts to this type from the input type.
source§impl From<PermuteLayer> for Layer
impl From<PermuteLayer> for Layer
source§fn from(s: PermuteLayer) -> Self
fn from(s: PermuteLayer) -> Self
Converts to this type from the input type.
source§impl From<PoolingLayer> for Layer
impl From<PoolingLayer> for Layer
source§fn from(s: PoolingLayer) -> Self
fn from(s: PoolingLayer) -> Self
Converts to this type from the input type.
source§impl From<PoolingLayerInt8> for Layer
impl From<PoolingLayerInt8> for Layer
source§fn from(s: PoolingLayerInt8) -> Self
fn from(s: PoolingLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<PowerLayer> for Layer
impl From<PowerLayer> for Layer
source§fn from(s: PowerLayer) -> Self
fn from(s: PowerLayer) -> Self
Converts to this type from the input type.
source§impl From<PriorBoxLayer> for Layer
impl From<PriorBoxLayer> for Layer
source§fn from(s: PriorBoxLayer) -> Self
fn from(s: PriorBoxLayer) -> Self
Converts to this type from the input type.
source§impl From<ProposalLayer> for Layer
impl From<ProposalLayer> for Layer
source§fn from(s: ProposalLayer) -> Self
fn from(s: ProposalLayer) -> Self
Converts to this type from the input type.
source§impl From<QuantizeLayer> for Layer
impl From<QuantizeLayer> for Layer
source§fn from(s: QuantizeLayer) -> Self
fn from(s: QuantizeLayer) -> Self
Converts to this type from the input type.
source§impl From<ReLU6Layer> for Layer
impl From<ReLU6Layer> for Layer
source§fn from(s: ReLU6Layer) -> Self
fn from(s: ReLU6Layer) -> Self
Converts to this type from the input type.
source§impl From<ReciprocalLayer> for Layer
impl From<ReciprocalLayer> for Layer
source§fn from(s: ReciprocalLayer) -> Self
fn from(s: ReciprocalLayer) -> Self
Converts to this type from the input type.
source§impl From<ReduceLayer> for Layer
impl From<ReduceLayer> for Layer
source§fn from(s: ReduceLayer) -> Self
fn from(s: ReduceLayer) -> Self
Converts to this type from the input type.
source§impl From<RegionLayer> for Layer
impl From<RegionLayer> for Layer
source§fn from(s: RegionLayer) -> Self
fn from(s: RegionLayer) -> Self
Converts to this type from the input type.
source§impl From<ReorgLayer> for Layer
impl From<ReorgLayer> for Layer
source§fn from(s: ReorgLayer) -> Self
fn from(s: ReorgLayer) -> Self
Converts to this type from the input type.
source§impl From<RequantizeLayer> for Layer
impl From<RequantizeLayer> for Layer
source§fn from(s: RequantizeLayer) -> Self
fn from(s: RequantizeLayer) -> Self
Converts to this type from the input type.
source§impl From<ReshapeLayer> for Layer
impl From<ReshapeLayer> for Layer
source§fn from(s: ReshapeLayer) -> Self
fn from(s: ReshapeLayer) -> Self
Converts to this type from the input type.
source§impl From<ResizeLayer> for Layer
impl From<ResizeLayer> for Layer
source§fn from(s: ResizeLayer) -> Self
fn from(s: ResizeLayer) -> Self
Converts to this type from the input type.
source§impl From<RoundLayer> for Layer
impl From<RoundLayer> for Layer
source§fn from(s: RoundLayer) -> Self
fn from(s: RoundLayer) -> Self
Converts to this type from the input type.
source§impl From<ScaleLayer> for Layer
impl From<ScaleLayer> for Layer
source§fn from(s: ScaleLayer) -> Self
fn from(s: ScaleLayer) -> Self
Converts to this type from the input type.
source§impl From<ScaleLayerInt8> for Layer
impl From<ScaleLayerInt8> for Layer
source§fn from(s: ScaleLayerInt8) -> Self
fn from(s: ScaleLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<ScatterLayer> for Layer
impl From<ScatterLayer> for Layer
source§fn from(s: ScatterLayer) -> Self
fn from(s: ScatterLayer) -> Self
Converts to this type from the input type.
source§impl From<ScatterNDLayer> for Layer
impl From<ScatterNDLayer> for Layer
source§fn from(s: ScatterNDLayer) -> Self
fn from(s: ScatterNDLayer) -> Self
Converts to this type from the input type.
source§impl From<ShiftLayer> for Layer
impl From<ShiftLayer> for Layer
source§fn from(s: ShiftLayer) -> Self
fn from(s: ShiftLayer) -> Self
Converts to this type from the input type.
source§impl From<ShiftLayerInt8> for Layer
impl From<ShiftLayerInt8> for Layer
source§fn from(s: ShiftLayerInt8) -> Self
fn from(s: ShiftLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<ShrinkLayer> for Layer
impl From<ShrinkLayer> for Layer
source§fn from(s: ShrinkLayer) -> Self
fn from(s: ShrinkLayer) -> Self
Converts to this type from the input type.
source§impl From<ShuffleChannelLayer> for Layer
impl From<ShuffleChannelLayer> for Layer
source§fn from(s: ShuffleChannelLayer) -> Self
fn from(s: ShuffleChannelLayer) -> Self
Converts to this type from the input type.
source§impl From<SigmoidLayer> for Layer
impl From<SigmoidLayer> for Layer
source§fn from(s: SigmoidLayer) -> Self
fn from(s: SigmoidLayer) -> Self
Converts to this type from the input type.
source§impl From<SliceLayer> for Layer
impl From<SliceLayer> for Layer
source§fn from(s: SliceLayer) -> Self
fn from(s: SliceLayer) -> Self
Converts to this type from the input type.
source§impl From<SoftmaxLayer> for Layer
impl From<SoftmaxLayer> for Layer
source§fn from(s: SoftmaxLayer) -> Self
fn from(s: SoftmaxLayer) -> Self
Converts to this type from the input type.
source§impl From<SoftmaxLayerInt8> for Layer
impl From<SoftmaxLayerInt8> for Layer
source§fn from(s: SoftmaxLayerInt8) -> Self
fn from(s: SoftmaxLayerInt8) -> Self
Converts to this type from the input type.
source§impl From<SoftplusLayer> for Layer
impl From<SoftplusLayer> for Layer
source§fn from(s: SoftplusLayer) -> Self
fn from(s: SoftplusLayer) -> Self
Converts to this type from the input type.
source§impl From<SoftsignLayer> for Layer
impl From<SoftsignLayer> for Layer
source§fn from(s: SoftsignLayer) -> Self
fn from(s: SoftsignLayer) -> Self
Converts to this type from the input type.
source§impl From<SplitLayer> for Layer
impl From<SplitLayer> for Layer
source§fn from(s: SplitLayer) -> Self
fn from(s: SplitLayer) -> Self
Converts to this type from the input type.
source§impl From<SwishLayer> for Layer
impl From<SwishLayer> for Layer
source§fn from(s: SwishLayer) -> Self
fn from(s: SwishLayer) -> Self
Converts to this type from the input type.
source§impl From<ThresholdedReluLayer> for Layer
impl From<ThresholdedReluLayer> for Layer
source§fn from(s: ThresholdedReluLayer) -> Self
fn from(s: ThresholdedReluLayer) -> Self
Converts to this type from the input type.
source§impl LayerTrait for Layer
impl LayerTrait for Layer
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 Layer
impl LayerTraitConst for Layer
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>
source§impl TryFrom<Layer> for AccumLayer
impl TryFrom<Layer> for AccumLayer
source§impl TryFrom<Layer> for AcoshLayer
impl TryFrom<Layer> for AcoshLayer
source§impl TryFrom<Layer> for ActivationLayer
impl TryFrom<Layer> for ActivationLayer
source§impl TryFrom<Layer> for ActivationLayerInt8
impl TryFrom<Layer> for ActivationLayerInt8
source§impl TryFrom<Layer> for AsinhLayer
impl TryFrom<Layer> for AsinhLayer
source§impl TryFrom<Layer> for AtanhLayer
impl TryFrom<Layer> for AtanhLayer
source§impl TryFrom<Layer> for AttentionLayer
impl TryFrom<Layer> for AttentionLayer
source§impl TryFrom<Layer> for BaseConvolutionLayer
impl TryFrom<Layer> for BaseConvolutionLayer
source§impl TryFrom<Layer> for BatchNormLayer
impl TryFrom<Layer> for BatchNormLayer
source§impl TryFrom<Layer> for BatchNormLayerInt8
impl TryFrom<Layer> for BatchNormLayerInt8
source§impl TryFrom<Layer> for BlankLayer
impl TryFrom<Layer> for BlankLayer
source§impl TryFrom<Layer> for ChannelsPReLULayer
impl TryFrom<Layer> for ChannelsPReLULayer
source§impl TryFrom<Layer> for CompareLayer
impl TryFrom<Layer> for CompareLayer
source§impl TryFrom<Layer> for ConcatLayer
impl TryFrom<Layer> for ConcatLayer
source§impl TryFrom<Layer> for ConstLayer
impl TryFrom<Layer> for ConstLayer
source§impl TryFrom<Layer> for ConvolutionLayer
impl TryFrom<Layer> for ConvolutionLayer
source§impl TryFrom<Layer> for ConvolutionLayerInt8
impl TryFrom<Layer> for ConvolutionLayerInt8
source§impl TryFrom<Layer> for CorrelationLayer
impl TryFrom<Layer> for CorrelationLayer
source§impl TryFrom<Layer> for CropAndResizeLayer
impl TryFrom<Layer> for CropAndResizeLayer
source§impl TryFrom<Layer> for CumSumLayer
impl TryFrom<Layer> for CumSumLayer
source§impl TryFrom<Layer> for DataAugmentationLayer
impl TryFrom<Layer> for DataAugmentationLayer
source§impl TryFrom<Layer> for DeconvolutionLayer
impl TryFrom<Layer> for DeconvolutionLayer
source§impl TryFrom<Layer> for DequantizeLayer
impl TryFrom<Layer> for DequantizeLayer
source§impl TryFrom<Layer> for DetectionOutputLayer
impl TryFrom<Layer> for DetectionOutputLayer
source§impl TryFrom<Layer> for EinsumLayer
impl TryFrom<Layer> for EinsumLayer
source§impl TryFrom<Layer> for EltwiseLayer
impl TryFrom<Layer> for EltwiseLayer
source§impl TryFrom<Layer> for EltwiseLayerInt8
impl TryFrom<Layer> for EltwiseLayerInt8
source§impl TryFrom<Layer> for ExpandLayer
impl TryFrom<Layer> for ExpandLayer
source§impl TryFrom<Layer> for FlattenLayer
impl TryFrom<Layer> for FlattenLayer
source§impl TryFrom<Layer> for FloorLayer
impl TryFrom<Layer> for FloorLayer
source§impl TryFrom<Layer> for FlowWarpLayer
impl TryFrom<Layer> for FlowWarpLayer
source§impl TryFrom<Layer> for GatherElementsLayer
impl TryFrom<Layer> for GatherElementsLayer
source§impl TryFrom<Layer> for GatherLayer
impl TryFrom<Layer> for GatherLayer
source§impl TryFrom<Layer> for GeluApproximationLayer
impl TryFrom<Layer> for GeluApproximationLayer
source§impl TryFrom<Layer> for HardSigmoidLayer
impl TryFrom<Layer> for HardSigmoidLayer
source§impl TryFrom<Layer> for HardSwishLayer
impl TryFrom<Layer> for HardSwishLayer
source§impl TryFrom<Layer> for InnerProductLayer
impl TryFrom<Layer> for InnerProductLayer
source§impl TryFrom<Layer> for InnerProductLayerInt8
impl TryFrom<Layer> for InnerProductLayerInt8
source§impl TryFrom<Layer> for InstanceNormLayer
impl TryFrom<Layer> for InstanceNormLayer
source§impl TryFrom<Layer> for InterpLayer
impl TryFrom<Layer> for InterpLayer
source§impl TryFrom<Layer> for LayerNormLayer
impl TryFrom<Layer> for LayerNormLayer
source§impl TryFrom<Layer> for MatMulLayer
impl TryFrom<Layer> for MatMulLayer
source§impl TryFrom<Layer> for MaxUnpoolLayer
impl TryFrom<Layer> for MaxUnpoolLayer
source§impl TryFrom<Layer> for NaryEltwiseLayer
impl TryFrom<Layer> for NaryEltwiseLayer
source§impl TryFrom<Layer> for NormalizeBBoxLayer
impl TryFrom<Layer> for NormalizeBBoxLayer
source§impl TryFrom<Layer> for PaddingLayer
impl TryFrom<Layer> for PaddingLayer
source§impl TryFrom<Layer> for PermuteLayer
impl TryFrom<Layer> for PermuteLayer
source§impl TryFrom<Layer> for PoolingLayer
impl TryFrom<Layer> for PoolingLayer
source§impl TryFrom<Layer> for PoolingLayerInt8
impl TryFrom<Layer> for PoolingLayerInt8
source§impl TryFrom<Layer> for PowerLayer
impl TryFrom<Layer> for PowerLayer
source§impl TryFrom<Layer> for PriorBoxLayer
impl TryFrom<Layer> for PriorBoxLayer
source§impl TryFrom<Layer> for ProposalLayer
impl TryFrom<Layer> for ProposalLayer
source§impl TryFrom<Layer> for QuantizeLayer
impl TryFrom<Layer> for QuantizeLayer
source§impl TryFrom<Layer> for ReLU6Layer
impl TryFrom<Layer> for ReLU6Layer
source§impl TryFrom<Layer> for ReciprocalLayer
impl TryFrom<Layer> for ReciprocalLayer
source§impl TryFrom<Layer> for ReduceLayer
impl TryFrom<Layer> for ReduceLayer
source§impl TryFrom<Layer> for RegionLayer
impl TryFrom<Layer> for RegionLayer
source§impl TryFrom<Layer> for ReorgLayer
impl TryFrom<Layer> for ReorgLayer
source§impl TryFrom<Layer> for RequantizeLayer
impl TryFrom<Layer> for RequantizeLayer
source§impl TryFrom<Layer> for ReshapeLayer
impl TryFrom<Layer> for ReshapeLayer
source§impl TryFrom<Layer> for ResizeLayer
impl TryFrom<Layer> for ResizeLayer
source§impl TryFrom<Layer> for RoundLayer
impl TryFrom<Layer> for RoundLayer
source§impl TryFrom<Layer> for ScaleLayer
impl TryFrom<Layer> for ScaleLayer
source§impl TryFrom<Layer> for ScaleLayerInt8
impl TryFrom<Layer> for ScaleLayerInt8
source§impl TryFrom<Layer> for ScatterLayer
impl TryFrom<Layer> for ScatterLayer
source§impl TryFrom<Layer> for ScatterNDLayer
impl TryFrom<Layer> for ScatterNDLayer
source§impl TryFrom<Layer> for ShiftLayer
impl TryFrom<Layer> for ShiftLayer
source§impl TryFrom<Layer> for ShiftLayerInt8
impl TryFrom<Layer> for ShiftLayerInt8
source§impl TryFrom<Layer> for ShrinkLayer
impl TryFrom<Layer> for ShrinkLayer
source§impl TryFrom<Layer> for ShuffleChannelLayer
impl TryFrom<Layer> for ShuffleChannelLayer
source§impl TryFrom<Layer> for SigmoidLayer
impl TryFrom<Layer> for SigmoidLayer
source§impl TryFrom<Layer> for SliceLayer
impl TryFrom<Layer> for SliceLayer
source§impl TryFrom<Layer> for SoftmaxLayer
impl TryFrom<Layer> for SoftmaxLayer
source§impl TryFrom<Layer> for SoftmaxLayerInt8
impl TryFrom<Layer> for SoftmaxLayerInt8
source§impl TryFrom<Layer> for SoftplusLayer
impl TryFrom<Layer> for SoftplusLayer
source§impl TryFrom<Layer> for SoftsignLayer
impl TryFrom<Layer> for SoftsignLayer
source§impl TryFrom<Layer> for SplitLayer
impl TryFrom<Layer> for SplitLayer
source§impl TryFrom<Layer> for SwishLayer
impl TryFrom<Layer> for SwishLayer
source§impl TryFrom<Layer> for ThresholdedReluLayer
impl TryFrom<Layer> for ThresholdedReluLayer
impl Send for Layer
Auto Trait Implementations§
impl Freeze for Layer
impl RefUnwindSafe for Layer
impl !Sync for Layer
impl Unpin for Layer
impl UnwindSafe for Layer
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 of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance
sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold
. Read more