推力转换不适用于不同的输入和输出类型

时间:2019-05-28 06:48:36

标签: c++ cuda thrust

我正在尝试在CUDA8.0上编译一些CUDA /推力代码,并遇到一些编译错误。

我已经在cuda10上成功尝试过,但是在cuda-8.0上失败了。

  thrust::transform(thrust::device, indices, indices + num_detections,thrust::make_zip_iterator(thrust::make_tuple(out_scores,out_boxes, out_classes)),

  [=] __device__ (int i) {
    int x = i % width;
    int y = (i / width) % height;
    int a = (i / num_classes / height / width) % num_anchors;
    int cls = (i / height / width) % num_classes;

    float4 box = float4{
      in_boxes[((a * 4 + 0) * height + y) * width + x],
      in_boxes[((a * 4 + 1) * height + y) * width + x],
      in_boxes[((a * 4 + 2) * height + y) * width + x],
      in_boxes[((a * 4 + 3) * height + y) * width + x]
    };

    if (has_anchors) {
      // Add anchors offsets to deltas
      float x = (i % width) * scale;
      float y = ((i / width)  % height) * scale;
      float *d = anchors_d + 4*a;

      float x1 = x + d[0];
      float y1 = y + d[1];
      float x2 = x + d[2];
      float y2 = y + d[3];
      float w = x2 - x1 + 1.0f;
      float h = y2 - y1 + 1.0f;
      float pred_ctr_x = box.x * w + x1 + 0.5f * w;
      float pred_ctr_y = box.y * h + y1 + 0.5f * h;
      float pred_w = exp(box.z) * w;
      float pred_h = exp(box.w) * h;

      box = float4{
        max(0.0f, pred_ctr_x - 0.5f * pred_w),
        max(0.0f, pred_ctr_y - 0.5f * pred_h),
        min(pred_ctr_x + 0.5f * pred_w - 1.0f, width * scale - 1.0f),
        min(pred_ctr_y + 0.5f * pred_h - 1.0f, height * scale - 1.0f)
      };
    }

    return thrust::make_tuple(in_scores[i], box, cls);
  });

错误消息(第一部分)是:

  

/usr/local/cuda/include/thrust/detail/internal_functional.h:322:21:错误:“ operator =”不匹配(操作数类型为“ thrust :: detail :: tuple_of_iterator_references”和“ int” )        推力:: get <1>(t)= f(推力:: get <0>(t));

0 个答案:

没有答案