How to know which particular layer or Module (ASPP, Vortex Pooling) is consuming more Time and Operations in a Model Architecture?
I think you could add some code for timing in your forward function. For example,
def forward(self, x):
start = time.time()
out = self.aspp(x)
print(time.time() - start)
I am new to pytorch, so not sure if there is other better way to do it.
You could use the pytorch bottleneck to do so.
Note: if you want to do timing like this, you need to call
torch.cuda.synchronize()
before calling time.time()
due to the asynchronous behavior of cuda operations.
3 Likes