common.py 307 Bytes
Newer Older
zbian's avatar
zbian committed
1
2
3
4
5
6
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

import torch

DEPTH = 2
アマデウス's avatar
アマデウス committed
7
8
9
10
11
12
BATCH_SIZE = 8
SEQ_LENGTH = 8
HIDDEN_SIZE = 8
NUM_CLASSES = 8
NUM_BLOCKS = 2
IMG_SIZE = 16
13
VOCAB_SIZE = 16
zbian's avatar
zbian committed
14

kurisusnowdeng's avatar
kurisusnowdeng committed
15

zbian's avatar
zbian committed
16
def check_equal(A, B):
アマデウス's avatar
アマデウス committed
17
    eq = torch.allclose(A, B, rtol=1e-3, atol=1e-2)
kurisusnowdeng's avatar
kurisusnowdeng committed
18
19
    assert eq, f"\nA = {A}\nB = {B}"
    return eq