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

some problem about pse.cpp #26

Closed
ssxxx1a opened this issue Feb 12, 2020 · 6 comments
Closed

some problem about pse.cpp #26

ssxxx1a opened this issue Feb 12, 2020 · 6 comments

Comments

@ssxxx1a
Copy link

ssxxx1a commented Feb 12, 2020

谢谢大佬的分享,有一些疑问就是,在predict测试的时候,(model用resnet18的,mac os上测试)提示以下错误,不知能否给些意见? 0.0, best wishes!

pse.cpp:49:29: error: variable-sized object may not be initialized
        float kernel_vector[label_num][5] = {0};
                            ^~~~~~~~~
1 error generated.
make: *** [pse.so] Error 1
Traceback (most recent call last):
  File "/Users/abelleon/Documents/project/PAN.pytorch-master/predict.py", line 13, in <module>
    from post_processing import decode
  File "/Users/abelleon/Documents/project/PAN.pytorch-master/post_processing/__init__.py", line 17, in <module>
    raise RuntimeError('Cannot compile pse: {}'.format(BASE_DIR))
RuntimeError: Cannot compile pse: /Users/abelleon/Documents/project/PAN.pytorch-master/post_processing
@ssxxx1a
Copy link
Author

ssxxx1a commented Feb 12, 2020

在ubuntu 18上测试是可行,或许是mac和架构问题咯?

@ssxxx1a ssxxx1a closed this as completed Feb 25, 2020
@mrwu-mac
Copy link

我遇到了同样的问题,请问你解决了吗

@ssxxx1a
Copy link
Author

ssxxx1a commented Mar 2, 2020

我遇到了同样的问题,请问你解决了吗

我直接放到ubuntu上了就没有该问题。。。

@mrwu-mac
Copy link

mrwu-mac commented Mar 2, 2020

谢谢

@coldsummerday
Copy link

这个问题是macos 使用的是clang 编译器,不支持二维数组中第二维度为变量的数组初始化

@coldsummerday
Copy link

然后我把这个二维数组改为动态申请的形式:

float kernel_vector;
kernel_vector=(float)malloc(label_num* sizeof(float*));
for(int i = 0; i < label_num; i++)
{
*(kernel_vector+i) = (float *)malloc(sizeof(float)*5);//开辟列
}

函数最后free掉:
//释放kernel_vector
for(int i = 0; i < label_num;i++)
free(*(kernel_vector+i));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants