Skip to content

Commit

Permalink
Update author information in setup.py and enhance forward method sign…
Browse files Browse the repository at this point in the history
…ature in Loss class for improved readability
  • Loading branch information
fcakyon committed Dec 16, 2024
1 parent f137f8a commit a2503a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions balanced_loss/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(
fl_gamma=2,
samples_per_class=None,
class_balanced=False,
safe: bool = False
safe: bool = False,
):
"""
Compute the Class Balanced Loss between `logits` and the ground truth `labels`.
Expand Down Expand Up @@ -77,11 +77,7 @@ def __init__(
self.class_balanced = class_balanced
self.safe = safe

def forward(
self,
logits: torch.tensor,
labels: torch.tensor
):
def forward(self, logits: torch.tensor, labels: torch.tensor):
"""
Compute the Class Balanced Loss between `logits` and the ground truth `labels`.
Class Balanced Loss: ((1-beta)/(1-beta^n))*Loss(labels, logits)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_version():
setuptools.setup(
name="balanced-loss",
version=get_version(),
author="",
author="fcakyon",
license="MIT",
description="Easy to use class-balanced cross-entropy and focal loss implementation for Pytorch.",
long_description=get_long_description(),
Expand All @@ -54,9 +54,9 @@ def get_version():
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Education",
Expand Down

0 comments on commit a2503a4

Please sign in to comment.