If I am reading this right, the shape of the output of the last convolution layer will be (batch_size, 128, 6, 4).
The first lambda layer
Lambda(lambda x: x.view(x.size(0),-1)),

reshapes the output to shape (batch_size, 12864).
The second lambda layer is a no-op given that the preceding lambda reshapes the output to 2 dimensions. This lambda seems to want to create the batch dimension with size 1 if it doesn’t already exist. This seems pointless given that the preceding convolution layers require a batch dimension.
Finally the model applies the linear layer.
I think you could replace
Lambda(lambda x: x.view(x.size(0),-1)), # Reshape,
nn.Sequential(Lambda(lambda x: x.view(1,-1) if 1==len(x.size()) else x),nn.Linear(3072,128)), # Linear,

with
Lambda(lambda x: x.view(x.size(0),-1)), # Reshape,
nn.Linear(3072,128), # Linear,

and get a model that functions identically.