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.0.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytorchLosses-0.0.2.tar.gz
  • Upload date:
  • Size: 15.0 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.0.2.tar.gz
Algorithm Hash digest
SHA256 059e34820e79a3e22b5236da918653e7e9b9baa22f0bc6838a708a0716ecd291
MD5 73bdc3b518419e59bd6549efb5751739
BLAKE2b-256 aeb95b9acad9491ada63433a7a86d7bd5124546708b1f148071dd26007a5b00e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytorchLosses-0.0.2-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.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28176cdd230295ba68235a224113481049d4ca7d380d1421e2233c4028e697be
MD5 81850e0f3e8510ec124ac1c45548aa3e
BLAKE2b-256 b98592fb2dea00eb4c97004e9ce7cfeb1bf699ed1d46e35efa906a53aad430a0

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