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

error: explicitly instantiated more than once #11

Open
XYZ-916 opened this issue Jan 8, 2019 · 8 comments
Open

error: explicitly instantiated more than once #11

XYZ-916 opened this issue Jan 8, 2019 · 8 comments

Comments

@XYZ-916
Copy link

XYZ-916 commented Jan 8, 2019

When I ran "sh build.sh", I got errors as follows:

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(114): error: function "LatticeFilter<GPUDevice, T, pd, vd>::compute_position_vectors [with T=float, pd=6, vd=4]" explicitly instantiated more than once

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(114): error: function "LatticeFilter<GPUDevice, T, pd, vd>::filter [with T=float, pd=6, vd=4]" explicitly instantiated more than once

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(114): error: function "LatticeFilter<GPUDevice, T, pd, vd>::operator() [with T=float, pd=6, vd=4]" explicitly instantiated more than once

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(115): error: function "LatticeFilter<GPUDevice, T, pd, vd>::LatticeFilter(tensorflow::OpKernelContext *, int, int, int, int, int *, const T *, const T *, __nv_bool) [with T=double, pd=6, vd=4]" explicitly instantiated more than once

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(115): error: function "LatticeFilter<GPUDevice, T, pd, vd>::compute_position_vectors [with T=double, pd=6, vd=4]" explicitly instantiated more than once

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(115): error: function "LatticeFilter<GPUDevice, T, pd, vd>::filter [with T=double, pd=6, vd=4]" explicitly instantiated more than once

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(115): error: function "LatticeFilter<GPUDevice, T, pd, vd>::operator() [with T=double, pd=6, vd=4]" explicitly instantiated more than once

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(69): error: type name is not allowed

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(69): error: nonstandard form for taking the address of a member function

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(69): error: expected an expression

CRFasRNNLayer/permutohedral_lattice/src/LatticeFilterKernel.cu(76): warning: parsing restarts here after previous syntax error

11 errors detected in the compilation of "/tmp/tmpxft_0000064d_00000000-6_LatticeFilterKernel.cpp1.ii".
CMakeFiles/lattice_filter.dir/build.make:75: recipe for target 'CMakeFiles/lattice_filter.dir/src/LatticeFilterKernel.cu.o' failed
make[2]: *** [CMakeFiles/lattice_filter.dir/src/LatticeFilterKernel.cu.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/lattice_filter.dir/all' failed
make[1]: *** [CMakeFiles/lattice_filter.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

And ideas about the problem? Thank you !

@XYZ-916 XYZ-916 changed the title explicitly instantiated more than once error: explicitly instantiated more than once Jan 8, 2019
@MiguelMonteiro
Copy link
Owner

Are you just using the compilation script as is or did you make any changes?

@XYZ-916
Copy link
Author

XYZ-916 commented Jan 9, 2019

I made small changes in the script, which is as follows:

mkdir build_dir
cd build_dir

CUDA_COMPILER=/usr/local/cuda/bin/nvcc
CXX_COMPILER=/usr/bin/g++-4.9

SPATIAL_DIMS=3
INPUT_CHANNELS=1
REFERENCE_CHANNELS=3
MAKE_TESTS=False

cmake -DCMAKE_BUILD_TYPE=Debug -D CMAKE_CUDA_COMPILER=${CUDA_COMPILER}
-D CMAKE_CXX_COMPILER=${CXX_COMPILER}
-D CMAKE_CUDA_HOST_COMPILER=${CXX_COMPILER}
-D SPATIAL_DIMS=${SPATIAL_DIMS}
-D INPUT_CHANNELS=${INPUT_CHANNELS}
-D REFERENCE_CHANNELS=${REFERENCE_CHANNELS}
-D MAKE_TESTS=${MAKE_TESTS}
-G "CodeBlocks - Unix Makefiles" ../

make

@MiguelMonteiro
Copy link
Owner

Can you pull the latest code for both the CRFasRNN module and the permutohedral_lattice module.
I changed the scripts a bit yesterday just to make them cleaner and compatible with python 3.
I had no problems compiling.

@XYZ-916
Copy link
Author

XYZ-916 commented Jan 9, 2019

I have solved the problem of build error by pulling the latest code. Thank you very much!
And when I train my 3D_UNet after adding the CRF_RNN_layer behind my sigmoid layer, I got error as follow:

crfasrnnLayer = CRF_RNN_Layer(image_dims=(input_shape[1],input_shape[2],input_shape[3]),num_classes = n_labels,theta_alpha=160.,theta_beta=3.0,theta_gamma=3.0,num_iterations=10,name='crfrnn')[output_layer,inputs]
TypeError: 'CRF_RNN_Layer' object is not subscriptable

input_shape[0]:width, input_shape[1]:height, input_shape[2]: depth
n_labels = 1

Partial of my model struct code:
`output_layer = None
for level_number in reversed(range(n_segmentation_levels)):
segmentation_layer = segmentation_layers[level_number]
if output_layer is None:
output_layer = segmentation_layer
else:
output_layer = Add()([output_layer, segmentation_layer])

    if level_number > 0:
        output_layer = UpSampling3D(size=(2, 2, 2))(output_layer)

crfasrnnLayer = CRF_RNN_Layer(image_dims=(input_shape[1],input_shape[2],input_shape[3]),num_classes = n_labels,theta_alpha=160.,
                              theta_beta=3.0,theta_gamma=3.0,num_iterations=10,name='crfrnn')[output_layer,inputs]

activation_block = Activation(activation_name)(crfasrnnLayer)

model = Model(inputs=inputs, outputs=activation_block)
model.compile(optimizer=optimizer(lr=initial_learning_rate), loss=loss_function)
return model`

Any ideas ? Thank you !

@MiguelMonteiro
Copy link
Owner

Are you using Keras? I haven't used Keras in a while. It is just a matter of fixing up the Keras code.

@XYZ-916
Copy link
Author

XYZ-916 commented Jan 10, 2019

Yes. I'm using Keras. I saw there is a file named "crf_as_rnn_keras_layer.py" int your project and I used it as a layer in my model. And do you know how to fix the Keras code? Thank you!

@MiguelMonteiro
Copy link
Owner

I don't use Keras but it was working before.
Maybe I changed something, I will have a look and let you know.

@XYZ-916
Copy link
Author

XYZ-916 commented Jan 10, 2019

Thank you very much and looking forward to your reply!

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

2 participants