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: object of type 'numpy.int64' has no len() #10

Closed
ljhOfGithub opened this issue Aug 14, 2023 · 1 comment
Closed

*** TypeError: object of type 'numpy.int64' has no len() #10

ljhOfGithub opened this issue Aug 14, 2023 · 1 comment

Comments

@ljhOfGithub
Copy link

all_risk_scores = np.zeros((len(loader)))
all_censorships = np.zeros((len(loader)))
all_event_times = np.zeros((len(loader)))

In pdb,'loader' is the type of 'torch.utils.data.dataloader.DataLoader',but when I use iter to check the content of the 'loader',another error occures: *** TypeError: 'numpy.int64' object is not iterable.How could I solve the problem?Thanks a lot.

@ljhOfGithub
Copy link
Author

all_risk_scores = np.zeros((len(loader)))
all_censorships = np.zeros((len(loader)))
all_event_times = np.zeros((len(loader)))

In pdb,'loader' is the type of 'torch.utils.data.dataloader.DataLoader',but when I use iter to check the content of the 'loader',another error occures: *** TypeError: 'numpy.int64' object is not iterable.How could I solve the problem?Thanks a lot.
在pdb中,'loader'是'torch.utils.data.dataloader. DataLoader'的类型,但是当我使用iter检查'loader'的内容时,另一个错误发生了:* 类型错误:'numpy.int64'对象不可迭代。我如何解决这个问题?谢谢你,我很好

I solve the problem by:

all_risk_scores = np.zeros((len(loader.dataset)))
all_censorships = np.zeros((len(loader.dataset)))
all_event_times = np.zeros((len(loader.dataset)))

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