Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv_extra
提交
0c41aaa7
O
opencv_extra
项目概览
OpenCV
/
opencv_extra
12 个月 前同步成功
通知
119
Star
882
Fork
1584
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv_extra
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0c41aaa7
编写于
3月 15, 2022
作者:
A
Alexander Alekhin
提交者:
GitHub
3月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #959 from rogday:lstm
上级
294a5caf
b840f462
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
33 addition
and
0 deletion
+33
-0
testdata/dnn/onnx/data/input_lstm_cell_bidirectional.npy
testdata/dnn/onnx/data/input_lstm_cell_bidirectional.npy
+0
-0
testdata/dnn/onnx/data/input_lstm_cell_forward.npy
testdata/dnn/onnx/data/input_lstm_cell_forward.npy
+0
-0
testdata/dnn/onnx/data/input_lstm_cell_with_peepholes.npy
testdata/dnn/onnx/data/input_lstm_cell_with_peepholes.npy
+0
-0
testdata/dnn/onnx/data/output_lstm_cell_bidirectional.npy
testdata/dnn/onnx/data/output_lstm_cell_bidirectional.npy
+0
-0
testdata/dnn/onnx/data/output_lstm_cell_forward.npy
testdata/dnn/onnx/data/output_lstm_cell_forward.npy
+0
-0
testdata/dnn/onnx/data/output_lstm_cell_with_peepholes.npy
testdata/dnn/onnx/data/output_lstm_cell_with_peepholes.npy
+0
-0
testdata/dnn/onnx/generate_onnx_models.py
testdata/dnn/onnx/generate_onnx_models.py
+33
-0
testdata/dnn/onnx/models/lstm_cell_bidirectional.onnx
testdata/dnn/onnx/models/lstm_cell_bidirectional.onnx
+0
-0
testdata/dnn/onnx/models/lstm_cell_forward.onnx
testdata/dnn/onnx/models/lstm_cell_forward.onnx
+0
-0
testdata/dnn/onnx/models/lstm_cell_with_peepholes.onnx
testdata/dnn/onnx/models/lstm_cell_with_peepholes.onnx
+0
-0
未找到文件。
testdata/dnn/onnx/data/input_lstm_cell_bidirectional.npy
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/data/input_lstm_cell_forward.npy
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/data/input_lstm_cell_with_peepholes.npy
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/data/output_lstm_cell_bidirectional.npy
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/data/output_lstm_cell_forward.npy
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/data/output_lstm_cell_with_peepholes.npy
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/generate_onnx_models.py
浏览文件 @
0c41aaa7
...
...
@@ -892,6 +892,39 @@ hidden_lstm = HiddenLSTM(features, hidden, num_layers=3, is_bidirectional=True)
save_data_and_model
(
"hidden_lstm_bi"
,
input
,
hidden_lstm
,
version
=
11
,
export_params
=
True
)
batch
=
5
features
=
4
hidden
=
3
seq_len
=
2
num_layers
=
1
bidirectional
=
True
class
LSTM
(
nn
.
Module
):
def
__init__
(
self
):
super
(
LSTM
,
self
).
__init__
()
self
.
lstm
=
nn
.
LSTM
(
features
,
hidden
,
num_layers
,
bidirectional
=
bidirectional
)
self
.
h0
=
torch
.
from_numpy
(
np
.
ones
((
num_layers
+
int
(
bidirectional
),
batch
,
hidden
),
dtype
=
np
.
float32
))
self
.
c0
=
torch
.
from_numpy
(
np
.
ones
((
num_layers
+
int
(
bidirectional
),
batch
,
hidden
),
dtype
=
np
.
float32
))
def
forward
(
self
,
x
):
a
,
(
b
,
c
)
=
self
.
lstm
(
x
,
(
self
.
h0
,
self
.
c0
))
if
bidirectional
:
return
torch
.
cat
((
a
,
b
,
c
),
dim
=
2
)
else
:
return
torch
.
cat
((
a
,
b
,
c
),
dim
=
0
)
input_
=
Variable
(
torch
.
randn
(
seq_len
,
batch
,
features
))
lstm
=
LSTM
()
save_data_and_model
(
"lstm_cell_bidirectional"
,
input_
,
lstm
,
export_params
=
True
)
bidirectional
=
False
input_
=
Variable
(
torch
.
randn
(
seq_len
,
batch
,
features
))
lstm
=
LSTM
()
save_data_and_model
(
"lstm_cell_forward"
,
input_
,
lstm
,
export_params
=
True
)
class
MatMul
(
nn
.
Module
):
def
__init__
(
self
):
super
(
MatMul
,
self
).
__init__
()
...
...
testdata/dnn/onnx/models/lstm_cell_bidirectional.onnx
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/models/lstm_cell_forward.onnx
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
testdata/dnn/onnx/models/lstm_cell_with_peepholes.onnx
0 → 100644
浏览文件 @
0c41aaa7
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录