If you create a filter(fn, list), if the "fn" returns a tensor([True]) for a given element, why does the element of the list incorrectly get excluded?
If you create a filter(fn, list), if the "fn" returns a tensor([True]) for a given element, why does the element of the list incorrectly get excluded?
The answer is because tensor([True]) does not immediately evaluate to True for some reason. You need to wrap a bool(...) around tensor([True]) and it will work.