Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ROI input array to native #681

Merged
merged 2 commits into from
Sep 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions runtime/ops/roi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,26 +429,22 @@ class ReduceByAverage {

chainerx::Array ROIMaxPool2DOp::RunImpl(
ChxVMState* st, const chainerx::Array& x, const chainerx::Array& rois, const chainerx::Array& roi_indices) {
CHECK(!IsCudaDevice(&x.device())) << "Not implemented";
return ROIPool2D(x, rois, roi_indices, output_shape, spatial_scale, chainerx::AMax);
return ROIPool2D(x.ToNative(), rois, roi_indices, output_shape, spatial_scale, chainerx::AMax).ToDevice(x.device());
}

chainerx::Array ROIAveragePool2DOp::RunImpl(
ChxVMState* st, const chainerx::Array& x, const chainerx::Array& rois, const chainerx::Array& roi_indices) {
CHECK(!IsCudaDevice(&x.device())) << "Not implemented";
return ROIPool2D(x, rois, roi_indices, output_shape, spatial_scale, chainerx::Mean);
return ROIPool2D(x.ToNative(), rois, roi_indices, output_shape, spatial_scale, chainerx::Mean).ToDevice(x.device());
}

chainerx::Array ROIMaxAlign2DOp::RunImpl(
ChxVMState* st, const chainerx::Array& x, const chainerx::Array& rois, const chainerx::Array& roi_indices) {
CHECK(!IsCudaDevice(&x.device())) << "Not implemented";
return ROIAlign2D<ReduceByMax>(x, rois, roi_indices, output_shape, spatial_scale, sampling_ratio);
return ROIAlign2D<ReduceByMax>(x.ToNative(), rois, roi_indices, output_shape, spatial_scale, sampling_ratio).ToDevice(x.device());
}

chainerx::Array ROIAverageAlign2DOp::RunImpl(
ChxVMState* st, const chainerx::Array& x, const chainerx::Array& rois, const chainerx::Array& roi_indices) {
CHECK(!IsCudaDevice(&x.device())) << "Not implemented";
return ROIAlign2D<ReduceByAverage>(x, rois, roi_indices, output_shape, spatial_scale, sampling_ratio);
return ROIAlign2D<ReduceByAverage>(x.ToNative(), rois, roi_indices, output_shape, spatial_scale, sampling_ratio).ToDevice(x.device());
}

} // namespace runtime
Expand Down