Skip to main content

Common Utils for PyTorch

Project description

torch-utils Build Status codecov PyPI version

Common Utils for PyTorch.


Need Python 3.6+.

pip install torch-utils


  1. Accuracy
import torch_utils

# ...

top_1, top_5 = torch_utils.accuracy(output=..., target=..., top_k=(1, 5))
  1. Meter
import torch_utils

loss_meter = torch_utils.AverageMeter(name='Meter', length=10)

print(loss_meter.avg, loss_meter.val)
#> Test 0.00 (0.00)

progress_meter = torch_utils.ProgressMeter(total_steps=100, total_epochs=10)
assert progress_meter.step == 10
assert progress_meter.ratio == 0.1
assert progress_meter.epoch == 1
#> Step 10/100=10.0% (1/10)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for torch-utils, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size torch-utils-0.1.2.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page