Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete global torchmetrics #5442

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions python/orca/src/bigdl/orca/learn/pytorch/pytorch_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
#
import torch
from bigdl.dllib.utils.log4Error import invalidInputError

try:
import torchmetrics
except ImportError:
invalidInputError(False,
"please install torchmetrics: pip install torchmetrics")

from abc import ABC, abstractmethod


Expand Down Expand Up @@ -466,6 +459,7 @@ class AUROC(PytorchMetric):
```
"""
def __init__(self):
import torchmetrics
self.internal_auc = torchmetrics.AUROC()

def __call__(self, preds, targets):
Expand Down Expand Up @@ -497,6 +491,7 @@ class ROC(PytorchMetric):

"""
def __init__(self):
import torchmetrics
self.internal_roc = torchmetrics.ROC()

def __call__(self, preds, targets):
Expand All @@ -521,6 +516,7 @@ class F1Score(PytorchMetric):

"""
def __init__(self):
import torchmetrics
self.internal_f1 = torchmetrics.F1Score()

def __call__(self, preds, targets):
Expand All @@ -546,6 +542,7 @@ class Precision(PytorchMetric):

"""
def __init__(self):
import torchmetrics
self.internal_precision = torchmetrics.Precision()

def __call__(self, preds, targets):
Expand All @@ -571,6 +568,7 @@ class Recall(PytorchMetric):

"""
def __init__(self):
import torchmetrics
self.internal_recall = torchmetrics.Recall()

def __call__(self, preds, targets):
Expand Down Expand Up @@ -602,6 +600,7 @@ class PrecisionRecallCurve(PytorchMetric):

"""
def __init__(self):
import torchmetrics
self.internal_curve = torchmetrics.PrecisionRecallCurve()

def __call__(self, preds, targets):
Expand Down