Shortcuts

pypose.hasnan

class pypose.hasnan(obj)[source]

Checks whether a deep nested list of tensors contains Nan or not.

Parameters:

obj (obj) – a Python object that can be a list of nested list.

Returns:

True if the list contains a tensor with Nan otherwise False.

Return type:

bool

Example

>>> L1 = [[1, 3], [4, [5, 6]], 7, [8, torch.tensor([0, -1.0999])]]
>>> hasnan(L1)
False
>>> L2 = [[torch.tensor([float('nan'), -1.0999]), 3], [4, [5, 6]], 7, [8, 9]]
>>> hasnan(L2)
True
>>> L3 = [[torch.tensor([1, -1.0999]), 3], [4, [float('nan'), 6]], 7, [8, 9]]
>>> hasnan(L3)
True

Docs

Access documentation for PyPose

View Docs

Tutorials

Get started with tutorials and examples

View Tutorials

Get Started

Find resources and how to start using pypose

View Resources