Skip to content

Fix pointer to contiguous data in quantized roi_align #3904

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

Merged
merged 2 commits into from
May 24, 2021
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
8 changes: 6 additions & 2 deletions torchvision/csrc/ops/quantized/cpu/qroi_align_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ void qroi_align_forward_kernel_impl(
bool aligned,
const at::Tensor& t_rois,
T* output) {
const T* input = t_input.contiguous().data_ptr<T>();
// Don't delete these otherwise the .data_ptr() data might be undefined
auto t_input_cont = t_input.contiguous();
auto t_rois_cont = t_rois.contiguous();

const T* input = t_input_cont.data_ptr<T>();
int64_t input_zp = t_input.q_zero_point();
float input_scale = t_input.q_scale();

const T* rois = t_rois.contiguous().data_ptr<T>();
const T* rois = t_rois_cont.data_ptr<T>();
int64_t rois_zp = t_rois.q_zero_point();
float rois_scale = t_rois.q_scale();

Expand Down