Closed Hugh-888 closed 1 month ago
warnings.filterwarnings('ignore')
是global的,用下面代码实现local的效果
import warnings
def my_function():
with warnings.catch_warnings():
warnings.filterwarnings('ignore')
# Your code here
# The 'ignore' filter only applies within this context
# Outside the function, the original warning settings are still in effect
Problem
UserWarning for
torch.repeat_interleave
Code:
Possible solution
warnings.filterwarnings('ignore')