bigknight / deformable_conv2d_v2_tensorflow Goto Github PK
View Code? Open in Web Editor NEWdeformablt_conv2d layer implemented in tensorflow
deformablt_conv2d layer implemented in tensorflow
Hi, thank you for your sharing.
I'm considering using your codes to replace DCN v1.
Before that, I'd like to know what version of tensorflow, cuda and cudnn your codes are based on?
Because compatibility is important in our current project.
Thank you.
Hi, BIGKnight
I'm getting following error while compiling dcn.
deformable_conv2d.cu.cc:6:10: fatal error: tensorflow/core/util/cuda_kernel_helper.h: No such file or directory
6 | #include "tensorflow/core/util/cuda_kernel_helper.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h:189:66: warning: character constant too long for its type
189 | in_depth, " vs ", patch_depth, ' flag: ', flag));
| ^
In file included from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_base.h:21,
from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_handle.h:21,
from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/register_types.h:21,
from deformable_conv2d.h:4,
from deformable_conv2d.cc:2:
deformable_conv2d_utils.h: In function ‘tensorflow::Status tensorflow::ComputeDeformableConv2DDimension(const tensorflow::DeformableConv2DParameters&, const tensorflow::Tensor&, const tensorflow::Tensor&, tensorflow::DeformableConv2DDimensions*, int)’:
deformable_conv2d_utils.h:227:22: error: ‘GetWindowedOutputSizeV2’ was not declared in this scope
227 | TF_RETURN_IF_ERROR(GetWindowedOutputSizeV2(
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
128 | ::tensorflow::Status _status = (__VA_ARGS__); \
| ^~~~~~~~~~~
deformable_conv2d_utils.h:230:22: error: ‘GetWindowedOutputSizeV2’ was not declared in this scope
230 | TF_RETURN_IF_ERROR(GetWindowedOutputSizeV2(
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
128 | ::tensorflow::Status _status = (__VA_ARGS__); \
| ^~~~~~~~~~~
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h: At global scope:
deformable_conv2d_utils.h:269:9: error: ‘tensorflow::int64 tensorflow::{anonymous}::CublasScratchAllocator::GetMemoryLimitInBytes(tensorflow::{anonymous}::CublasScratchAllocator::Stream*)’ marked ‘override’, but does not override
269 | int64 GetMemoryLimitInBytes(Stream* stream) override { return -1; }
| ^~~~~~~~~~~~~~~~~~~~~
deformable_conv2d_utils.h:271:41: error: ‘tensorflow::StatusOr<stream_executor::DeviceMemory<unsigned char> > tensorflow::{anonymous}::CublasScratchAllocator::AllocateBytes(tensorflow::{anonymous}::CublasScratchAllocator::Stream*, tensorflow::int64)’ marked ‘override’, but does not override
271 | se::port::StatusOr<DeviceMemoryBytes> AllocateBytes(
| ^~~~~~~~~~~~~
In file included from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_base.h:21,
from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_handle.h:21,
from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/register_types.h:21,
from deformable_conv2d.h:4,
from deformable_conv2d.cc:2:
deformable_conv2d.cc: In lambda function:
deformable_conv2d.cc:139:32: error: ‘GetWindowedOutputSizeVerbose’ was not declared in this scope
139 | TF_RETURN_IF_ERROR(GetWindowedOutputSizeVerbose(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
128 | ::tensorflow::Status _status = (__VA_ARGS__); \
| ^~~~~~~~~~~
deformable_conv2d.cc:142:32: error: ‘GetWindowedOutputSizeVerbose’ was not declared in this scope
142 | TF_RETURN_IF_ERROR(GetWindowedOutputSizeVerbose(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
128 | ::tensorflow::Status _status = (__VA_ARGS__); \
| ^~~~~~~~~~~
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h: In instantiation of ‘static void tensorflow::LaunchBatchMatMul<Eigen::GpuDevice, Scalar>::launch(tensorflow::OpKernelContext*, const tensorflow::TensorShape&, const tensorflow::TensorShape&, const Scalar*, const Scalar*, bool, bool, Scalar*) [with Scalar = double]’:
deformable_conv2d.cc:511:49: required from ‘void tensorflow::DeformableConv2DBackPropOp<Device, T>::Compute(tensorflow::OpKernelContext*) [with Device = Eigen::GpuDevice; T = double]’
deformable_conv2d.cc:413:10: required from here
deformable_conv2d_utils.h:393:30: error: cannot declare variable ‘scratch_allocator’ to be of abstract type ‘tensorflow::{anonymous}::CublasScratchAllocator’
393 | CublasScratchAllocator scratch_allocator(context);
| ^~~~~~~~~~~~~~~~~
deformable_conv2d_utils.h:262:7: note: because the following virtual functions are pure within ‘tensorflow::{anonymous}::CublasScratchAllocator’:
262 | class CublasScratchAllocator : public se::ScratchAllocator {
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/stream_executor.h:31,
from deformable_conv2d_utils.h:7,
from deformable_conv2d.cc:8:
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/stream_executor/scratch_allocator.h:44:19: note: ‘virtual int64_t stream_executor::ScratchAllocator::GetMemoryLimitInBytes()’
44 | virtual int64_t GetMemoryLimitInBytes() = 0;
| ^~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/stream_executor/scratch_allocator.h:50:47: note: ‘virtual tensorflow::StatusOr<stream_executor::DeviceMemory<unsigned char> > stream_executor::ScratchAllocator::AllocateBytes(int64_t)’
50 | virtual port::StatusOr<DeviceMemory<uint8>> AllocateBytes(
| ^~~~~~~~~~~~~
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h: In instantiation of ‘static void tensorflow::LaunchBatchMatMul<Eigen::GpuDevice, Scalar>::launch(tensorflow::OpKernelContext*, const tensorflow::TensorShape&, const tensorflow::TensorShape&, const Scalar*, const Scalar*, bool, bool, Scalar*) [with Scalar = float]’:
deformable_conv2d.cc:511:49: required from ‘void tensorflow::DeformableConv2DBackPropOp<Device, T>::Compute(tensorflow::OpKernelContext*) [with Device = Eigen::GpuDevice; T = float]’
deformable_conv2d.cc:413:10: required from here
deformable_conv2d_utils.h:393:30: error: cannot declare variable ‘scratch_allocator’ to be of abstract type ‘tensorflow::{anonymous}::CublasScratchAllocator’
393 | CublasScratchAllocator scratch_allocator(context);
| ^~~~~~~~~~~~~~~~~
Any idea why ?
I'm using g++ 9.4.0 and here is my make.sh
#!/usr/bin/env bash
TF_CFLAGS=(-I/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include -D_GLIBCXX_USE_CXX11_ABI=0)
TF_LFLAGS=(-L/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow -llibtensorflow_framework)
CUDA_HOME=/usr/local/cuda
nvcc -std=c++14 -c -o deformable_conv2d.cu.o deformable_conv2d.cu.cc -I $CUDA_HOME -I /usr/local ${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -L $CUDA_HOME/lib64 --expt-relaxed-constexpr
g++ -std=c++14 -shared -o deformable_conv2d.so deformable_conv2d.cc deformable_conv2d.cu.o -L $CUDA_HOME/lib64 -I $CUDA_HOME/include -D GOOGLE_CUDA=1 ${TF_CFLAGS[@]} -fPIC -lcudart ${TF_LFLAGS[@]}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.