MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _patch_tensor_place

Function _patch_tensor_place

tools/sampcd_processor.py:74–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72
73
74def _patch_tensor_place():
75 from xdoctest import checker
76
77 pattern_tensor = re.compile(
78 r"""
79 (Tensor\(.*?place=) # Tensor start
80 (.*?) # Place=(XXX)
81 (\,.*?\))
82 """,
83 re.VERBOSE | re.DOTALL,
84 )
85
86 _check_output = checker.check_output
87
88 def check_output(got, want, runstate=None):
89 if not want: # nocover
90 return True
91
92 return _check_output(
93 got=pattern_tensor.sub(r'\1Place(cpu)\3', got),
94 want=pattern_tensor.sub(r'\1Place(cpu)\3', want),
95 runstate=runstate,
96 )
97
98 checker.check_output = check_output
99
100
101def _patch_float_precision(digits):

Callers 1

_patch_xdoctestMethod · 0.85

Calls 1

compileMethod · 0.45

Tested by

no test coverage detected