CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ai-forever

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: ai-forever/sber-swap
Path: blob/main/apex/tests/L0/run_amp/utils.py
Views: 794
1
import torch
2
3
HALF = 'torch.cuda.HalfTensor'
4
FLOAT = 'torch.cuda.FloatTensor'
5
6
DTYPES = [torch.half, torch.float]
7
8
ALWAYS_HALF = {torch.float: HALF,
9
torch.half: HALF}
10
ALWAYS_FLOAT = {torch.float: FLOAT,
11
torch.half: FLOAT}
12
MATCH_INPUT = {torch.float: FLOAT,
13
torch.half: HALF}
14
15
def common_init(test_case):
16
test_case.h = 64
17
test_case.b = 16
18
test_case.c = 16
19
test_case.k = 3
20
test_case.t = 10
21
torch.set_default_tensor_type(torch.cuda.FloatTensor)
22
23