"dialogctrl/vscode:/vscode.git/clone" did not exist on "d75096587df1a1d32f303fbbd6db6fe92bf06e1b"
helpers.py 315 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
import torch


rusty1s's avatar
rusty1s committed
4
def min_value(dtype):  # pragma: no cover
rusty1s's avatar
rusty1s committed
5
6
    try:
        return torch.finfo(dtype).min
rusty1s's avatar
rusty1s committed
7
8
    except TypeError:
        return torch.iinfo(dtype).min
rusty1s's avatar
rusty1s committed
9
10


rusty1s's avatar
rusty1s committed
11
def max_value(dtype):  # pragma: no cover
rusty1s's avatar
rusty1s committed
12
13
    try:
        return torch.finfo(dtype).max
rusty1s's avatar
rusty1s committed
14
15
    except TypeError:
        return torch.iinfo(dtype).max