GithubHelp home page GithubHelp logo

Comments (11)

peterjc123 avatar peterjc123 commented on May 2, 2024

LSTM有两个输出,你只保留第一个输出就可以了,状态输入和输出需要单独做处理

from tinyneuralnetwork.

Ironbrotherstyle avatar Ironbrotherstyle commented on May 2, 2024

LSTM有两个输出,你只保留第一个输出就可以了,状态输入和输出需要单独做处理

那我这里并没有看到处理第几个输出的接口,只看到了 converter.convert()部分,请问保留输出的接口在哪里啊?

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on May 2, 2024

需要改模型,下面这样就可以导出了

class Model(nn.Module):
    def __init__(self):
         self.lstm = nn.LSTM(...)
    def forward(self, x):
         return self.lstm(x)[0]

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on May 2, 2024

LSTM有两个输出,你只保留第一个输出就可以了,状态输入和输出需要单独做处理

那我这里并没有看到处理第几个输出的接口,只看到了 converter.convert()部分,请问保留输出的接口在哪里啊?

目前没有提供修改输出的接口,因为不像onnx或者frozen model,变量的名字是无法预先得知的,你很难去指定

from tinyneuralnetwork.

Ironbrotherstyle avatar Ironbrotherstyle commented on May 2, 2024

需要改模型,下面这样就可以导出了

class Model(nn.Module):
    def __init__(self):
         self.lstm = nn.LSTM(...)
    def forward(self, x):
         return self.lstm(x)[0]

谢谢,我刚刚尝试了下,单层的可以,多层的好像不行?请问对于多层LSTM/GRU的使用有什么说明吗?

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on May 2, 2024

@Ironbrotherstyle 多层的应该也可以啊,GRU TFLite这边不支持,多层LSTM不支持的话,你给个样例,我试试

from tinyneuralnetwork.

Ironbrotherstyle avatar Ironbrotherstyle commented on May 2, 2024

又换了个测试方案多层LSTM可以了,谢谢,非常很棒的工作。省去了之前转多次模型的复杂流程(还可能遇到LSTM转换失败的问题)。

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on May 2, 2024

谢谢你的支持,我在考虑要不要加个LSTM的FAQ

from tinyneuralnetwork.

Ironbrotherstyle avatar Ironbrotherstyle commented on May 2, 2024

可以加上,不然很容易有我这样的疑惑。一一回复不方便。

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on May 2, 2024

主要还得写双语文档,头疼(

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on May 2, 2024

https://github.com/alibaba/TinyNeuralNetwork/blob/main/docs/FAQ.md#how-to-convert-a-model-with-lstm
https://github.com/alibaba/TinyNeuralNetwork/blob/main/docs/FAQ_zh-CN.md#%E7%AE%97%E5%AD%90%E4%B8%8D%E6%94%AF%E6%8C%81%E5%A6%82%E4%BD%95%E5%A4%84%E7%90%86

from tinyneuralnetwork.

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.