Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
2a9a5d84
Commit
2a9a5d84
authored
3 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
corrected input variable
parent
2015c09d
No related branches found
No related tags found
6 merge requests
!430
update recent developments
,
!413
update release branch
,
!412
Resolve "release v2.0.0"
,
!395
Lukas issue362 feat branched rnn
,
!390
Lukas issue362 feat branched rnn
,
!388
Resolve "branched rnn model class"
Pipeline
#92738
passed
3 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlair/model_modules/branched_input_networks.py
+7
-5
7 additions, 5 deletions
mlair/model_modules/branched_input_networks.py
with
7 additions
and
5 deletions
mlair/model_modules/branched_input_networks.py
+
7
−
5
View file @
2a9a5d84
...
...
@@ -8,7 +8,7 @@ from mlair.model_modules.loss import var_loss
from
mlair.model_modules.recurrent_networks
import
RNN
class
BranchInputRNN
(
RNN
):
# pragma: no cover
class
Branch
ed
InputRNN
(
RNN
):
# pragma: no cover
"""
A recurrent neural network with multiple input branches.
"""
def
__init__
(
self
,
input_shape
,
output_shape
,
*
args
,
**
kwargs
):
...
...
@@ -37,7 +37,9 @@ class BranchInputRNN(RNN): # pragma: no cover
for
branch
in
range
(
len
(
self
.
_input_shape
)):
shape_b
=
self
.
_input_shape
[
branch
]
x_input_b
=
keras
.
layers
.
Input
(
shape
=
shape_b
)
x_in_b
=
keras
.
layers
.
Reshape
((
shape_b
[
0
],
reduce
((
lambda
x
,
y
:
x
*
y
),
shape_b
[
1
:])))(
x_input_b
)
x_input
.
append
(
x_input_b
)
x_in_b
=
keras
.
layers
.
Reshape
((
shape_b
[
0
],
reduce
((
lambda
x
,
y
:
x
*
y
),
shape_b
[
1
:])),
name
=
f
"
reshape_branch
{
branch
+
1
}
"
)(
x_input_b
)
for
layer
,
n_hidden
in
enumerate
(
conf
):
return_sequences
=
(
layer
<
len
(
conf
)
-
1
)
...
...
@@ -69,7 +71,7 @@ class BranchInputRNN(RNN): # pragma: no cover
x_concat
=
self
.
dropout
(
self
.
dropout_rate
)(
x_concat
)
x_concat
=
keras
.
layers
.
Dense
(
self
.
_output_shape
)(
x_concat
)
out
=
self
.
activation_output
(
name
=
f
"
{
self
.
activation_output_name
}
_output
"
)(
x_
in
)
out
=
self
.
activation_output
(
name
=
f
"
{
self
.
activation_output_name
}
_output
"
)(
x_
concat
)
self
.
model
=
keras
.
Model
(
inputs
=
x_input
,
outputs
=
[
out
])
print
(
self
.
model
.
summary
())
...
...
@@ -78,8 +80,8 @@ class BranchInputRNN(RNN): # pragma: no cover
"
metrics
"
:
[
"
mse
"
,
"
mae
"
,
var_loss
]}
def
_update_model_name
(
self
,
rnn_type
):
#
n_input =
str(reduce(lambda x, y: x * y,
self._input_shape
))
n_input
=
f
"
{
len
(
self
.
_input_shape
)
}
x
{
str
(
reduce
(
lambda
x
,
y
:
x
*
y
,
self
.
_input_shape
[
0
]))
}
"
n_input
=
f
"
{
len
(
self
.
_input_shape
)
}
x
{
self
.
_input_shape
[
0
][
0
]
}
x
"
\
f
"
{
str
(
reduce
(
lambda
x
,
y
:
x
*
y
,
self
.
_input_shape
[
0
]
[
1
:
]
))
}
"
n_output
=
str
(
self
.
_output_shape
)
self
.
model_name
=
rnn_type
.
upper
()
if
isinstance
(
self
.
layer_configuration
,
tuple
)
and
len
(
self
.
layer_configuration
)
==
2
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment