-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_sinewave.py
46 lines (34 loc) · 1.01 KB
/
example_sinewave.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
42
43
44
import sys
sys.path.append('..')
import torch
from .sine_dataset import create_dataset_sinewave
from utils import NamedDict
def get_args_maml_regression():
args = NamedDict()
args.problem_dim = (1, 1)
args.train_test = (30, 3)
args.epoch = 100
args.update_lr = 0.001
args.meta_lr = 0.001
args.k_spt = 20
args.k_qry = 100
args.update_step = 10
args.update_step_test = 20
args.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# args.device = torch.device('cpu')
return args
def get_network_structure_maml_regression():
config = [
('linear', [40, 1]),
('relu', [True]),
('linear', [40, 40]),
('relu', [True]),
('linear', [1, 40]),
]
return config
def get_dataset_sinewave(args, **kwargs):
problem_dim = args.problem_dim
n_problem = args.train_test
spt_qry = (args.k_spt, args.k_qry)
dataset = create_dataset_sinewave(problem_dim, n_problem, spt_qry=spt_qry, **kwargs)
return dataset