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

call c++ library from tensorflow - FallbackException : Expecting int64_t #6

Open
Eunhui-Kim opened this issue Apr 24, 2020 · 0 comments

Comments

@Eunhui-Kim
Copy link

Eunhui-Kim commented Apr 24, 2020

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~

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

1 participant