i gettting tupple out of index;
- User
i gettting tupple out of index;
Assistant
Looking at your code, I can see the issue. The error is occurring because you're calling len() on the output of reformer(adv_img), but the forward method returns a tuple of 2 elements (output, adaptive_kernel), not a list or tuple that you should be checking the length of. The main issues I can identify are:
Tuple unpacking issue: You're correctly unpacking the tuple in most places, but then calling len() on it Missing imports: You're using PeakSignalNoiseRatio but haven't imported it Undefined variables: train_loader and val_loader are referenced but not defined
Here's the corrected version of your training loop:Fixed Adaptive Laplacian Pyramid UNet Training CodeCode import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision.transforms as transforms from torch.utils.data import DataLoader import segmentation_models_pytorch as smp from torchmetrics import PeakThe main fixes I made: