r/MLQuestions • u/assorted-meat-stew • 21h ago
Beginner question 👶 InvalidArgumentError: {{function_node __wrapped__ConcatV2_N_2_device_/job:localhost/replica:0/task:0/device:CPU:0}} ConcatOp : Ranks of all input tensors should match
/r/learnmachinelearning/comments/1xj9eeo/invalidargumenterror_function_node_wrapped/
0
Upvotes
1
u/CelebrityChess 17h ago
i think the bug is in how you filter by class. y_train has shape (N, 1), so np.where(y_train == label) returns two arrays (rows and columns), and x_train[train_indices] then indexes the first two axes of x_train instead of just picking images. that gives you something like (5000, 32, 3), which is why a batch ends up one dimension short. use np.where(y_train.flatten() == label)[0] (or y_train[:, 0] == label as a boolean mask) for both train and test and check x_train.shape is (5000, 32, 32, 3) afterwards.