You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_layers_noise.py 947 B

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import unittest
  5. os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
  6. import tensorlayer as tl
  7. from tensorlayer.layers import *
  8. from tests.utils import CustomTestCase
  9. class Layer_Convolution_1D_Test(CustomTestCase):
  10. @classmethod
  11. def setUpClass(cls):
  12. print("\n#################################")
  13. cls.batch_size = 8
  14. cls.inputs_shape = [cls.batch_size, 200]
  15. cls.input_layer = Input(cls.inputs_shape, name='input_layer')
  16. cls.dense = tl.layers.Dense(n_units=100, act=tl.ReLU, in_channels=200)(cls.input_layer)
  17. cls.noiselayer = tl.layers.GaussianNoise(name='gaussian')(cls.dense)
  18. @classmethod
  19. def tearDownClass(cls):
  20. pass
  21. def test_layer_n1(self):
  22. self.assertEqual(self.noiselayer.get_shape().as_list()[1:], [100])
  23. if __name__ == '__main__':
  24. # tl.logging.set_verbosity(tl.logging.DEBUG)
  25. unittest.main()

TensorLayer3.0 是一款兼容多种深度学习框架为计算后端的深度学习库。计划兼容TensorFlow, Pytorch, MindSpore, Paddle.