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

Solving an error of 'undefined symbol' when tools/demo.py is running #353

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions lib/make.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')

CUDA_PATH=/usr/local/cuda/
CXXFLAGS=''
Expand All @@ -11,15 +12,18 @@ cd roi_pooling_layer

if [ -d "$CUDA_PATH" ]; then
nvcc -std=c++11 -c -o roi_pooling_op.cu.o roi_pooling_op_gpu.cu.cc \
-I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CXXFLAGS \
-I $TF_INC -L $TF_LIB -ltensorflow_framework \
-DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CXXFLAGS \
-arch=sm_37

g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
roi_pooling_op.cu.o -I $TF_INC -D GOOGLE_CUDA=1 -fPIC $CXXFLAGS \
roi_pooling_op.cu.o -I $TF_INC -L $TF_LIB \
-ltensorflow_framework -DGOOGLE_CUDA=1 -fPIC $CXXFLAGS \
-lcudart -L $CUDA_PATH/lib64
else
g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
-I $TF_INC -fPIC $CXXFLAGS
-I $TF_INC -L $TF_LIB -ltensorflow_framework \
-DGOOGLE_CUDA=0 -fPIC $CXXFLAGS
fi

cd ..
Expand Down
Binary file removed lib/networks/.VGGnet.py.swo
Binary file not shown.
5 changes: 4 additions & 1 deletion lib/roi_pooling_layer/roi_pooling_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class RoiPoolOp : public OpKernel {
float spatial_scale_;
};

#if GOOGLE_CUDA
bool ROIPoolForwardLaucher(
const float* bottom_data, const float spatial_scale, const int num_rois, const int height,
const int width, const int channels, const int pooled_height,
Expand Down Expand Up @@ -290,6 +291,7 @@ class RoiPoolOp<Eigen::GpuDevice, T> : public OpKernel {
int pooled_width_;
float spatial_scale_;
};
#endif

// compute gradient
template <class Device, class T>
Expand Down Expand Up @@ -456,6 +458,7 @@ class RoiPoolGradOp : public OpKernel {
float spatial_scale_;
};

#if GOOGLE_CUDA
bool ROIPoolBackwardLaucher(const float* top_diff, const float spatial_scale, const int batch_size, const int num_rois,
const int height, const int width, const int channels, const int pooled_height,
const int pooled_width, const float* bottom_rois,
Expand All @@ -480,7 +483,6 @@ static void RoiPoolingGradKernel(
output->flat<float>().data(), argmax_data->flat<int>().data(), context->eigen_device<Eigen::GpuDevice>());
}


template <class T>
class RoiPoolGradOp<Eigen::GpuDevice, T> : public OpKernel {
public:
Expand Down Expand Up @@ -552,6 +554,7 @@ class RoiPoolGradOp<Eigen::GpuDevice, T> : public OpKernel {
int pooled_width_;
float spatial_scale_;
};
#endif

REGISTER_KERNEL_BUILDER(Name("RoiPool").Device(DEVICE_CPU).TypeConstraint<float>("T"), RoiPoolOp<CPUDevice, float>);
REGISTER_KERNEL_BUILDER(Name("RoiPoolGrad").Device(DEVICE_CPU).TypeConstraint<float>("T"), RoiPoolGradOp<CPUDevice, float>);
Expand Down