Here is an example which causes pytorch throw warning.
import torch a = torch.tensor([False, True]).reshape([1, 2]) b = torch.tensor([False, True]).reshape([2, 1]) c = torch.logical_xor(a, b)
The warning detail is
/home/hzhangxyz/Downloads/tmp.py:5: UserWarning: An output with one or more elements was resized since it had shape [1, 2], which does not match the required output shape [2, 2]. This behavior is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize_(0). (Triggered internally at /build/python-pytorch/src/pytorch-opt/aten/src/ATen/native/Resize.cpp:28.) c = torch.logical_xor(a, b)
Pytorch throws such warning in version 2.1.0 but did not throw such warning in version 2.0.1.