IssamLaradji / M-ADDA

Domain Adaptation Based on the Triplet Loss
113 stars 27 forks source link

AttributeError: 'int' object has no attribute 'clone' #1

Open redhat12345 opened 6 years ago

redhat12345 commented 6 years ago

I got the following error.

File "/media/redhat/DATA/M-ADDA/datasets/uspsBig.py", line 69, in getitem img, label = self.X[index].clone(), self.y[index].clone() AttributeError: 'int' object has no attribute 'clone'

IssamLaradji commented 6 years ago

Are you using Pytorch 0.4? if you have Pytorch 0.4 or higher self.y[index] will be a tensor instead of an integer, which then allows you to apply the function .clone() to it

redhat12345 commented 6 years ago

Thanks.

IssamLaradji commented 6 years ago

Awesome, did it work after upgrading to 0.4?

redhat12345 commented 6 years ago

Thanks for the reply. Yeah it's working now.

redhat12345 commented 6 years ago

Hi, May I know how you plot the graph for your paper? May I get the code for plotting graph, please?

IssamLaradji commented 6 years ago

Thanks for the interest! are you referring to the plot in Figure 9? I used PrettyPlots as uploaded here: https://github.com/IssamLaradji/PrettyPlots

redhat12345 commented 6 years ago

Actually, I am talking about figure 3 and 8 in the paper.

IssamLaradji commented 6 years ago

I generated Figure 8 using the visEmbed(exp_dict) function in addons/vis.py. I generated Figure 3 using visdom scatter plot https://github.com/facebookresearch/visdom

Cheers.

redhat12345 commented 6 years ago

@IssamLaradji May I know how you draw the Figure 8?

redhat12345 commented 6 years ago

@IssamLaradji When I run the following command, I got the following error:

$ python vis.py File "vis.py", line 11, in import datasets ImportError: No module named 'datasets'

Traceback (most recent call last): File "vis.py", line 16, in import models ImportError: No module named 'models'

IssamLaradji commented 6 years ago

@redhat12345 are you using Python 3? if you are using Python 2 then you get this error you mentioned because it does not use absolute import (it uses relative import instead).

I generated Figure 8 using the visEmbed(exp_dict)function in addons/vis.py.

redhat12345 commented 6 years ago

@IssamLaradji I am using Python 3. When I run the command: $ python3 addons/vis.py

It gives me some warning this time and did not produce any images in the Summarises folder that i created here.

"/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, kwds) /usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, *kwds) /usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(args, kwds) /usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 "