torchoutil.nn.functional.predicate module¶
- all_eq(
- x: Tensor | ndarray | bool | int | float | complex | None | str | bytes | generic | Tensor0D | Iterable,
- dim: None = None,
- all_eq(
- x: T_TensorOrArray,
- dim: int,
Check if all elements are equal in a tensor, ndarray, iterable or scalar object.
- all_ne(
- x: Tensor | ndarray | bool | int | float | complex | None | str | bytes | generic | Tensor0D | Iterable,
Check if all elements are NOT equal in a tensor, ndarray, iterable or scalar object.
- can_be_converted_to_tensor(
- x: Any,
Returns True if inputs can be passed to torch.as_tensor function.
This function returns False for heterogeneous inputs like [[], 1], but this kind of value can be accepted by torch.as_tensor.
- can_be_stacked( ) typing_extensions.TypeGuard[List[Tensor] | Tuple[Tensor, ...]][source]¶
Returns True if inputs can be passed to torch.stack function, i.e. contains a list or tuple of tensors with the same shape.
- is_complex(
- x: Tensor,
- is_complex(
- x: ndarray,
- is_complex(
- x: complex,
- is_complex(
- x: Any,
Returns True if object is a/contains complex-valued object(s).
- is_convertible_to_tensor(
- x: Any,
Returns True if inputs can be passed to torch.as_tensor function.
This function returns False for heterogeneous inputs like [[], 1], but this kind of value can be accepted by torch.as_tensor.
- is_floating_point(
- x: Tensor,
- is_floating_point(
- x: ndarray,
- is_floating_point(
- x: float,
- is_floating_point(
- x: Any,
Returns True if object is a/contains floating-point object(s).
- is_full( ) bool[source]¶
Check if all element are equal to target in a tensor or array. Accept an optional value ‘target’ to specified the expected value.