MCPcopy
hub / github.com/tensorlayer/TensorLayer / Flatten

Class Flatten

tensorlayer/layers/shape.py:19–58  ·  view source on GitHub ↗

A layer that reshapes high-dimension input into a vector. Then we often apply Dense, RNN, Concat and etc on the top of a flatten layer. [batch_size, mask_row, mask_col, n_mask] ---> [batch_size, mask_row * mask_col * n_mask] Parameters ---------- name : None or str A un

Source from the content-addressed store, hash-verified

17
18
19class Flatten(Layer):
20 """A layer that reshapes high-dimension input into a vector.
21
22 Then we often apply Dense, RNN, Concat and etc on the top of a flatten layer.
23 [batch_size, mask_row, mask_col, n_mask] ---> [batch_size, mask_row * mask_col * n_mask]
24
25 Parameters
26 ----------
27 name : None or str
28 A unique layer name.
29
30 Examples
31 --------
32 >>> x = tl.layers.Input([8, 4, 3], name='input')
33 >>> y = tl.layers.Flatten(name='flatten')(x)
34 [8, 12]
35
36 """
37
38 def __init__(self, name=None): #'flatten'):
39 super(Flatten, self).__init__(name)
40
41 self.build()
42 self._built = True
43
44 logging.info("Flatten %s:" % (self.name))
45
46 def __repr__(self):
47 s = '{classname}('
48 s += 'name=\'{name}\''
49 s += ')'
50 return s.format(classname=self.__class__.__name__, **self.__dict__)
51
52 def build(self, inputs_shape=None):
53 pass
54
55 # @tf.function
56 def forward(self, inputs):
57 outputs = flatten_reshape(inputs, name=self.name)
58 return outputs
59
60
61class Reshape(Layer):

Callers 15

MobileNetV1Function · 0.90
make_layersFunction · 0.90
get_modelFunction · 0.90
get_model_batchnormFunction · 0.90
create_base_networkFunction · 0.90
modelFunction · 0.90
modelFunction · 0.90
modelFunction · 0.90
modelFunction · 0.90
binary_modelFunction · 0.90
modelFunction · 0.90
dorefanet_modelFunction · 0.90

Calls

no outgoing calls

Tested by 11

basic_static_modelFunction · 0.68
__init__Method · 0.68
get_unstack_modelMethod · 0.68
get_modelMethod · 0.68
basic_static_modelFunction · 0.68
__init__Method · 0.68
basic_static_modelFunction · 0.68
__init__Method · 0.68
basic_static_modelFunction · 0.68
create_base_networkFunction · 0.68
__init__Method · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…