-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_pytorch.py
96 lines (63 loc) · 1.78 KB
/
test_pytorch.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import torch
import torch.nn as nn
import numpy as np
from torch.autograd import Variable
import torch.nn.functional as F
from utils import *
# x=np.random.rand(100,1,2,2)
# x=torch.Tensor(x)
# y=sum(x,[2,3],keepdim=True)
# print (y.size())
# y=x.repeat(*[1,3,1,1])
# print (y.size())
# x.unsqueeze_(0)
# print (x.size())
# y=Variable(x)
# x=np.random.rand(1,2,2)
# x=torch.Tensor(x)
# x.unsqueeze_(0)
# y=Variable(x)
# from Network import Generator,Discriminator
# g=Generator(2,16,2)
# for i in range(2):
# g.add_smoothing_branch()
# g.add_layer(with_smoothing=True)
# print (g)
# d=Discriminator(2,16,0.5)
# for i in range(2):
# d.add_smoothing_branch()
# d.add_layer(with_smoothing=True)
# outputs=g(y)
# z=torch.mean((outputs-1)**2)
# z.backward()
# d.add_smoothing_branch()
# print (d(g(y,with_smoothing=True),with_smoothing=True))
from Network import Generator,Discriminator,PGGAN
# g=Generator(2,16,2)
# for i in range(1):
# g.add_smoothing_branch()
# g.add_layer(with_smoothing=True)
# g.add_smoothing_branch()
# d=Discriminator(2,16,0.5)
# for i in range(1):
# d.add_smoothing_branch()
# d.add_layer(with_smoothing=True)
# d.add_smoothing_branch()
# for i,j in zip(g.data_loader,d.data_loader):
# print (g(Variable(i),with_smoothing=True).size())
# print("##########################################")
# print (d(g(Variable(i),with_smoothing=True),with_smoothing=True).size())
# print("##########################################")
# # print (d(g(y)))
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
from utils import *
# Hyper Parameters
# num_epochs = 5
# batch_size = 100
# learning_rate = 0.001
pggan=PGGAN()
pggan.train()