Trait NetTraitConst

Source
pub trait NetTraitConst {
Show 32 methods // Required method fn as_raw_Net(&self) -> *const c_void; // Provided methods fn empty(&self) -> Result<bool> { ... } fn get_layer_id(&self, layer: &str) -> Result<i32> { ... } fn get_layer_names(&self) -> Result<Vector<String>> { ... } fn get_layer(&self, layer_id: i32) -> Result<Ptr<Layer>> { ... } fn get_layer_1(&self, layer_name: &str) -> Result<Ptr<Layer>> { ... } fn get_layer_2( &self, layer_id: &impl DictValueTraitConst, ) -> Result<Ptr<Layer>> { ... } fn get_layer_inputs(&self, layer_id: i32) -> Result<Vector<Ptr<Layer>>> { ... } fn get_input_details( &self, scales: &mut Vector<f32>, zeropoints: &mut Vector<i32>, ) -> Result<()> { ... } fn get_output_details( &self, scales: &mut Vector<f32>, zeropoints: &mut Vector<i32>, ) -> Result<()> { ... } fn get_param(&self, layer: i32, num_param: i32) -> Result<Mat> { ... } fn get_param_def(&self, layer: i32) -> Result<Mat> { ... } fn get_param_1(&self, layer_name: &str, num_param: i32) -> Result<Mat> { ... } fn get_param_def_1(&self, layer_name: &str) -> Result<Mat> { ... } fn get_unconnected_out_layers(&self) -> Result<Vector<i32>> { ... } fn get_unconnected_out_layers_names(&self) -> Result<Vector<String>> { ... } fn get_layers_shapes( &self, net_input_shapes: &Vector<MatShape>, layers_ids: &mut Vector<i32>, in_layers_shapes: &mut Vector<Vector<MatShape>>, out_layers_shapes: &mut Vector<Vector<MatShape>>, ) -> Result<()> { ... } fn get_layers_shapes_1( &self, net_input_shape: &MatShape, layers_ids: &mut Vector<i32>, in_layers_shapes: &mut Vector<Vector<MatShape>>, out_layers_shapes: &mut Vector<Vector<MatShape>>, ) -> Result<()> { ... } fn get_layer_shapes( &self, net_input_shape: &MatShape, layer_id: i32, in_layer_shapes: &mut Vector<MatShape>, out_layer_shapes: &mut Vector<MatShape>, ) -> Result<()> { ... } fn get_layer_shapes_1( &self, net_input_shapes: &Vector<MatShape>, layer_id: i32, in_layer_shapes: &mut Vector<MatShape>, out_layer_shapes: &mut Vector<MatShape>, ) -> Result<()> { ... } fn get_flops(&self, net_input_shapes: &Vector<MatShape>) -> Result<i64> { ... } fn get_flops_1(&self, net_input_shape: &MatShape) -> Result<i64> { ... } fn get_flops_2( &self, layer_id: i32, net_input_shapes: &Vector<MatShape>, ) -> Result<i64> { ... } fn get_flops_3( &self, layer_id: i32, net_input_shape: &MatShape, ) -> Result<i64> { ... } fn get_layer_types(&self, layers_types: &mut Vector<String>) -> Result<()> { ... } fn get_layers_count(&self, layer_type: &str) -> Result<i32> { ... } fn get_memory_consumption( &self, net_input_shapes: &Vector<MatShape>, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()> { ... } fn get_memory_consumption_1( &self, net_input_shape: &MatShape, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()> { ... } fn get_memory_consumption_for_layer( &self, layer_id: i32, net_input_shapes: &Vector<MatShape>, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()> { ... } fn get_memory_consumption_2( &self, layer_id: i32, net_input_shape: &MatShape, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()> { ... } fn get_memory_consumption_for_layers( &self, net_input_shapes: &Vector<MatShape>, layer_ids: &mut Vector<i32>, weights: &mut Vector<size_t>, blobs: &mut Vector<size_t>, ) -> Result<()> { ... } fn get_memory_consumption_3( &self, net_input_shape: &MatShape, layer_ids: &mut Vector<i32>, weights: &mut Vector<size_t>, blobs: &mut Vector<size_t>, ) -> Result<()> { ... }
}
Expand description

Constant methods for crate::dnn::Net

Required Methods§

Provided Methods§

Source

fn empty(&self) -> Result<bool>

Returns true if there are no layers in the network.

Source

fn get_layer_id(&self, layer: &str) -> Result<i32>

Converts string name of the layer to the integer identifier.

