(self, dy=1.0)
| 54 | return loss |
| 55 | |
| 56 | def backward(self, dy=1.0): |
| 57 | # dx = self.err |
| 58 | dev = device.get_default_device() |
| 59 | dx = tensor.Tensor(self.data_x.shape, dev, singa_dtype['float32']) |
| 60 | dx.copy_from_numpy(np.ones(self.data_x.shape)) |
| 61 | # dx *= float(2 / self.n) |
| 62 | dx *= dy |
| 63 | return dx |
| 64 | |
| 65 | def se_loss(x): |
| 66 | # assert x.shape == t.shape, "input and target shape different: %s, %s" % ( |
no test coverage detected