forked from tensorlayer/TensorLayer
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_layers_noise.py
44 lines (27 loc) · 1.02 KB
/
test_layers_noise.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from tests.utils import CustomTestCase
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
class Layer_Convolution_1D_Test(CustomTestCase):
@classmethod
def setUpClass(cls):
print("\n#################################")
cls.batch_size = 8
cls.inputs_shape = [cls.batch_size, 200]
cls.input_layer = Input(cls.inputs_shape, name='input_layer')
cls.dense = tl.layers.Dense(n_units=100, act=tf.nn.relu, in_channels=200)(cls.input_layer)
cls.noiselayer = tl.layers.GaussianNoise(name='gaussian')(cls.dense)
print("Testing GaussianNoise: \n", cls.noiselayer._info[0].layer)
@classmethod
def tearDownClass(cls):
pass
def test_layer_n1(self):
self.assertEqual(self.noiselayer.get_shape().as_list()[1:], [100])
if __name__ == '__main__':
tl.logging.set_verbosity(tl.logging.DEBUG)
unittest.main()