forked from xiaowei-hu/CycleGAN-tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.py
89 lines (73 loc) · 2.49 KB
/
test.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
import tensorflow as tf
# a = tf.Variable(tf.random_normal([2,3,4,5]))
# b,c = tf.nn.moments(a,axes=[0,1],keep_dims=False)
# with tf.Session() as sess:
# tf.global_variables_initializer().run()
# print(sess.run([b,c]))
# scale = tf.get_variable("scale", [2], initializer=tf.random_normal_initializer(1.0, 0.02, dtype=tf.float32))
# a = scale.get_shape() # a.get_shape()中a的数据类型只能是tensor,且返回的是一个元组
# b = tf.shape(scale)
# with tf.Session() as sess:
# tf.global_variables_initializer().run()
# print(sess.run(b))
# input = tf.Variable(tf.random_uniform((30,256,256,3)))
# a = tf.contrib.slim.conv2d(input, 64, 3, 2, padding='SAME', activation_fn=None,
# weights_initializer=tf.truncated_normal_initializer(stddev=0.02),
# biases_initializer=None)
# with tf.Session() as sess:
# tf.global_variables_initializer().run()
# print(sess.run(tf.shape(input)))
# sess.run(a)
# print(sess.run(tf.shape(a)))
# class Args_l(object):
# __slots__ = ('dataset_dir', 'epoch','epoch_step','batch_size','train_size','load_size','fine_size','ngf',
# 'ndf','input_nc', 'output_nc','lr','beta1','which_direction','phase','save_freq','print_freq',
# 'continue_train','checkpoint_dir','sample_dir','test_dir','L1_lambda','use_resnet','use_lsgan',
# 'max_size')
# def __init__(self):
# self.dataset_dir = 'horse2zebra'
#
# def
# class Student():
# # def __init__(self):
# # pass
# @property
# def score(self):
# return self._score
# @score.setter
# def score(self,value):
# if not isinstance(value,int):
# raise ValueError('score must be an integer!')
# if value<0 or value>100 :
# raise ValueError('value must between 0~100')
# self._score = value
#
# a = Student()
# a.score = 90
# print(a.score)
# a.score = 110
# print(a.score)
class Screen(object):
@property
def width(self):
return self._width
@width.setter
def width(self,width):
self._width = width
@property
def height(self):
return self._height
@height.setter
def height(self, height):
self._height = height
@property
def resolution(self):
return self._width*self._height
s = Screen()
s.width = 1024
s.height = 768
print('resolution =', s.resolution)
if s.resolution == 786432:
print('测试通过!')
else:
print('测试失败!')