Skip to content

len(rand_index)<len(idx_train) #8

@mahdin75

Description

@mahdin75

I was trying to run your code with my dataset, and the number of training data is 18000, while my batch size is 500.
The following line can't work with the mentioned parameters because len(rand_index)<len(idx_train):

File: train.py

rand_indx = torch.tensor(np.random.choice(np.arange(adj_label.shape[0]), batch_size)).type(torch.long).cuda() rand_indx[0:len(idx_train)] = idx_train

Here's the error that I get:
File "train.py", line 92, in get_batch rand_indx[0:len(idx_train)] = idx_train
RuntimeError: The expanded size of the tensor (500) must match the existing size (18000) at non-singleton dimension 0. Target sizes: [500]. Tensor sizes: [18000]

Could you please tell me how I can fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions