Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
CNNArch2Gluon
Commits
cc2e9af9
Commit
cc2e9af9
authored
Feb 03, 2020
by
Julian Treiber
Browse files
fix for DiceLoss
parent
931555d3
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/main/resources/templates/gluon/CNNSupervisedTrainer.ftl
View file @
cc2e9af9
...
...
@@ -298,7 +298,7 @@ class ${tc.fileNameWithoutEnding}:
elif loss == 'dice_loss':
fromLogits = loss_params['from_logits'] if 'from_logits' in loss_params else False
dice_weight = loss_params['dice_weight'] if 'dice_weight' in loss_params else None
loss_function = DiceLoss(axis=loss_axis,
ignore_indices=ignore_indices,
from_logits=fromLogits, weight=dice_weight, sparse_label=sparseLabel, batch_axis=batch_axis)
loss_function = DiceLoss(axis=loss_axis, from_logits=fromLogits, weight=dice_weight, sparse_label=sparseLabel, batch_axis=batch_axis)
elif loss == 'l2':
loss_function = mx.gluon.loss.L2Loss()
elif loss == 'l1':
...
...
src/test/resources/target_code/CNNSupervisedTrainer_Alexnet.py
View file @
cc2e9af9
...
...
@@ -297,7 +297,7 @@ class CNNSupervisedTrainer_Alexnet:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_CifarClassifierNetwork.py
View file @
cc2e9af9
...
...
@@ -297,7 +297,7 @@ class CNNSupervisedTrainer_CifarClassifierNetwork:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_Invariant.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_Invariant:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_MultipleStreams.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_MultipleStreams:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_RNNencdec.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_RNNencdec:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_RNNsearch.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_RNNsearch:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_RNNtest.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_RNNtest:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_ResNeXt50.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_ResNeXt50:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_Show_attend_tell.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_Show_attend_tell:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_ThreeInputCNN_M14.py
View file @
cc2e9af9
...
...
@@ -290,7 +290,7 @@ class CNNSupervisedTrainer_ThreeInputCNN_M14:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
src/test/resources/target_code/CNNSupervisedTrainer_VGG16.py
View file @
cc2e9af9
...
...
@@ -297,7 +297,7 @@ class CNNSupervisedTrainer_VGG16:
elif
loss
==
'dice_loss'
:
fromLogits
=
loss_params
[
'from_logits'
]
if
'from_logits'
in
loss_params
else
False
dice_weight
=
loss_params
[
'dice_weight'
]
if
'dice_weight'
in
loss_params
else
None
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
ignore_indices
=
ignore_indices
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
loss_function
=
DiceLoss
(
axis
=
loss_axis
,
from_logits
=
fromLogits
,
weight
=
dice_weight
,
sparse_label
=
sparseLabel
,
batch_axis
=
batch_axis
)
elif
loss
==
'l2'
:
loss_function
=
mx
.
gluon
.
loss
.
L2Loss
()
elif
loss
==
'l1'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment