diff --git a/lib/make.sh b/lib/make.sh index 15a616bc..1642ded4 100755 --- a/lib/make.sh +++ b/lib/make.sh @@ -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='' @@ -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 .. diff --git a/lib/networks/.VGGnet.py.swo b/lib/networks/.VGGnet.py.swo deleted file mode 100644 index 4ef48986..00000000 Binary files a/lib/networks/.VGGnet.py.swo and /dev/null differ diff --git a/lib/roi_pooling_layer/roi_pooling_op.cc b/lib/roi_pooling_layer/roi_pooling_op.cc index 68ce66a8..5fcb467b 100644 --- a/lib/roi_pooling_layer/roi_pooling_op.cc +++ b/lib/roi_pooling_layer/roi_pooling_op.cc @@ -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, @@ -290,6 +291,7 @@ class RoiPoolOp : public OpKernel { int pooled_width_; float spatial_scale_; }; +#endif // compute gradient template @@ -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, @@ -480,7 +483,6 @@ static void RoiPoolingGradKernel( output->flat().data(), argmax_data->flat().data(), context->eigen_device()); } - template class RoiPoolGradOp : public OpKernel { public: @@ -552,6 +554,7 @@ class RoiPoolGradOp : public OpKernel { int pooled_width_; float spatial_scale_; }; +#endif REGISTER_KERNEL_BUILDER(Name("RoiPool").Device(DEVICE_CPU).TypeConstraint("T"), RoiPoolOp); REGISTER_KERNEL_BUILDER(Name("RoiPoolGrad").Device(DEVICE_CPU).TypeConstraint("T"), RoiPoolGradOp);