()
| 107 | return (y, x) |
| 108 | |
| 109 | def _nearest_sample(): |
| 110 | for _b in range(batch): |
| 111 | for _c in range(channel): |
| 112 | for _h in range(out_height): |
| 113 | for _w in range(out_width): |
| 114 | y, x = _compute_source_index(_b, _h, _w) |
| 115 | # python round is not used here, |
| 116 | # beacause it is done toward the even choice |
| 117 | new_y = int(y + 0.5) if y > 0 else int(y - 0.5) |
| 118 | new_x = int(x + 0.5) if x > 0 else int(x - 0.5) |
| 119 | out[_b, _c, _h, _w] = _get_pixel(_b, _c, new_y, new_x) |
| 120 | |
| 121 | def _bilinear_sample(): |
| 122 | for _b in range(batch): |
no test coverage detected
searching dependent graphs…