Пример #1
0
 def get_tile(self, out_size, in_size, device_params=None):
     """Return an floating point tile of the specified dimensions."""
     device_params = device_params or FloatingPointTileParameters()
     resistive_device = FloatingPointResistiveDevice(device_params)
     python_tile = FloatingPointTile(out_size, in_size, resistive_device)
     self.set_init_weights(python_tile)
     return python_tile
Пример #2
0
    def forward(ctx: Any,
                analog_tile: FloatingPointTile,
                input_: Tensor,
                weights: Tensor,
                _: Optional[Tensor] = None,
                is_test: bool = False) -> Tensor:
        """Execute the forward pass in the analog tile."""

        # Store in context for using during `backward()`.
        ctx.analog_tile = analog_tile
        ctx.weights = weights
        ctx.save_for_backward(input_)

        # Invoke the forward pass in the tile instance.
        return analog_tile.forward_indexed(input_, is_test)
Пример #3
0
 def get_tile(self, out_size, in_size, rpu_config=None, **kwargs):
     rpu_config = rpu_config or self.get_rpu_config()
     return FloatingPointTile(out_size, in_size, rpu_config, **kwargs)
Пример #4
0
 def get_tile(self, out_size, in_size, **kwargs):
     return FloatingPointTile(out_size, in_size, **kwargs).cuda()