jyh2986 / active-shift-tf Goto Github PK
View Code? Open in Web Editor NEWTensorflow implementation for Active Shift Layer(ASL)
License: Apache License 2.0
Tensorflow implementation for Active Shift Layer(ASL)
License: Apache License 2.0
how can i use it in pytorch
Since the environment is different as follows I changed some options.
[environment]
CentOS 17.4
tensorflow-gpu 2.0.0
CUDA 10.0
CUDNN7.4.2
gcc8.3.2
By using tf_upgrade_v2, test_forward_ASL.py run and I can the test_forward_ASL.py
However, when I run test_gradient_ASL.py
I firstly met following error. Warning]WARNING:tensorflow:From test_gradient_ASL-TF20.py:45: compute_gradient_error (from tensorflow.python.ops.gradient_checker) is deprecated and will be removed in a future version. Instructions for updating: Use tf.test.compute_gradient in 2.0, which has better support for functions. Note that the two versions have different usage, so code change is needed.
[compile Errror] for code line 45, 73,
Attribute Error err = gradient_checker.compute_gradient_error(a, arr.shape, result, result.get_shape().as_list(), x_init_value=arr)
err = gradient_checker.compute_gradient_error(c, shift.shape,result, result.get_shape().as_list(), x_init_value=shift)
AttributeError: Tensor.graph is meaningless when eager execution is enabled. Thus I changed gradient_checker.compute_gradient_error function like below.
strides = [1, 1, stride_h, stride_w]
paddings = [0, 0, pad_h, pad_w]
strides_tf = tf.constant(strides, dtype=tf.int64)
paddings_tf = tf.constant(paddings, dtype=tf.int64)
theoretical, numerical = tf.test.compute_gradient(active_shift2d_op.active_shift2d_op, [a, c, strides_tf, paddings_tf])
However, I met another error
Traceback (most recent call last): File "", line 54, in active_shift2d_op tensorflow.python.eager.core._FallbackException: Expecting int64_t value for attr strides, got tensorflow.python.framework.ops.EagerTensor
TypeError: Expected list for 'strides' argument to 'active_shift2d_op' Op, not .
library file is made by c++, thus it has int64_t data type, however tensorflow doesn't have int64_t type.
How can I resolve the error by removing type difference?
Thank you in advance~
Hi, I have followed your instructions to build the Op successfully. Then I tried to run the test code. And I got the error message:
InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'ActiveShift2DOp' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; T in [DT_DOUBLE]
device='GPU'; T in [DT_FLOAT]
Could you help to figure out what is wrong? Thank you!
I tried to run build.sh and I ran into this trouble:
tensorflow/include/tensorflow/core/util/cuda_kernel_helper.h:24:31: fatal error: cuda/include/cuda.h: No such file or directory
#include "cuda/include/cuda.h"
I use tensorflow 1.4.1, cuda 8.0 cudnn 6.0 and g++4.9
Any help?
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.