Giter VIP home page Giter VIP logo

pytea's People

Contributors

dependabot[bot] avatar lego0901 avatar merhs avatar sehun0819 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pytea's Issues

LSTM/GRU input_size tensor shape errors

Hi, I have met a problem while detecting LSTM tensor shape errors.
The testing file below is runnable and pytea returns correctly.

import torch
import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):

    def __init__(self):
        super().__init__()
        self.cnn = nn.Conv2d(3, 1, 3, 1, 1)
        self.rnn = nn.LSTM(32, 64, 1, batch_first=True)
        self.pool = nn.MaxPool2d(2, 2)
        self.fc = nn.Linear(64, 16)

    def forward(self, x):
        x = self.pool(F.relu(self.cnn(x)))
        x = x.view(-1, 32, 32)
        x, _ = self.rnn(x)
        x = x[:, -1, :].squeeze(1)
        x = F.relu(self.fc(x))
        x = F.softmax(x, dim=-1)
        return x


if __name__ == "__main__":
    net = Model()
    x = torch.randn(2, 3, 64, 64)
    y = net(x)
    target = torch.argmax(torch.randn(2, 16), dim=-1)
    loss = F.cross_entropy(y, target.long())
    loss.backward()
    print(y.size())

However, If I change self.rnn = nn.LSTM(32, 64, 1, batch_first=True) into self.rnn = nn.LSTM(64, 64, 1, batch_first=True), torch will report a RuntimeError: Expected 64, got 32.
pytea didn't return any CONSTRAINTS information, as it supposed to.

Then I tried to more LSTM input_size shape errors, all failed. Same situation with GRU.
I think it is a bug, because I can detect Conv2d, Linear error successfully.

Ternary expression (A if B else C) bug report

아래와 같은 코드 실행에서 문제가 발생한다는 것을 깨달았습니다.

x = 0 if 0 <= 1 else 1
# runtime output
REDUCED HEAP: (size: 250)
  x => 1

파이썬의 삼항연산자가 x = (((0 <= 1) and 0) or 1)로 파싱됩니다.
Logical statement가 True, true-value가 0일 때 발생하는 오류인 것으로 보입니다.

당장 벤치마크 코드에서 나타나는 문제는 아닙니다.
Pylib builtin 구현에서 발생한 문제이므로, 다른 방식으로 구현함으로써 일단은 피해갈 수 있을 것 같습니다.

감사합니다.

Inconsistent with document description

Hello, I have encountered the following problems:

First question:
The content of my source file is:

   import torch
   import torch.nn as nn

  class Net(nn.Module):
      def __init__(self):
          super(Net, self).__init__()
          self.layers = nn.Sequential(
              nn.Linear(28 * 28, 120),
              nn.ReLU(),
              nn.Linear(80, 10))
  
      def a(self):
          pass

    if __name__ == "__main__":
        n = Net()

But when I execute the command, I get the following results:

image

There should be a problem with defining shape in this model.

Second question:
I used it https://github.com/pytorch/examples/blob/master/mnist/main.py , but the command is stuck and no result is returned. As follows:

image

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.