§Returns

id of the layer, or -1 if the layer wasn’t found.

Source

fn get_layer_names(&self) -> Result<Vector<String>>

Source

fn get_layer(&self, layer_id: i32) -> Result<Ptr<Layer>>

Returns pointer to layer with specified id or name which the network use.

Source

fn get_layer_1(&self, layer_name: &str) -> Result<Ptr<Layer>>

👎Deprecated: Use int getLayerId(const String &layer)

Returns pointer to layer with specified id or name which the network use.

§Overloaded parameters

Deprecated: Use int getLayerId(const String &layer)

Source

fn get_layer_2(&self, layer_id: &impl DictValueTraitConst) -> Result<Ptr<Layer>>

👎Deprecated: to be removed

Returns pointer to layer with specified id or name which the network use.

§Overloaded parameters

Deprecated: to be removed

Source

fn get_layer_inputs(&self, layer_id: i32) -> Result<Vector<Ptr<Layer>>>

Returns pointers to input layers of specific layer.

Source

fn get_input_details( &self, scales: &mut Vector<f32>, zeropoints: &mut Vector<i32>, ) -> Result<()>

Returns input scale and zeropoint for a quantized Net.

§Parameters
  • scales: output parameter for returning input scales.
  • zeropoints: output parameter for returning input zeropoints.
Source

fn get_output_details( &self, scales: &mut Vector<f32>, zeropoints: &mut Vector<i32>, ) -> Result<()>

Returns output scale and zeropoint for a quantized Net.

§Parameters
  • scales: output parameter for returning output scales.
  • zeropoints: output parameter for returning output zeropoints.
Source

fn get_param(&self, layer: i32, num_param: i32) -> Result<Mat>

Returns parameter blob of the layer.

§Parameters
  • layer: name or id of the layer.
  • numParam: index of the layer parameter in the Layer::blobs array.
§See also

Layer::blobs

§C++ default parameters
  • num_param: 0
Source

fn get_param_def(&self, layer: i32) -> Result<Mat>

Returns parameter blob of the layer.

§Parameters
  • layer: name or id of the layer.
  • numParam: index of the layer parameter in the Layer::blobs array.
§See also

Layer::blobs

§Note

This alternative version of NetTraitConst::get_param function uses the following default values for its arguments:

  • num_param: 0
Source

fn get_param_1(&self, layer_name: &str, num_param: i32) -> Result<Mat>

§C++ default parameters
  • num_param: 0
Source

fn get_param_def_1(&self, layer_name: &str) -> Result<Mat>

§Note

This alternative version of NetTraitConst::get_param function uses the following default values for its arguments:

  • num_param: 0
Source

fn get_unconnected_out_layers(&self) -> Result<Vector<i32>>

Returns indexes of layers with unconnected outputs.

FIXIT: Rework API to registerOutput() approach, deprecate this call

Source

fn get_unconnected_out_layers_names(&self) -> Result<Vector<String>>

Returns names of layers with unconnected outputs.

FIXIT: Rework API to registerOutput() approach, deprecate this call

Source

fn get_layers_shapes( &self, net_input_shapes: &Vector<MatShape>, layers_ids: &mut Vector<i32>, in_layers_shapes: &mut Vector<Vector<MatShape>>, out_layers_shapes: &mut Vector<Vector<MatShape>>, ) -> Result<()>

Returns input and output shapes for all layers in loaded model; preliminary inferencing isn’t necessary.

§Parameters
  • netInputShapes: shapes for all input blobs in net input layer.
  • layersIds: output parameter for layer IDs.
  • inLayersShapes: output parameter for input layers shapes; order is the same as in layersIds
  • outLayersShapes: output parameter for output layers shapes; order is the same as in layersIds
Source

fn get_layers_shapes_1( &self, net_input_shape: &MatShape, layers_ids: &mut Vector<i32>, in_layers_shapes: &mut Vector<Vector<MatShape>>, out_layers_shapes: &mut Vector<Vector<MatShape>>, ) -> Result<()>

Returns input and output shapes for all layers in loaded model; preliminary inferencing isn’t necessary.

§Parameters
  • netInputShapes: shapes for all input blobs in net input layer.
  • layersIds: output parameter for layer IDs.
  • inLayersShapes: output parameter for input layers shapes; order is the same as in layersIds
  • outLayersShapes: output parameter for output layers shapes; order is the same as in layersIds
§Overloaded parameters
Source

