> For example,
> 
> x = mx.nd.array([[[[ 0., 1., 2., 3., 4., 5.],
> [ 6., 7., 8., 9., 10., 11.],
> [ 12., 13., 14., 15., 16., 17.],
> [ 18., 19., 20., 21., 22., 23.],
> [ 24., 25., 26., 27., 28., 29.],
> [ 30., 31., 32., 33., 34., 35.],
> [ 36., 37., 38., 39., 40., 41.],
> [ 42., 43., 44., 45., 46., 47.]]]])
> y = mx.nd.array([[0,0,0,3,3]])
> mx.nd.ROIAlign(x, y, (2, 2), 0.7) should be:
> 
> [[[[3,5, 5.5],
> [15.5, 17.5]]]]
> 
> while the output is:
> [[[[5.25, 6.75],
> [14.25, 15.75]]]]

@eli2014: could you please justify why the result should be
[[[[3,5, 5.5],
[15.5, 17.5]]]]
?

We tried your example with MXNet(1.3.1) and Caffe2 (0.8) and we get the same 
result from both frameworks, which is different from your output. Please 
provide more details on your test environment, like MXNet version, etc. for 
easier debugging.

**MXNet:**

```
>>> import mxnet as nx
>>> x = mx.nd.array([[[[ 0., 1., 2., 3., 4., 5.],
... [ 6., 7., 8., 9., 10., 11.],
... [ 12., 13., 14., 15., 16., 17.],
... [ 18., 19., 20., 21., 22., 23.],
... [ 24., 25., 26., 27., 28., 29.],
... [ 30., 31., 32., 33., 34., 35.],
... [ 36., 37., 38., 39., 40., 41.],
... [ 42., 43., 44., 45., 46., 47.]]]])
>>> y = mx.nd.array([[0,0,0,3,3]])
>>> mx.nd.contrib.ROIAlign(x, y, (2, 2), 0.7)

[[[[ 3.6749997  4.725    ]
   [ 9.974999  11.025    ]]]]
<NDArray 1x1x2x2 @cpu(0)>
```
**Caffe2**
```
>>> from caffe2.python import core, workspace
WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU 
only mode.
>>> import numpy as np
>>> x = np.array([[[[ 0., 1., 2., 3., 4., 5.],
... [ 6., 7., 8., 9., 10., 11.],
... [ 12., 13., 14., 15., 16., 17.],
... [ 18., 19., 20., 21., 22., 23.],
... [ 24., 25., 26., 27., 28., 29.],
... [ 30., 31., 32., 33., 34., 35.],
... [ 36., 37., 38., 39., 40., 41.],
... [ 42., 43., 44., 45., 46., 47.]]]]).astype(np.float32)
>>> r = np.array([[0,0,0,3,3]]).astype(np.float32)
>>> op = core.CreateOperator("RoIAlign", ["d", "r"], ["o"], pooled_h=2, 
>>> pooled_w=2,spatial_scale=0.7)
>>> workspace.FeedBlob("d", x)
True
>>> workspace.FeedBlob("r", r)
True
>>> workspace.RunOperatorOnce(op)
WARNING: Logging before InitGoogleLogging() is written to STDERR
W0925 15:35:07.264453 2926322560 init.h:99] Caffe2 GlobalInit should be run 
before any other API calls.
True
>>> workspace.FetchBlob("o")
array([[[[ 3.6749997,  4.725    ],
         [ 9.974999 , 11.025    ]]]], dtype=float32)
```



[ Full content available at: 
https://github.com/apache/incubator-mxnet/issues/12403 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to