yiranran / APDrawingGAN

Code for APDrawingGAN: Generating Artistic Portrait Drawings from Face Photos with Hierarchical GANs (CVPR 2019 Oral)
Apache License 2.0
785 stars 145 forks source link

only integer tensors of a single element can be converted to an index #10

Closed Ricelll closed 4 years ago

Ricelll commented 4 years ago

Excuse me,did u occur in this question?when I revised this question, I would occur in next question which may causeby this question.

Traceback (most recent call last):
  File "test.py", line 24, in <module>
    for i, data in enumerate(dataset):
  File "/home/jingjie/Pencil/APDrawing/APDrawingGAN/data/__init__.py", line 72, in __iter__
    for i, data in enumerate(self.dataloader):
  File "/home/jingjie/ENTER/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in __next__
    return self._process_data(data)
  File "/home/jingjie/ENTER/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
    data.reraise()
  File "/home/jingjie/ENTER/lib/python3.7/site-packages/torch/_utils.py", line 369, in reraise
    raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/jingjie/ENTER/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/jingjie/ENTER/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/jingjie/ENTER/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/jingjie/Pencil/APDrawing/APDrawingGAN/data/single_dataset.py", line 96, in __getitem__
    item[regions[i]+'_A'] = A[:,center[i,1]-rhs[i]/2:center[i,1]+rhs[i]/2,center[i,0]-rws[i]/2:center[i,0]+rws[i]/2]
TypeError: only integer tensors of a single element can be converted to an index
woojoo520 commented 4 years ago

I got the same problem! And I don't know how to deal with it?

yiranran commented 4 years ago

Are you using the latest version of code? I think this problem was discussed in a previous issue https://github.com/yiranran/APDrawingGAN/issues/1

woojoo520 commented 4 years ago

Sorry, I didn't see the previous issue. I have solved this problem. Thank you.

------------------ 原始邮件 ------------------ 发件人: "Ran Yi"notifications@github.com; 发送时间: 2019年10月23日(星期三) 晚上6:37 收件人: "yiranran/APDrawingGAN"APDrawingGAN@noreply.github.com; 抄送: "№淡忘"1275121799@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [yiranran/APDrawingGAN] only integer tensors of a single elementcan be converted to an index (#10)

Are you using the latest version of code? I think this problem was discussed in a previous issuehttps://github.com/yiranran/APDrawingGAN/issues/1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Ricelll commented 4 years ago

Sorry, I didn't see the previous issue.Because of the different version of pytorch, there are many problems about data type.Thanks very much @yiranran