torcheval.metrics.functional.throughput¶
- torcheval.metrics.functional.throughput(num_processed: int = 0, elapsed_time_sec: float = 0.0) Tensor ¶
计算吞吐量值,它是每秒处理的元素数量。其类版本为
torcheval.metrics.Throughput
。- 参数:
num_processed (int) – 处理的项目数量。
elapsed_time_sec (float) – 处理
num_processed
项目所花费的总时间(以秒为单位)。
- 引发:
ValueError – 如果
num_processed
是负数。如果elapsed_time_sec
是非正数。
示例
>>> import torch >>> from torcheval.metrics.functional import throughput >>> throughput(64, 2.0) tensor(32.)