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: expected Tensor as element 0 in argument 0, but got int #34

Open
OswaldoBornemann opened this issue Mar 31, 2023 · 3 comments

Comments

@OswaldoBornemann
Copy link

 emd = torch.cat(emd_lst)
          _     _   _ [9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999]
          _     _ <built-in method cat of type object at 0x7f3b1185d100>
          _ <module 'torch' from '/~/anaconda3/envs/pytorch13/lib/python3.8/site-packages/torch/__init__.py'>

TypeError: expected Tensor as element 0 in argument 0, but got int
@ZENGXH
Copy link
Collaborator

ZENGXH commented Apr 1, 2023

Hi @PPGGG can you provide more log? like the line above the emd = torch.cat(emd_lst) ? what the command are you running?

@OswaldoBornemann
Copy link
Author

@ZENGXH I just ran bash ./script/train_prior.sh 1.

@ZENGXH
Copy link
Collaborator

ZENGXH commented Apr 1, 2023

It seems the emd_batch is a int instead of tensor: this is wired, the value is also much larger than I expected.

  • are you training on the ShapeNet dataset?
  • Could you try to add this line:
        print(f'emd_batch: {emd_batch}; sample_batch: {sample_batch.shape} {ref_batch.shape}; batch_size={batch_size}; value range: {sample_batch.min()} {sample_batch.max()}; {ref_batch.min()} {ref_batch.max()}; ')

before line 213 of the utils/evaluation_metrics_fast.py files (link). And paste the output here?

For example. in my case I get this following output

2023-04-01 16:10:31.379 | INFO     | trainers.base_trainer:set_writer:57 -
----------
[url]: none
../exp/0401/car/6e880fh_train_lion_B10
----------
2023-04-01 16:10:31.384 | INFO     | __main__:main:68 - not find any checkpoint: ../exp/0401/car/6e880fh_train_lion_B10/checkpoints, (exist=False), or snapshot ../exp/0401/car/6e880fh_train_lion_B10/checkpoints/snapshot, (exist=False)
2023-04-01 16:10:31.384 | INFO     | trainers.base_trainer:train_epochs:173 - [rank=0] Start epoch: 0 End epoch: 18000, batch-size=10 | Niter/epo=245 | log freq=245, viz freq 49000, val freq -10000
2023-04-01 16:10:35.574 | INFO     | utils.exp_helper:get_evalname:94 - git hash: 0ee19
2023-04-01 16:10:35.876 | INFO     | trainers.base_trainer:eval_nll:744 - eval: 1/36
2023-04-01 16:10:40.085 | INFO     | trainers.base_trainer:eval_nll:744 - eval: 31/36
emd_batch: tensor([7.3357e-05], device='cuda:0'); sample_batch: torch.Size([1, 2048, 3]) torch.Size([1, 2048, 3]); batch_size=1; value range: -0.4135565459728241 0.46055838465690613; -0.4139295518398285 0.46082451939582825;

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

2 participants