I don’t think you can include a view into your sequential. Saw a post where they tried to make it into a layer but I wouldn’t bother. You’re not going to see that much speedup anyways. I suggest that you do something like this
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict

class MyModel(nn.Module):
  def __init__(self, zdim):
    super().__init__()
    self.fc1 = nn.Linear(zdim, 672)
    self.decode = nn.Sequential(OrderedDict([
            ('conv1',nn.ConvTranspose1d(32, 32, 8, 2, padding=3)),
            ('relu1',nn.ReLU()),
            ('bn1',nn.BatchNorm1d(32)),
            ('conv2',nn.ConvTranspose1d(32, 32, 8, 2, padding=3)),
            ('relu2',nn.ReLU()),
            ('bn2',nn.BatchNorm1d(32)),
            ('conv3',nn.ConvTranspose1d(32, 16, 8, 2, padding=3)),
            ('relu3',nn.ReLU()),
            ('bn3',nn.BatchNorm1d(16)),
        ]))
        
        
  def forward(self, z):
    z = F.relu(self.fc1(z))
    print(z)
    print(z.shape)
    z = z.view(-1, 32, 21)
    z = self.decode(z)
    print(z.shape)


zdim = 10
model = MyModel(zdim)
inputs = torch.randn(2, zdim)
outputs = model(inputs)