pub struct GatherElementsLayer { /* private fields */ }
Expand description
GatherElements layer GatherElements takes two inputs data and indices of the same rank r >= 1 and an optional attribute axis and works such that: output[i][j][k] = data[index[i][j][k]][j][k] if axis = 0 and r = 3 output[i][j][k] = data[i][index[i][j][k]][k] if axis = 1 and r = 3 output[i][j][k] = data[i][j][index[i][j][k]] if axis = 2 and r = 3
Gather, on the other hand, takes a data tensor of rank r >= 1, and indices tensor of rank q, and works such that: it gathers the enteries along axis dimension of the input data indexed by indices and concatenates them in an output tensor of rank q + (r - 1) e.g. If axis = 0, let k = indices[i_{0}, …, i_{q-1}] then output[i_{0}, …, i_{q-1}, j_{0}, …, j_{r-2}] = input[k , j_{0}, …, j_{r-2}]:
Implementations§
Source§impl GatherElementsLayer
impl GatherElementsLayer
Sourcepub fn default() -> GatherElementsLayer
pub fn default() -> GatherElementsLayer
Creates a default instance of the class by calling the default constructor
pub fn create( params: &impl LayerParamsTraitConst, ) -> Result<Ptr<GatherElementsLayer>>
Trait Implementations§
Source§impl AlgorithmTrait for GatherElementsLayer
impl AlgorithmTrait for GatherElementsLayer
Source§impl AlgorithmTraitConst for GatherElementsLayer
impl AlgorithmTraitConst for GatherElementsLayer
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<()>
Source§fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>
Source§fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
Source§fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>
fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>
§Note
Source§fn empty(&self) -> Result<bool>
fn empty(&self) -> Result<bool>
Source§fn save(&self, filename: &str) -> Result<()>
fn save(&self, filename: &str) -> Result<()>
Source§fn get_default_name(&self) -> Result<String>
fn get_default_name(&self) -> Result<String>
Source§impl Boxed for GatherElementsLayer
impl Boxed for GatherElementsLayer
Source§unsafe fn from_raw(
ptr: <GatherElementsLayer as OpenCVFromExtern>::ExternReceive,
) -> Self
unsafe fn from_raw( ptr: <GatherElementsLayer as OpenCVFromExtern>::ExternReceive, ) -> Self
Source§fn into_raw(
self,
) -> <GatherElementsLayer as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw( self, ) -> <GatherElementsLayer as OpenCVTypeExternContainer>::ExternSendMut
Source§fn as_raw(
&self,
) -> <GatherElementsLayer as OpenCVTypeExternContainer>::ExternSend
fn as_raw( &self, ) -> <GatherElementsLayer as OpenCVTypeExternContainer>::ExternSend
Source§fn as_raw_mut(
&mut self,
) -> <GatherElementsLayer as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <GatherElementsLayer as OpenCVTypeExternContainer>::ExternSendMut
Source§impl Debug for GatherElementsLayer
impl Debug for GatherElementsLayer
Source§impl Default for GatherElementsLayer
impl Default for GatherElementsLayer
Source§impl Drop for GatherElementsLayer
impl Drop for GatherElementsLayer
Source§impl From<GatherElementsLayer> for Algorithm
impl From<GatherElementsLayer> for Algorithm
Source§fn from(s: GatherElementsLayer) -> Self
fn from(s: GatherElementsLayer) -> Self
Source§impl From<GatherElementsLayer> for Layer
impl From<GatherElementsLayer> for Layer
Source§fn from(s: GatherElementsLayer) -> Self
fn from(s: GatherElementsLayer) -> Self
Source§impl GatherElementsLayerTrait for GatherElementsLayer
impl GatherElementsLayerTrait for GatherElementsLayer
fn as_raw_mut_GatherElementsLayer(&mut self) -> *mut c_void
Source§impl GatherElementsLayerTraitConst for GatherElementsLayer
impl GatherElementsLayerTraitConst for GatherElementsLayer
fn as_raw_GatherElementsLayer(&self) -> *const c_void
Source§impl LayerTrait for GatherElementsLayer
impl LayerTrait for GatherElementsLayer
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>)
Source§fn set_name(&mut self, val: &str)
fn set_name(&mut self, val: &str)
Source§fn set_type(&mut self, val: &str)
fn set_type(&mut self, val: &str)
Source§fn set_preferable_target(&mut self, val: i32)
fn set_preferable_target(&mut self, val: i32)
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<()>
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<()>
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<()>
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>
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<()>
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<()>
Source§fn finalize_mat(&mut self, inputs: &Vector<Mat>) -> Result<Vector<Mat>>
fn finalize_mat(&mut self, inputs: &Vector<Mat>) -> Result<Vector<Mat>>
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<()>
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>
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>
Source§fn support_backend(&mut self, backend_id: i32) -> Result<bool>
fn support_backend(&mut self, backend_id: i32) -> Result<bool>
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>>
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>>
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>>
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>>
Source§fn try_attach(&mut self, node: &Ptr<BackendNode>) -> Result<Ptr<BackendNode>>
fn try_attach(&mut self, node: &Ptr<BackendNode>) -> Result<Ptr<BackendNode>>
Source§fn set_activation(&mut self, layer: &Ptr<ActivationLayer>) -> Result<bool>
fn set_activation(&mut self, layer: &Ptr<ActivationLayer>) -> Result<bool>
Source§fn try_fuse(&mut self, top: &mut Ptr<Layer>) -> Result<bool>
fn try_fuse(&mut self, top: &mut Ptr<Layer>) -> Result<bool>
Source§fn unset_attached(&mut self) -> Result<()>
fn unset_attached(&mut self) -> Result<()>
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 GatherElementsLayer
impl LayerTraitConst for GatherElementsLayer
fn as_raw_Layer(&self) -> *const c_void
Source§fn blobs(&self) -> Vector<Mat>
fn blobs(&self) -> Vector<Mat>
Source§fn name(&self) -> String
fn name(&self) -> String
Source§fn preferable_target(&self) -> i32
fn preferable_target(&self) -> i32
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<()>
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<()>
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<()>
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 GatherElementsLayer
impl TryFrom<Layer> for GatherElementsLayer
impl Send for GatherElementsLayer
Auto Trait Implementations§
impl Freeze for GatherElementsLayer
impl RefUnwindSafe for GatherElementsLayer
impl !Sync for GatherElementsLayer
impl Unpin for GatherElementsLayer
impl UnwindSafe for GatherElementsLayer
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
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
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