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

Function _ShouldInclude

caffe2/python/caffe_translator.py:39–47  ·  view source on GitHub ↗

A function that reproduces Caffe's inclusion and exclusion rule.

(net_state, layer)

Source from the content-addressed store, hash-verified

37
38
39def _ShouldInclude(net_state, layer):
40 """A function that reproduces Caffe's inclusion and exclusion rule."""
41 ret = (len(layer.include) == 0)
42 # check exclude rules: if any exclusion is met, we shouldn't include.
43 ret &= not any([_StateMeetsRule(net_state, rule) for rule in layer.exclude])
44 if len(layer.include):
45 # check include rules: if any inclusion is met, we should include.
46 ret |= any([_StateMeetsRule(net_state, rule) for rule in layer.include])
47 return ret
48
49
50def _GetLegacyDims(net, net_params, dummy_input, legacy_pad_ops):

Callers 1

TranslateModelMethod · 0.85

Calls 2

_StateMeetsRuleFunction · 0.85
anyFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…