Skip to main content

Say hello

Project description

Download to develop

pip install -e .[dev]

Examples

import torch

from pytorchLosses import  LabelSmoothingCrossEntropy,GamblersLoss,SCELoss,TruncatedLoss

a = torch.rand(4, 5)
b = torch.randint(0, 2, (4,))

loss_fun = LabelSmoothingCrossEntropy() 
print(loss_fun(a,b))
print(GamblersLoss(a,b))

loss_fun = SCELoss(alpha=1.0,beta=1.0,num_classes=5).cuda()
print(loss_fun(a.cuda(),b.cuda()))

# Yet to test
loss_fun = TruncatedLoss(q=0.7, k=0.5, trainset_size=10000).cuda()
print(loss_fun(a.cuda(),b.cuda(),indexes=1))

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

pytorchLosses-0.3.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

pytorchLosses-0.3.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file pytorchLosses-0.3.0.tar.gz.

File metadata

  • Download URL: pytorchLosses-0.3.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pytorchLosses-0.3.0.tar.gz
Algorithm Hash digest
SHA256 178806484a6462602d90702b49f3ea875602d03e9a01772aeef7dfb95c75a7cb
MD5 d07010f2d86e12bd2690189343819899
BLAKE2b-256 094c4f0f02ecaa4aa15df1044f357a22eb8735953587d045d132a6695bb309b1

See more details on using hashes here.

File details

Details for the file pytorchLosses-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pytorchLosses-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pytorchLosses-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e21b31e94e41f6881402a318f9b39c905c02cd85827d644a1aad0d211cea5491
MD5 215089b657e991a94b540db2759967f9
BLAKE2b-256 f5f4bd5450c8b9ec00aa9ad9d87dabef4fc0e51153187618fa94f9e339084ce0

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