utils.py 283 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import torch


def min_value(dtype):
    try:
        return torch.finfo(dtype).min
    except AttributeError:
        return torch.info(dtype).min


def max_value(dtype):
    try:
        return torch.finfo(dtype).max
    except AttributeError:
        return torch.info(dtype).max