fn get_layer_shapes( &self, net_input_shape: &MatShape, layer_id: i32, in_layer_shapes: &mut Vector<MatShape>, out_layer_shapes: &mut Vector<MatShape>, ) -> Result<()>

Returns input and output shapes for layer with specified id in loaded model; preliminary inferencing isn’t necessary.

§Parameters
  • netInputShape: shape input blob in net input layer.
  • layerId: id for layer.
  • inLayerShapes: output parameter for input layers shapes; order is the same as in layersIds
  • outLayerShapes: output parameter for output layers shapes; order is the same as in layersIds
Source

fn get_layer_shapes_1( &self, net_input_shapes: &Vector<MatShape>, layer_id: i32, in_layer_shapes: &mut Vector<MatShape>, out_layer_shapes: &mut Vector<MatShape>, ) -> Result<()>

Returns input and output shapes for layer with specified id in loaded model; preliminary inferencing isn’t necessary.

§Parameters
  • netInputShape: shape input blob in net input layer.
  • layerId: id for layer.
  • inLayerShapes: output parameter for input layers shapes; order is the same as in layersIds
  • outLayerShapes: output parameter for output layers shapes; order is the same as in layersIds
§Overloaded parameters
Source

fn get_flops(&self, net_input_shapes: &Vector<MatShape>) -> Result<i64>

Computes FLOP for whole loaded model with specified input shapes.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
§Returns

computed FLOP.

Source

fn get_flops_1(&self, net_input_shape: &MatShape) -> Result<i64>

Computes FLOP for whole loaded model with specified input shapes.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
§Returns

computed FLOP.

§Overloaded parameters
Source

fn get_flops_2( &self, layer_id: i32, net_input_shapes: &Vector<MatShape>, ) -> Result<i64>

Computes FLOP for whole loaded model with specified input shapes.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
§Returns

computed FLOP.

§Overloaded parameters
Source

fn get_flops_3(&self, layer_id: i32, net_input_shape: &MatShape) -> Result<i64>

Computes FLOP for whole loaded model with specified input shapes.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
§Returns

computed FLOP.

§Overloaded parameters
Source

fn get_layer_types(&self, layers_types: &mut Vector<String>) -> Result<()>

Returns list of types for layer used in model.

§Parameters
  • layersTypes: output parameter for returning types.
Source

fn get_layers_count(&self, layer_type: &str) -> Result<i32>

Returns count of layers of specified type.

§Parameters
  • layerType: type.
§Returns

count of layers

Source

fn get_memory_consumption( &self, net_input_shapes: &Vector<MatShape>, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>

Computes bytes number which are required to store all weights and intermediate blobs for model.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
  • weights: output parameter to store resulting bytes for weights.
  • blobs: output parameter to store resulting bytes for intermediate blobs.
Source

fn get_memory_consumption_1( &self, net_input_shape: &MatShape, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>

Computes bytes number which are required to store all weights and intermediate blobs for model.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
  • weights: output parameter to store resulting bytes for weights.
  • blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters
Source

fn get_memory_consumption_for_layer( &self, layer_id: i32, net_input_shapes: &Vector<MatShape>, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>

Computes bytes number which are required to store all weights and intermediate blobs for model.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
  • weights: output parameter to store resulting bytes for weights.
  • blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters
Source

fn get_memory_consumption_2( &self, layer_id: i32, net_input_shape: &MatShape, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>

Computes bytes number which are required to store all weights and intermediate blobs for model.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
  • weights: output parameter to store resulting bytes for weights.
  • blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters
Source

fn get_memory_consumption_for_layers( &self, net_input_shapes: &Vector<MatShape>, layer_ids: &mut Vector<i32>, weights: &mut Vector<size_t>, blobs: &mut Vector<size_t>, ) -> Result<()>

Computes bytes number which are required to store all weights and intermediate blobs for each layer.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
  • layerIds: output vector to save layer IDs.
  • weights: output parameter to store resulting bytes for weights.
  • blobs: output parameter to store resulting bytes for intermediate blobs.
Source

fn get_memory_consumption_3( &self, net_input_shape: &MatShape, layer_ids: &mut Vector<i32>, weights: &mut Vector<size_t>, blobs: &mut Vector<size_t>, ) -> Result<()>

Computes bytes number which are required to store all weights and intermediate blobs for each layer.

§Parameters
  • netInputShapes: vector of shapes for all net inputs.
  • layerIds: output vector to save layer IDs.
  • weights: output parameter to store resulting bytes for weights.
  • blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§