Skip to main content

Common Utils for PyTorch

Project description

torch-utils Build Status codecov PyPI version

Common Utils for PyTorch.

Installation

Need Python 3.6+.

pip install torch-utils

Usage

  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)
loss_meter.update(val=...)

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

progress_meter = torch_utils.ProgressMeter(total_steps=100, total_epochs=10)
progress_meter.update(step=10)
assert progress_meter.step == 10
assert progress_meter.ratio == 0.1
assert progress_meter.epoch == 1
print(progress_meter)
#> 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.

Source Distribution

torch-utils-0.1.2.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file torch-utils-0.1.2.tar.gz.

File metadata

  • Download URL: torch-utils-0.1.2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for torch-utils-0.1.2.tar.gz
Algorithm Hash digest
SHA256 812bb73ceee8c2fd7d932d8e82a9de22f854ffbc7a966ba6eac519307adffd12
MD5 7769ab9c8708cd39a0e0e503e56eee35
BLAKE2b-256 f84dd004b5af3acf5366b82c192e459b5a52fba4ced92dccce5ea0541e560900

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page