vinx13 commented on issue #4471: [topi python API] 'bilinear_sample_nchw' is 
not supported in deformable_conv2d.py
URL: https://github.com/apache/incubator-tvm/issues/4471#issuecomment-563350206
 
 
   > > Could you verify if it works? If so, we may close this issue for now.
   > 
   > I replaced 'bilinear_sample_nchw' with 'resize', and work well.
   > Here is the git diff context:
   > `diff --git a/topi/python/topi/nn/deformable_conv2d.py 
b/topi/python/topi/nn/deformable_conv2d.py
   > index fb05016..adb839d 100644
   > --- a/topi/python/topi/nn/deformable_conv2d.py
   > +++ b/topi/python/topi/nn/deformable_conv2d.py
   > @@ -20,7 +20,7 @@ import tvm
   > 
   > from .util import get_pad_tuple
   > from ..util import get_const_tuple
   > -from ..cpp.image import bilinear_sample_nchw
   > +from ..image.resize import resize
   > 
   > @tvm.target.generic_func
   > def deformable_conv2d_nchw(data, offset, kernel, strides, padding, 
dilation, deformable_groups,
   > @@ -94,7 +94,7 @@ def deformable_conv2d_nchw(data, offset, kernel, 
strides, padding, dilation, def
   > 
   > ```
   >  def _bilinear(n, c, h, w):
   >      outside = tvm.any(h < 0, w < 0, h >= in_height, w >= in_width)
   > ```
   > 
   > * ```
   >      val = bilinear_sample_nchw(data, (n, c, h, w), in_height - 1, 
in_width - 1)
   >   ```
   > 
   > * ```
   >      val = resize(data, (n, c, h, w))
   >      return tvm.if_then_else(outside, zero, val)
   >   ```
   >   
   >   
   >   data_deform = 
   >   diff --git a/topi/python/topi/vision/rcnn/roi_align.py 
b/topi/python/topi/vision/rcnn/roi_align.py
   >   index c861ddd..b009d01 100644
   >   --- a/topi/python/topi/vision/rcnn/roi_align.py
   >   +++ b/topi/python/topi/vision/rcnn/roi_align.py
   >   @@ -18,7 +18,7 @@
   >   """Roi align operator"""
   >   import tvm
   >   from ...util import get_const_tuple
   >   -from ...cpp.image import bilinear_sample_nchw
   >   +from ...image.resize import resize
   > 
   > @tvm.target.generic_func
   > @@ -62,7 +62,7 @@ def roi_align_nchw(data, rois, pooled_size, 
spatial_scale, sample_ratio=-1):
   > outside = tvm.any(y < -1.0, x < -1.0, y > height, x > width)
   > y = tvm.max(y, 0.0)
   > x = tvm.max(x, 0.0)
   > 
   > * ```
   >      val = bilinear_sample_nchw(data, (i, c, y, x), height - 1, width - 1)
   >   ```
   > 
   > * ```
   >      val = resize(data, (i, c, y, x))
   >      return tvm.if_then_else(outside, 0.0, val)
   >   ```
   >   
   >   
   >   def _sample(i, c, ph, pw):`
   
   The problem is that cpp lib can not be found in the path, this workaround 
doesn't solve the problem. On the other way, I believe this issue is in the 
latest master

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to