You could do something similar to what is done when loading the VGG19 network in this tutorial 259.
Create your CNN model with two attributes, train it and then just use the part you’re interested in. Something like:
def MyCNNNetwork(nn.Module):
    ...

def MyDenseNetwork(nn.Module):
     ...

def MyModule(nn.Module):
    def __init__(self, ...):
        super(self, MyModule).__init__()
        self.features = MyCNNNetwork(...)
        self.output = MyDenseNetwork(...)

    def forward(self, x):
        batch_size = x.size(0)
        return self.output(self.features(x).view(batch_size, -1))


model = MyModel(...)
my_training_routine(model) # Train your network

x = ... # A sample case
features_of_x = model.features(x)

I think that should do it.