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

A problem in the layers.index_matrix_to_pairs function #10

Open
Chen-Wang-CUHK opened this issue Aug 24, 2017 · 3 comments
Open

A problem in the layers.index_matrix_to_pairs function #10

Chen-Wang-CUHK opened this issue Aug 24, 2017 · 3 comments

Comments

@Chen-Wang-CUHK
Copy link

Chen-Wang-CUHK commented Aug 24, 2017

Hi,
Thanks for your code sharing.
But I found there are some problems in layers.index_matrix_to_pairs function:
By using the original code, I can't get
[[[0, 3], [1, 1], [2, 2]],
[[0, 2], [1, 3], [2, 1]]]
while inputing [[3,1,2], [2,3,1]].

It works, after I change the code to:

def index_matrix_to_pairs(index_matrix):
# [[3,1,2], [2,3,1]] -> [[[0, 3], [1, 1], [2, 2]],
# [[0, 2], [1, 3], [2, 1]]]
replicated_first_indices = tf.range(tf.shape(index_matrix)[1])
rank = len(index_matrix.get_shape())
if rank == 2:
replicated_first_indices = tf.tile(
tf.expand_dims(replicated_first_indices, dim=0),
[tf.shape(index_matrix)[0], 1]
)
return tf.stack([replicated_first_indices, index_matrix], axis=rank)

I don't know either the given example or the code is wrong.

@SHUht
Copy link

SHUht commented Sep 5, 2017

Could you tell me which version of tensorflow you use? I just learn tensorflow.

@Chen-Wang-CUHK
Copy link
Author

Chen-Wang-CUHK commented Sep 5, 2017 via email

@SHUht
Copy link

SHUht commented Sep 11, 2017

"dynamic_rnn_decoder = tf.contrib.seq2seq.dynamic_rnn_decoder " Attributerror: 'module' object has no attribute 'dynamic_rnn_decoder'?
who can tell me which tensorflow can solve it?
thank you

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