cuda.tile.Tile#
- class cuda.tile.Tile#
Class for tile objects.
- property shape: tuple[int, ...]#
The number of elements in each of the tile’s dimensions.
- Return type:
tuple[const int,…]
- item()#
Equivalent to self.reshape(()).
- Returns:
A scalar tile.
- Return type:
Examples
@ct.kernel def kernel(x): idx = ct.full((1,), 2, dtype=ct.int32).item() tile = ct.load(x, (idx,), shape=(4,)) print(tile) x = torch.arange(16, device='cuda') ct.launch(stream, (1,), kernel, (x,))
import cuda.tile as ct import torch torch.cuda.init() stream = torch.cuda.current_stream() @ct.kernel def kernel(x): idx = ct.full((1,), 2, dtype=ct.int32).item() tile = ct.load(x, (idx,), shape=(4,)) print(tile) x = torch.arange(16, device='cuda') ct.launch(stream, (1,), kernel, (x,)) torch.cuda.synchronize()
Output
[8, 9, 10, 11]
- transpose(axis0=None, axis1=None)#
See
transpose().
- __index__()#
0D Tile can be used as index in range
- __getitem__(index)#
Syntax sugar for expand_dim
- __add__(other)#
- __sub__(other)#
- __mul__(other)#
- __truediv__(other)#
- __floordiv__(other)#
- __mod__(other)#
- __pow__(other)#
- __and__(other)#
- __or__(other)#
Return self|value.
- __xor__(other)#
- __radd__(other)#
- __rsub__(other)#
- __rmul__(other)#
- __rtruediv__(other)#
- __rfloordiv__(other)#
- __rmod__(other)#
- __rpow__(other)#
- __rand__(other)#
- __ror__(other)#
Return value|self.
- __rxor__(other)#
- __ge__(other)#
Return self>=value.
- __gt__(other)#
Return self>value.
- __le__(other)#
Return self<=value.
- __lt__(other)#
Return self<value.
- __eq__(other)#
Return self==value.
- __ne__(other)#
Return self!=value.
- __neg__()#
- __invert__()#
- __matmul__(other)#
- __rmatmul__(other)#
- __hash__ = None#