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

Class Dropout

tensorlayer/layers/dropout.py:17–60  ·  view source on GitHub ↗

The :class:`Dropout` class is a noise layer which randomly set some activations to zero according to a keeping probability. Parameters ---------- keep : float The keeping probability. The lower the probability it is, the more activations are set to zero. see

Source from the content-addressed store, hash-verified

15
16
17class Dropout(Layer):
18 """
19 The :class:`Dropout` class is a noise layer which randomly set some
20 activations to zero according to a keeping probability.
21
22 Parameters
23 ----------
24 keep : float
25 The keeping probability.
26 The lower the probability it is, the more activations are set to zero.
27 seed : int or None
28 The seed for random dropout.
29 name : None or str
30 A unique layer name.
31
32 """
33
34 def __init__(self, keep, seed=None, name=None): #"dropout"):
35 super(Dropout, self).__init__(name)
36 self.keep = keep
37 self.seed = seed
38
39 self.build()
40 self._built = True
41
42 logging.info("Dropout %s: keep: %f " % (self.name, self.keep))
43
44 def __repr__(self):
45 s = ('{classname}(keep={keep}')
46 if self.name is not None:
47 s += ', name=\'{name}\''
48 s += ')'
49 return s.format(classname=self.__class__.__name__, **self.__dict__)
50
51 def build(self, inputs_shape=None):
52 pass
53
54 # @tf.function
55 def forward(self, inputs):
56 if self.is_train:
57 outputs = tf.nn.dropout(inputs, rate=1 - (self.keep), seed=self.seed, name=self.name)
58 else:
59 outputs = inputs
60 return outputs

Callers 15

SqueezeNetV1Function · 0.90
create_base_networkFunction · 0.90
hidden_modelFunction · 0.90
get_modelFunction · 0.90
__init__Method · 0.90
get_modelFunction · 0.90
__init__Method · 0.90
setUpClassMethod · 0.85
get_modelMethod · 0.85
get_unstack_modelMethod · 0.85
__init__Method · 0.85
MyModelMethod · 0.85

Calls

no outgoing calls

Tested by 7

setUpClassMethod · 0.68
get_modelMethod · 0.68
get_unstack_modelMethod · 0.68
__init__Method · 0.68
MyModelMethod · 0.68
get_modelFunction · 0.68
create_base_networkFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…