-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathtest_layers_extend.py
More file actions
42 lines (29 loc) · 873 Bytes
/
test_layers_extend.py
File metadata and controls
42 lines (29 loc) · 873 Bytes
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
import tensorflow as tf
import tensorlayer as tl
from tests.utils import CustomTestCase
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
class Layer_Extend_Test(CustomTestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def test_expand_dims(self):
x = tl.layers.Input([8, 3])
expandlayer = tl.layers.ExpandDims(axis=-1)
y = expandlayer(x)
print(expandlayer)
self.assertEqual(y.get_shape().as_list(), [8, 3, 1])
def test_tile(self):
x = tl.layers.Input([8, 3])
tilelayer = tl.layers.Tile(multiples=[2, 3])
y = tilelayer(x)
print(tilelayer)
self.assertEqual(y.get_shape().as_list(), [16, 9])
if __name__ == '__main__':
unittest.main()