MCPcopy Create free account
hub / github.com/apache/singa / backward

Method backward

examples/msmlp/model.py:56–63  ·  view source on GitHub ↗
(self, dy=1.0)

Source from the content-addressed store, hash-verified

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
65def se_loss(x):
66 # assert x.shape == t.shape, "input and target shape different: %s, %s" % (

Callers 11

train_mnist_cnnFunction · 0.45
train_cifar10Function · 0.45
train_one_batchMethod · 0.45
train_one_batch_disMethod · 0.45
train_one_batchMethod · 0.45
train_one_batch_disMethod · 0.45
train_one_batchMethod · 0.45
train_one_batch_disMethod · 0.45
train_one_batchMethod · 0.45
train_one_batch_disMethod · 0.45
train_mnist_cnnFunction · 0.45

Calls 2

copy_from_numpyMethod · 0.95
TensorMethod · 0.80

Tested by

no test coverage detected