()
| 72 | |
| 73 | |
| 74 | def _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 | |
| 101 | def _patch_float_precision(digits): |
no test coverage detected