Perhaps you can take the output (which is a list of probabilities) of resnet34, set the probabilities corresponding to the non-selected classes to zeroes, and normalize the remaining probabilities (scale them up by a uniform factor so that they again add up to 1)?
This seems to be the simplest interpretation of “drop some classes from resnet34”. Perhaps this will work for your purpose?