张芷铭的个人博客

Python装饰器

这样写装饰器无法使用?

1
2
3
4
5
6
7
@track_cuda_memory_on_device(self.device.split(':')[-1])
    def calculate(self, video_tensor, video_binary: bytes, *args, **kwargs):
        """主计算方法"""
        start_time = time.time()
        T, H, W, C = video_tensor.shape
        video_segments = {}
        

💬 评论