PRBonn / lidar-bonnetal

Semantic and Instance Segmentation of LiDAR point clouds for autonomous driving
http://semantic-kitti.org
MIT License
915 stars 204 forks source link

Question about stub #71

Closed iris0329 closed 3 years ago

iris0329 commented 3 years ago

Hi, Thank you for generously opening up this code !

I found that there is a piece of code as:

       #  print number of parameters and the ones requiring gradients
        stub = torch.zeros((1,
                            self.backbone.get_input_depth(),
                            64,
                            1024))
        if torch.cuda.is_available():
            stub = stub.cuda()
            self.backbone.cuda()
        _, stub_skips = self.backbone(stub)

I am curious about the function of this piece of code. Although there is a line of comments here, I still don't quite understand what the code does. Could you please give more detailed explanation?

I am looking forward to your reply

Best wishes !

tano297 commented 3 years ago

Hi,

This is a quick and dirty way to check the sizes of the activations in the encoder when I build the decoder. If you look at the backbone execution, it returns 2 values: the last feature volume, and all the feature volumes at all output strides (stub_skips in this case). This is later passed to the constructor of the decoder so it can verify that its layers that use skip connections have the proper sizes.

iris0329 commented 3 years ago

@tano297 Thank you for your reply. Does that mean "If I comment out these lines, it will not affect the function of the program"?