-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_fixed_architectures.py
44 lines (34 loc) · 1.74 KB
/
set_fixed_architectures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import torch
from torch import tensor
import numpy as np
import pdb
from config import get_args
args = get_args()
# RANDOM ARCHITECTURE
RNDM_ARCH = {}
for i in range(args.macro_num_layers) :
node = tensor([np.argmax(np.random.multinomial(1, [1/6]*6))], device='cuda:0')
if i == 0 :
RNDM_ARCH[str(i)] = [node]
else :
skip = tensor(np.random.binomial(1,[args.skip_target]*i), device='cuda:0')
RNDM_ARCH[str(i)] = [node, skip]
torch.save(RNDM_ARCH, './save/states/architecture_rndm.tar')
# ENAS (H. Pham et al)
ENAS_ARCH = {
'0': [tensor([3], device='cuda:0')],
'1': [tensor([2], device='cuda:0'), tensor([0], device='cuda:0')],
'2': [tensor([2], device='cuda:0'), tensor([1, 0], device='cuda:0')],
'3': [tensor([3], device='cuda:0'), tensor([1, 0, 0], device='cuda:0')],
'4': [tensor([4], device='cuda:0'), tensor([0, 0, 0, 0], device='cuda:0')],
'5': [tensor([1], device='cuda:0'), tensor([1, 0, 0, 1, 0], device='cuda:0')],
'6': [tensor([2], device='cuda:0'), tensor([1, 0, 1, 1, 0, 1], device='cuda:0')],
'7': [tensor([1], device='cuda:0'), tensor([1, 0, 1, 1, 0, 1, 1], device='cuda:0')],
'8': [tensor([3], device='cuda:0'), tensor([1, 0, 0, 1, 0, 1, 0, 1], device='cuda:0')],
'9': [tensor([4], device='cuda:0'), tensor([0, 0, 0, 0, 0, 0, 1, 0, 0], device='cuda:0')],
'10': [tensor([2], device='cuda:0'), tensor([1, 1, 0, 1, 0, 1, 0, 1, 0, 0], device='cuda:0')],
'11': [tensor([3], device='cuda:0'), tensor([0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], device='cuda:0')],
'12': [tensor([0], device='cuda:0'), tensor([1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1], device='cuda:0')],
'13': [tensor([3], device='cuda:0'), tensor([0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0], device='cuda:0')]
}
torch.save(ENAS_ARCH, './save/states/architecture_enas.tar')