Shortcuts

Source code for rising.utils.checktype

from typing import Any, Union

import torch


[docs]def check_scalar(x: Union[Any, float, int]) -> bool: """ Provide interface to check for scalars Args: x: object to check for scalar Returns: bool" True if input is scalar """ return isinstance(x, (int, float)) or (isinstance(x, torch.Tensor) and x.numel() == 1)

© Copyright Copyright (c) 2019-2020, Justus Schock, Michael Baumgartner.. Revision b9cd7e8f.

Read the Docs v: v0.3.0
Versions
latest
stable
v0.3.0
v0.2.2
v0.2.1
v0.2.0post0
v0.2.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.