Welcome to our Support Center

Get Weights by index

Description

Gets the weights of the layer selected by the index given as input.

Input parameters

 

Model in : model architecture.
 index : integerlayer index.

Output parameters

 

Model out : model architecture.

weights : cluster

index : integer, index of layer.
name : string, name of layer.
weight : variant, weight value.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install HAIBAL library to run it).

Using the “Get Weights by index” function

1 – Define Graph

We define the graph with one input and two Dense layers named Dense1 and Dense2.

2 – Set Function

We use the “Set All Random Weights” function to create random weights for all layers which have weights in the model.

3 – Get Function

We use the “Get Weights by index” function to get the weights of the layer at index 2.

4 – Convert variant to data

The get function returns the weights in a variant, so we use the “Variant To Data” function of LabVIEW to get the result in an array. For that, we use the polymorph which transmits us directly the typedef of the Dense layer.

Tags:
Table of Contents