ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Common.cpp File Reference
#include "Common.h"

Go to the source code of this file.

Functions

std::string mangle (const std::string &name)
 Construct HDF5-compatible dataset name from a given string.
 
std::string value_grpname (void)
 Return the name of "value group".
 
std::string value_filename (uint32_t n)
 Return the name of n-th tensor dataset.
 
std::string name_grpname (void)
 Return the name of "name group".
 
std::string name_filename (uint32_t n)
 Return the name of n-th tensor attribute.
 

Function Documentation

◆ mangle()

std::string mangle ( const std::string &  name)

Construct HDF5-compatible dataset name from a given string.

When someone attempts to access 'A/B/C' dataset, HDF5 tries to open dataset C in group B in top-level group A, which menas that dataset names SHOULD NOT contain '/' in it.

This mangle function replaces all the occurence of '/' in a given string with '_' to construct HDF5-compatible dataset name.

Definition at line 19 of file Common.cpp.

20{
21 std::string res = name;
22
23 for (uint32_t n = 0; n < res.size(); ++n)
24 {
25 if (res.at(n) == '/')
26 {
27 res.at(n) = '_';
28 }
29 }
30
31 return res;
32}

Referenced by circletensordump::DumpTensorsToHdf5::run().

◆ name_filename()

std::string name_filename ( uint32_t  n)

Return the name of n-th tensor attribute.

Definition at line 38 of file Common.cpp.

38{ return std::to_string(n); }

◆ name_grpname()

std::string name_grpname ( void  )

Return the name of "name group".

Definition at line 37 of file Common.cpp.

37{ return "name"; }

Referenced by HD5ExportAction::HD5ExportAction().

◆ value_filename()

std::string value_filename ( uint32_t  n)

Return the name of n-th tensor dataset.

Definition at line 35 of file Common.cpp.

35{ return std::to_string(n); }

Referenced by HD5ExportAction::run(), and HD5ImportAction::run().

◆ value_grpname()

std::string value_grpname ( void  )

Return the name of "value group".

Definition at line 34 of file Common.cpp.

34{ return "value"; }

Referenced by entry(), HD5ExportAction::HD5ExportAction(), and HD5ImportAction::HD5ImportAction().