torcheval.metrics.functional.throughput¶
- torcheval.metrics.functional.throughput(num_processed: int = 0, elapsed_time_sec: float = 0.0) Tensor¶
Calculate the throughput value which is the number of elements processed per second. Its class version is
torcheval.metrics.Throughput.- Parameters:
num_processed (int) – Number of items processed.
elapsed_time_sec (float) – Total elapsed time in seconds to process
num_processeditems.
- Raises:
ValueError – If
num_processedis a negative number. Ifelapsed_time_secis a non-positive number.
Examples:
>>> import torch >>> from torcheval.metrics.functional import throughput >>> throughput(64, 2.0) tensor(32.)