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

Method forward

python/singa/autograd.py:4638–4650  ·  view source on GitHub ↗

forward of NonZero Args: x (CTensor): input tensor. Returns: the output CTensor.

(self, x)

Source from the content-addressed store, hash-verified

4636 super(NonZero, self).__init__()
4637
4638 def forward(self, x):
4639 """
4640 forward of NonZero
4641 Args:
4642 x (CTensor): input tensor.
4643 Returns:
4644 the output CTensor.
4645 """
4646 y = tensor.to_numpy(tensor.from_raw_tensor(x))
4647 y = np.array((np.nonzero(y))).astype(np.int32)
4648 y = tensor.from_numpy(y)
4649 y.to_device(x.device())
4650 return y.data
4651
4652 def backward(self, dy):
4653 """

Callers

nothing calls this directly

Calls 2

deviceMethod · 0.80
to_deviceMethod · 0.45

Tested by

no test coverage detected