Check whether x contains y. The purpose of identifying "." is to accurately match operator documents. For example, if we make pos = x.find(y) while y = clip_, either oneflow.Tensor.clip or oneflow.Tensor.clip_ is right. Besides, identifying "_" is important. For example, if we
(x, y)
| 155 | |
| 156 | |
| 157 | def pure_match(x, y): |
| 158 | """ |
| 159 | Check whether x contains y. |
| 160 | |
| 161 | The purpose of identifying "." is to accurately match operator documents. |
| 162 | For example, if we make pos = x.find(y) while y = clip_, either oneflow.Tensor.clip or oneflow.Tensor.clip_ is right. |
| 163 | |
| 164 | Besides, identifying "_" is important. |
| 165 | For example, if we make pos = x.find(y) while y = squeeze, either test of squeeze or unsqueeze is right. |
| 166 | """ |
| 167 | x = x.lower() |
| 168 | y = y.lower() |
| 169 | pos = -1 |
| 170 | if "." in x: |
| 171 | x = x.split(".") |
| 172 | for i in x: |
| 173 | if i == y: |
| 174 | pos = 1 |
| 175 | break |
| 176 | elif "_" in y: |
| 177 | pos = x.find(y) |
| 178 | else: |
| 179 | x = x.split("_") |
| 180 | for i in x: |
| 181 | if i == y: |
| 182 | pos = 1 |
| 183 | break |
| 184 | return pos != -1 |
| 185 | |
| 186 | |
| 187 | def match_test_func(func, func_list): |
no test coverage detected