Skip to content

Commit

Permalink
Merge pull request #1198 from zmeihui/24-8-11-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
lzjpaul authored Aug 11, 2024
2 parents 8f81095 + d4b11ab commit 77fbc63
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/cnn_ms/msmlp/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ def backward(self, dy=1.0):
dx *= dy
return dx

def se_loss(x):
# assert x.shape == t.shape, "input and target shape different: %s, %s" % (
# x.shape, t.shape)
return SumError()(x)[0]

### from layer.py
class SumErrorLayer(Layer):
"""
Generate a MeanSquareError operator
"""

def __init__(self):
super(SumErrorLayer, self).__init__()

def forward(self, x):
return se_loss(x)

#### self-defined loss end

class MSMLP(model.Model):
Expand Down

0 comments on commit 77fbc63

Please sign in to comment.