def _get_pixel(n, c, y, x): y = tvm.max(tvm.min(y, in_h - 1), 0) x = tvm.max(tvm.min(x, in_w - 1), 0) return grad(n, c, y, x).astype('float')
def topi_nn_relu6(x): """topi nn relu6.""" return tvm.compute( x.shape, lambda *i: tvm.min(tvm.max(x(*i), tvm.const(0, x.dtype)), tvm.const(6, x.dtype)))