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

modeling/embedding_lookup function issue #1366

Open
Futuresing opened this issue Sep 3, 2022 · 0 comments
Open

modeling/embedding_lookup function issue #1366

Futuresing opened this issue Sep 3, 2022 · 0 comments

Comments

@Futuresing
Copy link

Futuresing commented Sep 3, 2022

To reshape the input, the code is:

if input_ids.shape.ndims == 2:
  input_ids = tf.expand_dims(input_ids, axis=[-1]

I'm wondering why we set axis = [-1] instead of -1 and how it is possible to pass a list to axis.
I have tried this:

import tensorflow as tf 
t = tf.constant([1,2]) 
t1 = tf.expand_dims(t, axis=[0, 1]) 
print(t1.shape)

but it raised the error: 'dim' must be a tensor with a single value [Op:ExpandDims]

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