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

Method _LeakyRelu_helper

test/python/test_operation.py:695–708  ·  view source on GitHub ↗
(self, dev)

Source from the content-addressed store, hash-verified

693 self._Identity_helper(gpu_dev)
694
695 def _LeakyRelu_helper(self, dev):
696 X = np.array([0.8, -1.2, 3.3, -3.6, -0.5,
697 0.5]).reshape(3, 2).astype(np.float32)
698 XT = np.array([0.8, -0.012, 3.3, -0.036, -0.005,
699 0.5]).reshape(3, 2).astype(np.float32)
700 x = tensor.from_numpy(X)
701 x.to_device(dev)
702
703 result = autograd.leakyrelu(x)
704
705 dx = result.creator.backward(x.data)
706
707 np.testing.assert_array_almost_equal(tensor.to_numpy(result), XT)
708 self.check_shape(dx.shape(), (3, 2))
709
710 def test_LeakyRelu_cpu(self):
711 self._LeakyRelu_helper(cpu_dev)

Callers 2

test_LeakyRelu_cpuMethod · 0.95
test_LeakyRelu_gpuMethod · 0.95

Calls 5

check_shapeMethod · 0.95
shapeMethod · 0.80
reshapeMethod · 0.45
to_deviceMethod · 0.45
backwardMethod · 0.45

Tested by

no test coverage detected