How to use torch.ne and ne (other)
This article introduces the knowledge of "how to use torch.ne and ne (other)". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Function function: compare element by element to see if elements are not equal
The code experiment shows:
Microsoft Windows [version 10.0.18363.1256] (c) 2019 Microsoft Corporation. All rights reserved. C:\ Users\ chenxuqi > conda activate ssd4pytorch2_2_0 (ssd4pytorch2_2_0) C:\ Users\ chenxuqi > pythonPython 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)]:: Anaconda, Inc. On win32Type "help", "copyright", "credits" or "license" for more information. > import torch > input = torch.tensor ([[1,2], [3,4]]) > > other = torch.tensor ([1,1], [4]) 4]]) > inputtensor ([[1,2], [3,4]]) > > othertensor ([1,1], [4,4]]) > torch.ne (input, other) tensor ([[False, True], [True, False]]) > "how to use torch.ne and ne (other)" ends here Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!