Can I use this CNN to train data rather than text?

class CNNnet(torch.nn.Module):
    def __init__(self):
        super(CNNnet,self).__init__()
        self.conv1 = torch.nn.Sequential(
            torch.nn.Conv1d(in_channels=32,
                            out_channels=2,
                            kernel_size=1,
                            stride=2,
                            padding=1),
            torch.nn.Sigmoid(),
            torch.nn.MaxPool1d(kernel_size=1)
        )

        self.conv2 = torch.nn.Sequential(
            torch.nn.Conv1d(in_channels=2,
                            out_channels=2,
                            kernel_size=1,
                            stride=2,
                            padding=1),
            torch.nn.Sigmoid(),
            torch.nn.MaxPool1d(kernel_size=1)
        )

        self.conv3 = torch.nn.Sequential(
            torch.nn.Conv1d(in_channels=2,
                            out_channels=2,
                            kernel_size=1,
                            stride=2,
                            padding=1),
            torch.nn.Sigmoid(),
            torch.nn.MaxPool1d(kernel_size=1)
        )
        
        self.mlp1 = torch.nn.Sequential(torch.nn.Linear(4,10),torch.nn.Sigmoid(),torch.nn.Linear(10,4))
       
    def forward(self, x):
        x = self.conv1(x)
        x = self.conv2(x)
        x = self.conv3(x)
        x = self.mlp1(x.view(x.size(0),-1))
        return x

I mean, such as prediction work?

Your model might be able to train, if the data provides enough information.
It’s a bit hard to provide a general statement, as it depends on the use case you are working with.
However, I would assume the more “temporal” structure your data has, the better.

1 Like

Thanks a lot for your reply