2021-10-28 16:21:23 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
|
|
|
|
import torch
|
|
|
|
|
|
|
|
DEPTH = 2
|
2021-12-27 07:04:32 +00:00
|
|
|
BATCH_SIZE = 8
|
|
|
|
SEQ_LENGTH = 8
|
|
|
|
HIDDEN_SIZE = 8
|
|
|
|
NUM_CLASSES = 8
|
|
|
|
NUM_BLOCKS = 2
|
|
|
|
IMG_SIZE = 16
|
2022-02-14 03:15:02 +00:00
|
|
|
VOCAB_SIZE = 16
|
2021-10-28 16:21:23 +00:00
|
|
|
|
2022-10-26 12:54:39 +00:00
|
|
|
|
2021-10-28 16:21:23 +00:00
|
|
|
def check_equal(A, B):
|
2021-12-27 07:04:32 +00:00
|
|
|
eq = torch.allclose(A, B, rtol=1e-3, atol=1e-2)
|
2022-10-26 12:54:39 +00:00
|
|
|
assert eq, f"\nA = {A}\nB = {B}"
|
|
|
|
return eq
|