sophon_ai_project/docs/sail_api/1.基础函数.md
2025-10-17 16:30:24 +08:00

76 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# sail 基础函数
## get_available_tpu_num
获取当前设备中可用的TPU数量
**接口形式:**
```python
def get_available_tpu_num() -> int
```
**返回值说明**:
返回当前设备中可用 TPU的数量
## set_print_flag
设置是否打印程序的计算耗时信息
**接口形式:**
```python
def set_print_flag(print_flag: bool) -> None
```
**参数说明**
- print_flag:bool
print_flag 为 True 时,打印程序的计算主要的耗时信息,否则不打印
## set_dump_io_flag
设置是否存储输入时间和输出时间。
**接口形式:**
```python
def set_dump_io_flag(dump_io_flag: bool) -> None
```
**参数说明**
- dump_io_flag: bool
dump_io_flag为True时存储输入数据和输出数据否则不存储。
## set_decoder_env
设置Decoder的环境变量必须在Decoder构造前设置否则使用默认值。
**接口形式:**
```python
def set_decoder_env(env_name: str, env_value: str) -> None
```
**参数说明:**
- env_name: str
选择设置Decoder的属性名称可选的属性名称有:
- refcounted_frames 设置为1时解码出来的图像需要程序手动释放为0时由Decoder自动释放。
- extra_frame_buffer_num 设置Decoder的最大缓存帧数
- rtsp_transport 设置RTSP采用的传输协议
- stimeout 设置阻塞超时时间
- rtsp_flags 设置RTSP是否自定义IO
- buffer_size 设置缓存大小
- max_delay 设置最大时延
- probesize 解析文件时读取的最大字节数
- analyzeduration 解析文件时读取的最大时长
- env_value: str