无法解析的外部符号 “public: long __cdecl at::Tensor::item<long>(void)const “ ($item@J@Tensor@at@@QEBAJXZ)

错误内容:

sigmoid_focal_loss_cuda.obj : error LNK2001: 无法解析的外部符号 "public: long __cdecl at::Tensor::item<long>(void)const " (??$item@J@Tensor@at@@QEBAJXZ)

背景:

在Windows环境下安装mmdetection,进行cuda编译的时候出现,解决方法是首先按照如下的博客进行修改

(53条消息) 记录自己在mmdetection配置中遇到的坑_疯花正猫的博客-CSDN博客

若依旧出现错误之后将mmdet\ops\sigmoid_focal_loss\src\cuda\sigmoid_focal_loss_cuda.cu文件下的long修改为double

参考如下代码进行修改

// modified from
// https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/maskrcnn_benchmark/csrc/cuda/SigmoidFocalLoss_cuda.cu

// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// This file is modified from
// https://github.com/pytorch/pytorch/blob/master/modules/detectron/sigmoid_focal_loss_op.cu
// Cheng-Yang Fu
// [email protected]
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>

#include <THC/THC.h>
#include <THC/THCAtomics.cuh>
#include <THC/THCDeviceUtils.cuh>

#include <cfloat>

int Ceil_div(int a, int b) { return (a + b - 1); }
// TODO make it in a common file
#define CUDA_1D_KERNEL_LOOP(i, n)                            \
  for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n; \
       i += blockDim.x * gridDim.x)

template <typename scalar_t>
//const int64_t *target-> const double *target
__global__ void SigmoidFocalLossForward(const int nthreads,
                                        const scalar_t *logits
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值