Ejemplo n.º 1
0
    def __init__(self, input_width, input_height, input_channels, output_dim=128):
        super().__init__()

        self._output_dim = output_dim

        self.conv1 = nn.Conv2d(
            in_channels=input_channels,
            out_channels=8,
            kernel_size=(8, 8),
            stride=4
        )

        self.conv2 = nn.Conv2d(
            in_channels=8,
            out_channels=16,
            kernel_size=(4, 4),
            stride=2
        )

        self.final_width = net_util.convolutional_layer_series(input_width, [
            (8, 0, 4),
            (4, 0, 2),
        ])

        self.final_height = net_util.convolutional_layer_series(input_height, [
            (8, 0, 4),
            (4, 0, 2),
        ])

        self.linear_layer = nn.Linear(
            self.final_width * self.final_height * 16,
            self.output_dim
        )
Ejemplo n.º 2
0
    def __init__(self,
                 input_width,
                 input_height,
                 input_channels,
                 output_dim=512):
        super().__init__()

        self._output_dim = output_dim

        self.conv1 = nn.Conv2d(in_channels=input_channels,
                               out_channels=32,
                               kernel_size=(8, 8),
                               stride=4)

        self.conv2 = nn.Conv2d(in_channels=32,
                               out_channels=64,
                               kernel_size=(4, 4),
                               stride=2)

        self.conv3 = nn.Conv2d(in_channels=64,
                               out_channels=64,
                               kernel_size=(3, 3),
                               stride=1)

        self.final_width = net_util.convolutional_layer_series(
            input_width, [(8, 0, 4), (4, 0, 2), (3, 0, 1)])

        self.final_height = net_util.convolutional_layer_series(
            input_height, [(8, 0, 4), (4, 0, 2), (3, 0, 1)])

        self.linear_layer = nn.Linear(
            self.final_width * self.final_height *
            64,  # 64 is the number of channels of the last conv layer
            self.output_dim)
Ejemplo n.º 3
0
    def __init__(self, input_width, input_height, input_channels, output_dim=512):
        super().__init__()

        self._output_dim = output_dim

        # self.conv1 = nn.Conv2d(
        #     in_channels=input_channels,
        #     out_channels=32,
        #     kernel_size=(8, 8),
        #     stride=2
        # )
        self.conv1 = CoordConv(x_dim=133, y_dim=133, with_r=False,
            in_channels=input_channels+2,
            out_channels=32,
            kernel_size=(8, 8),
            stride=2
        )

        self.conv2 = nn.Conv2d(
            in_channels=32,
            out_channels=64,
            kernel_size=(4, 4),
            stride=2
        )

        self.conv3 = nn.Conv2d(
            in_channels=64,
            out_channels=64,
            kernel_size=(3, 3),
            stride=1
        )

        self.linear1 = nn.Linear(5, 1024)
        self.linear2 = nn.Linear(1024, 512)


        self.final_width = net_util.convolutional_layer_series(input_width, [
            (8, 0, 2),
            (4, 0, 2),
            (3, 0, 1)
        ])

        self.final_height = net_util.convolutional_layer_series(input_height, [
            (8, 0, 2),
            (4, 0, 2),
            (3, 0, 1)
        ])

        self.linear_layer1 = nn.Linear(
            self.final_width * self.final_height * 64*1 + 512,  # 64 is the number of channels of the last conv layer
            1024
        )
        self.linear_layer2 = nn.Linear(1024, self.output_dim)
Ejemplo n.º 4
0
    def __init__(self,
                 input_width,
                 input_height,
                 input_channels,
                 output_dim=512,
                 initial_std_dev=0.4,
                 factorized_noise=True):
        super().__init__()

        self._output_dim = output_dim

        self.conv1 = nn.Conv2d(in_channels=input_channels,
                               out_channels=32,
                               kernel_size=(8, 8),
                               stride=4)

        self.conv2 = nn.Conv2d(in_channels=32,
                               out_channels=64,
                               kernel_size=(4, 4),
                               stride=2)

        self.conv3 = nn.Conv2d(in_channels=64,
                               out_channels=64,
                               kernel_size=(3, 3),
                               stride=1)

        self.final_width = net_util.convolutional_layer_series(
            input_width, [(8, 0, 4), (4, 0, 2), (3, 0, 1)])

        self.final_height = net_util.convolutional_layer_series(
            input_height, [(8, 0, 4), (4, 0, 2), (3, 0, 1)])

        self.linear_layer_one = NoisyLinear(
            # 64 is the number of channels of the last conv layer
            self.final_width * self.final_height * 64,
            self.output_dim,
            initial_std_dev=initial_std_dev,
            factorized_noise=factorized_noise)

        self.linear_layer_two = NoisyLinear(
            # 64 is the number of channels of the last conv layer
            self.final_width * self.final_height * 64,
            self.output_dim,
            initial_std_dev=initial_std_dev,
            factorized_noise=factorized_noise)