ONE - On-device Neural Engine
Loading...
Searching...
No Matches
package.common.basesession Namespace Reference

Data Structures

class  BaseSession
 

Functions

 num_elems (tensor_info)
 
 tensorinfo ()
 

Function Documentation

◆ num_elems()

package.common.basesession.num_elems (   tensor_info)
Get the total number of elements in nnfw_tensorinfo.dims.

Definition at line 8 of file basesession.py.

8def num_elems(tensor_info):
9 """Get the total number of elements in nnfw_tensorinfo.dims."""
10 n = 1
11 for x in range(tensor_info.rank):
12 n *= tensor_info.dims[x]
13 return n
14
15
uint64_t num_elems(const nnfw_tensorinfo *ti)
Definition minimal.cc:21

Referenced by package.common.basesession.BaseSession.set_inputs().

◆ tensorinfo()

package.common.basesession.tensorinfo ( )
Shortcut to create a fresh tensorinfo instance.
Raises:
    OnertError: If the C-API call fails.

Definition at line 181 of file basesession.py.

181def tensorinfo():
182 """
183 Shortcut to create a fresh tensorinfo instance.
184 Raises:
185 OnertError: If the C-API call fails.
186 """
187
188 try:
189 return infer.nnfw_tensorinfo()
190 except OnertError:
191 raise
192 except Exception as e:
193 raise OnertError(f"Failed to create tensorinfo: {e}") from e