r"""Calculates the cumulative sum of tensor elements over a given axis. Args: inp: input tensor. Should have a numeric data type. axis: axis along which cumulative sums must be computed. Returns: a tensor containing the cumulative sums. Examples: If :m
(inp: Tensor, axis: int)
| 1294 | |
| 1295 | |
| 1296 | def cumsum(inp: Tensor, axis: int): |
| 1297 | r"""Calculates the cumulative sum of tensor elements over a given axis. |
| 1298 | |
| 1299 | Args: |
| 1300 | inp: input tensor. Should have a numeric data type. |
| 1301 | axis: axis along which cumulative sums must be computed. |
| 1302 | |
| 1303 | Returns: |
| 1304 | a tensor containing the cumulative sums. |
| 1305 | |
| 1306 | Examples: |
| 1307 | |
| 1308 | If :math:`x_i` is ``NaN``, the cumulative sums is ``NaN`` (i.e., ``NaN`` values propagate). |
| 1309 | |
| 1310 | Examples: |
| 1311 | >>> x = Tensor([[1, 2, 3], [4, 5, 6]]) |
| 1312 | >>> F.cumsum(x, axis = 0) |
| 1313 | Tensor([[1 2 3] |
| 1314 | [5 7 9]], dtype=int32, device=xpux:0) |
| 1315 | >>> F.cumsum(x, axis = 1) |
| 1316 | Tensor([[ 1 3 6] |
| 1317 | [ 4 9 15]], dtype=int32, device=xpux:0) |
| 1318 | |
| 1319 | """ |
| 1320 | op = builtin.Cumsum(axis=axis, exclusive=False, reverse=False) |
| 1321 | return apply(op, inp)[0] |
| 1322 | |
| 1323 | |
| 1324 | def meshgrid(*inputs: Tensor, indexing: str = "xy") -> List[Tensor]: |
no test coverage detected