Giter Club home page Giter Club logo

Comments (4)

eriklindernoren avatar eriklindernoren commented on July 27, 2024 2

Haven't had time to add this yet. Have to decide if I want to add this custom layer to each implementation or if I should add a common python file with custom layers. If you want to get rid of this message you can use this Upsample module.

class Upsample(nn.Module):
    """ nn.Upsample is deprecated """

    def __init__(self, scale_factor, mode="nearest"):
        super(Upsample, self).__init__()
        self.scale_factor = scale_factor
        self.mode = mode

    def forward(self, x):
        x = F.interpolate(x, scale_factor=self.scale_factor, mode=self.mode)
        return x

from pytorch-gan.

alsombra avatar alsombra commented on July 27, 2024 1

Actually this is not an error, it's just a warning. You don't need to worry about it.

If you want, you can just change the torch.nn.Upsample() layer for the function torch.nn.functional.interpolate() and choose the same interpolation method to have same behavior, e.g., change torch.nn.Upsample(mode='nearest', scale_factor=2)(x_in) to torch.nn.functional.interpolate(x_in, mode='nearest', scale_factor=2).

The problem is that nn.function.interpolate does not have bicubic interpolation implementation. In this case I transform the tensor back to numpy array and use any existing implemantion for it (like the PIL.Image.resize), then transform it back to Tensor (not sure if it is intelligent, but does the trick). There is a nice dicussion about this change here.

from pytorch-gan.

eriklindernoren avatar eriklindernoren commented on July 27, 2024

Just like @alsombra said it's just a warning, so you can run the implementations without problems despite the message you got. That said, I will probably write a wrapper for torch.nn.functional.interpolate soon which will replace the nn.Upsample layers.

from pytorch-gan.

Lornatang avatar Lornatang commented on July 27, 2024

Thank you so much l got it.

from pytorch-gan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.