aihwkit.simulator.tiles_indexed module¶
High level analog tiles (indexed).
-
class
aihwkit.simulator.tiles_indexed.
CudaIndexedAnalogTile
(out_size, in_size, resistive_device=None, bias=False, in_trans=False, out_trans=False)¶ Bases:
aihwkit.simulator.tiles_indexed.IndexedAnalogTile
Analog tile (CUDA, indexed).
-
cuda
(device=None)¶ Return a copy of this tile in CUDA memory.
- Parameters
device (Optional[Union[torch.device, str, int]]) – CUDA device
- Return type
-
is_cuda
= True¶
-
-
class
aihwkit.simulator.tiles_indexed.
CudaIndexedFloatingPointTile
(out_size, in_size, resistive_device=None, bias=False, in_trans=False, out_trans=False)¶ Bases:
aihwkit.simulator.tiles_indexed.IndexedFloatingPointTile
Floating point tile (CUDA, indexed).
-
cuda
(device=None)¶ Return a copy of this tile in CUDA memory.
- Parameters
device (Optional[Union[torch.device, str, int]]) – CUDA device
- Return type
aihwkit.simulator.tiles_indexed.CudaIndexedFloatingPointTile
-
is_cuda
= True¶
-
-
class
aihwkit.simulator.tiles_indexed.
IndexedAnalogTile
(out_size, in_size, resistive_device=None, bias=False, in_trans=False, out_trans=False)¶ Bases:
aihwkit.simulator.tiles.AnalogTile
Analog tile (indexed).
-
backward
(d_input)¶ Perform the backward pass.
- Parameters
d_input (torch.Tensor) –
[N, out_size]
tensor. Ifout_trans
is set, transposed.- Returns
[N, in_size]
tensor. Ifin_trans
is set, transposed.- Return type
torch.Tensor
-
cuda
(device=None)¶ Return a copy of this tile in CUDA memory.
- Parameters
device (Optional[Union[torch.device, str, int]]) – CUDA device
- Return type
-
forward
(x_input, is_test=False)¶ Perform the forward pass.
- Parameters
x_input (torch.Tensor) –
[N, in_size]
tensor. Ifin_trans
is set, transposed.is_test (bool) – whether to assume testing mode.
- Returns
[N, out_size]
tensor. Ifout_trans
is set, transposed.- Return type
torch.Tensor
-
set_indexed
(indices, image_sizes)¶ Sets the index matrix for convolutions ans switches to indexed forward/backward/update versions.
- Parameters
indices (torch.Tensor) – torch.tensor with int indices
image_sizes (list) – [C_in, H_in, W_in, H_out, W_out] sizes
- Return type
None
-
update
(x_input, d_input)¶ Perform the update pass.
- Parameters
x_input (torch.Tensor) –
[N, in_size]
tensor. Ifin_trans
is set, transposed.d_input (torch.Tensor) –
[N, out_size]
tensor. Ifout_trans
is set, transposed.
- Return type
None
-
-
class
aihwkit.simulator.tiles_indexed.
IndexedFloatingPointTile
(out_size, in_size, resistive_device=None, bias=False, in_trans=False, out_trans=False)¶ Bases:
aihwkit.simulator.tiles.FloatingPointTile
Floating point tile (indexed).
-
backward
(d_input)¶ Perform the backward pass.
- Parameters
d_input (torch.Tensor) –
[N, out_size]
tensor. Ifout_trans
is set, transposed.- Returns
[N, in_size]
tensor. Ifin_trans
is set, transposed.- Return type
torch.Tensor
-
cuda
(device=None)¶ Return a copy of this tile in CUDA memory.
- Parameters
device (Optional[Union[torch.device, str, int]]) – CUDA device
- Return type
aihwkit.simulator.tiles_indexed.CudaIndexedFloatingPointTile
-
forward
(x_input, is_test=False)¶ Perform the forward pass.
- Parameters
x_input (torch.Tensor) –
[N, in_size]
tensor. Ifin_trans
is set, transposed.is_test (bool) – whether to assume testing mode.
- Returns
[N, out_size]
tensor. Ifout_trans
is set, transposed.- Return type
torch.Tensor
-
set_indexed
(indices, image_sizes)¶ Sets the index matrix for convolutions ans switches to indexed forward/backward/update versions.
- Parameters
indices (torch.Tensor) – torch.tensor with int indices
image_sizes (list) – [C_in, H_in, W_in, H_out, W_out] sizes
- Return type
None
-
update
(x_input, d_input)¶ Perform the update pass.
- Parameters
x_input (torch.Tensor) –
[N, in_size]
tensor. Ifin_trans
is set, transposed.d_input (torch.Tensor) –
[N, out_size]
tensor. Ifout_trans
is set, transposed.
- Return type
None
-