Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix python3 compability for unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
shesung committed Dec 25, 2018
1 parent 1e6b118 commit 70fe2cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/python/unittest/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

# pylint: skip-file
from __future__ import print_function
from __future__ import division
import numpy as np
import mxnet as mx
import copy
Expand Down Expand Up @@ -6905,7 +6906,7 @@ def roialign_forward_backward(data, rois, pooled_size, spatial_scale, sampling_r
assert len(rois.shape) == 2
assert rois.shape[1] == 5

C_out = C / PH / PW if position_sensitive else C
C_out = C // PH // PW if position_sensitive else C
out = np.zeros((R, C_out, PH, PW))
dx = np.zeros_like(data)
drois = np.zeros_like(rois)
Expand Down Expand Up @@ -6968,7 +6969,7 @@ def test_roi_align_value(sampling_ratio=0, position_sensitive=False):
output = mx.nd.contrib.ROIAlign(data, rois, pooled_size=pooled_size,
spatial_scale=spatial_scale, sample_ratio=sampling_ratio,
position_sensitive=position_sensitive)
C_out = C / pooled_size[0] / pooled_size[1] if position_sensitive else C
C_out = C // pooled_size[0] // pooled_size[1] if position_sensitive else C
dy = mx.nd.random.uniform(-1, 1, (R, C_out) + pooled_size, ctx=ctx, dtype = dtype)
output.backward(dy)
real_output, [dx, drois] = roialign_forward_backward(data.asnumpy(), rois.asnumpy(), pooled_size,
Expand Down

0 comments on commit 70fe2cc

Please sign in to comment.