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

Method forward

python/singa/autograd.py:1866–1883  ·  view source on GitHub ↗

Args: x (CTensor): the input tensor Returns: the result CTensor

(self, x)

Source from the content-addressed store, hash-verified

1864 self.odd_padding = odd_padding
1865
1866 def forward(self, x):
1867 """
1868 Args:
1869 x (CTensor): the input tensor
1870 Returns:
1871 the result CTensor
1872 """
1873 assert x.nDim() == 4, "The dimensions of input should be 4D."
1874 if self.odd_padding != (0, 0, 0, 0):
1875 x = utils.handle_odd_pad_fwd(x, self.odd_padding, True)
1876
1877 if (type(self.handle) != singa.PoolingHandle):
1878 y = singa.GpuPoolingForward(self.handle, x)
1879 else:
1880 y = singa.CpuPoolingForward(self.handle, x)
1881 if training:
1882 self.cache = (x, y)
1883 return y
1884
1885 def backward(self, dy):
1886 """

Callers

nothing calls this directly

Calls 2

typeFunction · 0.85
nDimMethod · 0.80

Tested by

no test coverage detected