utils
最后更新
luxonis_ml.nn_archive.utils函数
infer_layout
Python
1def infer_layout(shape: list[int]) -> str:C 开始的第一个可用字母。示例
Pycon
1>>> infer_layout([1, 3, 256, 256])
2'NCHW'
3>>> infer_layout([256, 256, 3])
4'HWC'
5>>> infer_layout([1, 19, 7, 8])
6'NCDE'shape(list[int]): 要推断的张量形状。
str: 与shape中维度数量匹配的布局代码。
ValueError: 如果形状的维度过多,无法进行自动布局推断。
is_nn_archive
Python
1def is_nn_archive(path: PathType) -> bool:config.json 成员。参数path(PathType): 要检查的文件路径。
bool: 如果文件是有效的 NN Archive,则为True,否则为False。