Giter VIP home page Giter VIP logo

Comments (7)

bentrevett avatar bentrevett commented on June 4, 2024

Your error is in the line nn.Linear(1024, batch_size).

I believe this should be nn.Linear(1024, 8*8) as the generator is trying to output 8x8 images.

from pytorch-sentiment-analysis.

bentrevett avatar bentrevett commented on June 4, 2024

Also, the line x = x.view(-1, batch_size) is an error. It should be x = x.view(batch_size, -1).

from pytorch-sentiment-analysis.

KeerthiKrishna97 avatar KeerthiKrishna97 commented on June 4, 2024

Your error is in the line nn.Linear(1024, batch_size).

I believe this should be nn.Linear(1024, 8*8) as the generator is trying to output 8x8 images.

Hello. Here 8*8 = 64 is the batch_size

from pytorch-sentiment-analysis.

bentrevett avatar bentrevett commented on June 4, 2024

Your error is in the line nn.Linear(1024, batch_size).
I believe this should be nn.Linear(1024, 8*8) as the generator is trying to output 8x8 images.

Hello. Here 8*8 = 64 is the batch_size

Right, but nn.Linear(1024, batch_size) means it takes in a [batch size, 1024] tensor and outputs a [batch size, batch size] tensor, when it should be a [batch size, channels * height * width] tensor and then the last dimension should be reshaped.

from pytorch-sentiment-analysis.

KeerthiKrishna97 avatar KeerthiKrishna97 commented on June 4, 2024

Okay. I have done that and now the error is : mat1 and mat2 shapes cannot be multiplied (64x304800 and 64x1024)

from pytorch-sentiment-analysis.

bentrevett avatar bentrevett commented on June 4, 2024

Which line is giving you that error? Tensor shape mismatching is a common bug in deep learning models, and the best way to solve it by making sure the shapes output by each layer is what you expect by printing out the tensor shapes out by each layer and seeing if it matches with what you expect it to be.

from pytorch-sentiment-analysis.

KeerthiKrishna97 avatar KeerthiKrishna97 commented on June 4, 2024

Your error is in the line nn.Linear(1024, batch_size).

I believe this should be nn.Linear(1024, 8*8) as the generator is trying to output 8x8 images.

I believe the error is here. The output of nn.Linear of Generator shouldn't be batch size. As you said, it should be channels × height× width. For my images, it is 1 × 160× 160, which is quite large to be an output.

from pytorch-sentiment-analysis.

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.