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

TypeError: only integer scalar arrays can be converted to a scalar index #12

Open
rejae opened this issue Sep 13, 2019 · 0 comments
Open

Comments

@rejae
Copy link

rejae commented Sep 13, 2019

File "train.py", line 125, in train
self.config["batch_size"]):
File "/home/rejae/PycharmProjects/NLP-Project-master/text_classifier/data_helpers/eval_data.py", line 155, in next_batch
y = y[perm]
TypeError: only integer scalar arrays can be converted to a scalar index
需要将eval_data中:
def next_batch(self, x, y, batch_size):

    perm = np.arange(len(x))
    #print(type(y)  is list)  list need transfer to array.
    #out_images = np.array(X_train)[indices.astype(int)]
    np.random.shuffle(perm)
    x = x[perm]
    #y = y[perm]  
    y = np.array(y)[perm] #后修改
@rejae rejae closed this as completed Sep 13, 2019
@rejae rejae reopened this Sep 13, 2019
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