MCPcopy Create free account
hub / github.com/pytorch/pytorch / __init__

Method __init__

caffe2/python/layers/dropout.py:13–31  ·  view source on GitHub ↗
(
            self,
            model,
            input_record,
            name='dropout',
            ratio=0.5,
            dropout_for_eval=False,
            **kwargs)

Source from the content-addressed store, hash-verified

11class Dropout(ModelLayer):
12
13 def __init__(
14 self,
15 model,
16 input_record,
17 name='dropout',
18 ratio=0.5,
19 dropout_for_eval=False,
20 **kwargs):
21
22 super().__init__(model, name, input_record, **kwargs)
23 assert isinstance(input_record, schema.Scalar), "Incorrect input type"
24 assert (ratio >= 0 and ratio < 1.0), \
25 "Expected 0 <= ratio < 1, but got ratio of %s" % ratio
26
27 self.output_schema = input_record.clone_schema()
28 self.output_schema.set_value(self.get_next_blob_reference('output'))
29 self.dropout_for_eval = dropout_for_eval
30
31 self.ratio = ratio
32
33 def _add_ops(self, net, is_test):
34 input_blob = self.input_record.field_blobs()

Callers

nothing calls this directly

Calls 4

isinstanceFunction · 0.85
clone_schemaMethod · 0.80
set_valueMethod · 0.45

Tested by

no test coverage detected