Shortcuts

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_processed items.

Raises:

ValueError – If num_processed is a negative number. If elapsed_time_sec is a non-positive number.

Examples:

>>> import torch
>>> from torcheval.metrics.functional import throughput
>>> throughput(64, 2.0)
tensor(32.)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources