You can change your pytorch code to
self.pool= nn.MaxPool3d(kernel_size=3, stride=2, ceil_mode=True)

Since the default ceil_mode is False. It will ignore the last kernel when its size is smaller than the kernel size. While caffe use ceil mode.