(x)
| 100 | ndim: int, axis: Union[int, Iterable], reverse=False |
| 101 | ) -> Union[int, list]: |
| 102 | def convert(x): |
| 103 | x_org = x |
| 104 | if x < 0: |
| 105 | x = ndim + x |
| 106 | assert ( |
| 107 | x >= 0 and x < ndim |
| 108 | ), "axis {} is out of bounds for tensor of dimension {}".format(x_org, ndim) |
| 109 | return x |
| 110 | |
| 111 | if isinstance(axis, int): |
| 112 | return convert(axis) |
no test coverage detected