You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need a guide on how to resolve this bug:
label_idx = labels.index(label) # Convert label to an index
AttributeError: 'Tensor' object has no attribute 'index'
Pycharm referenced this class to be the sources of the error:
class SpeedDataset(Dataset):
def init(self, data):
self.data = data
def __len__(self):
return len(self.data)
def __getitem__(self, idx):
speed = self.data.iloc[idx]['speeds']
label = self.data.iloc[idx]['label']
label_idx = labels.index(label) # Convert label to an index
return torch.tensor(speed, dtype=torch.float32), torch.tensor(label_idx, dtype=torch.long)
Please, I need a guide to resolve this issue.
The text was updated successfully, but these errors were encountered:
I need a guide on how to resolve this bug:
label_idx = labels.index(label) # Convert label to an index
AttributeError: 'Tensor' object has no attribute 'index'
Pycharm referenced this class to be the sources of the error:
class SpeedDataset(Dataset):
def init(self, data):
self.data = data
Please, I need a guide to resolve this issue.
The text was updated successfully, but these errors were encountered: