Skip to content

Update main.py#116

Open
ashok2216-A wants to merge 1 commit into
taoxugit:masterfrom
ashok2216-A:patch-2
Open

Update main.py#116
ashok2216-A wants to merge 1 commit into
taoxugit:masterfrom
ashok2216-A:patch-2

Conversation

@ashok2216-A

Copy link
Copy Markdown

he torchvision.transforms.Scale method has been deprecated and removed in recent versions of torchvision. You should replace it with torchvision.transforms.Resize.

Here’s how you can update the code to use transforms.Resize instead of transforms.Scale:

Locate the Use of transforms.Scale:

Find the lines in your code where transforms.Scale is used. According to your traceback, it seems to be around line 124 in main.py.

Replace transforms.Scale with transforms.Resize:

transforms.Scale(int(imsize * 76 / 64)),

to:

transforms.Resize(int(imsize * 76 / 64)),
Example
Here’s an example of how your main.py might look after the change:

import torchvision.transforms as transforms

Example usage of transforms.Resize instead of transforms.Scale transform = transforms.Compose([

transforms.Resize(int(imsize * 76 / 64)),
transforms.ToTensor(),
# Add other transformations as needed

])

he torchvision.transforms.Scale method has been deprecated and removed in recent versions of torchvision. You should replace it with torchvision.transforms.Resize.

Here’s how you can update the code to use transforms.Resize instead of transforms.Scale:

Locate the Use of transforms.Scale:

Find the lines in your code where transforms.Scale is used. According to your traceback, it seems to be around line 124 in main.py.

Replace transforms.Scale with transforms.Resize:

transforms.Scale(int(imsize * 76 / 64)),

to:

transforms.Resize(int(imsize * 76 / 64)),
Example
Here’s an example of how your main.py might look after the change:

import torchvision.transforms as transforms

# Example usage of transforms.Resize instead of transforms.Scale
transform = transforms.Compose([
    transforms.Resize(int(imsize * 76 / 64)),
    transforms.ToTensor(),
    # Add other transformations as needed
])
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

Successfully merging this pull request may close these issues.

1 participant