Common Utils for PyTorch
Project description
torch-utils
Common Utils for PyTorch.
Installation
Need Python 3.6+.
pip install torch-utils
Usage
- Accuracy
import torch_utils
# ...
top_1, top_5 = torch_utils.accuracy(output=..., target=..., top_k=(1, 5))
- 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
Release history Release notifications | RSS feed
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)
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 812bb73ceee8c2fd7d932d8e82a9de22f854ffbc7a966ba6eac519307adffd12 |
|
MD5 | 7769ab9c8708cd39a0e0e503e56eee35 |
|
BLAKE2b-256 | f84dd004b5af3acf5366b82c192e459b5a52fba4ced92dccce5ea0541e560900 |