alibi_detect.saving.validators
Constants
has_tensorflow
has_tensorflowhas_tensorflow: bool = Truebool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
has_pytorch
has_pytorchhas_pytorch: bool = Truebool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
has_keops
has_keopshas_keops: bool = Truebool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
T
TT: TypeVar = ~TType variable.
Usage::
T = TypeVar('T') # Can be anything A = TypeVar('A', str, bytes) # Must be str or bytes
Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function definitions. See class Generic for more information on generic types. Generic functions work as follows:
def repeat(x: T, n: int) -> List[T]: '''Return a list containing n references to x.''' return [x]*n
def longest(x: A, y: A) -> A: '''Return the longest of two strings.''' return x if len(x) >= len(y) else y
The latter example's signature is essentially the overloading of (str, str) -> str and (bytes, bytes) -> bytes. Also note that if the arguments are instances of some subclass of str, the return type is still plain str.
At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError.
Type variables defined with covariant=True or contravariant=True can be used to declare covariant or contravariant generic types. See PEP 484 for more details. By default generic types are invariant in all type variables.
Type variables can be introspected. e.g.:
T.name == 'T' T.constraints == () T.covariant == False T.contravariant = False A.constraints == (str, bytes)
Note that only type variables defined in global scope can be pickled.
NDArray
NDArrayInherits from: Generic, ndarray
A Generic pydantic model to coerce to np.ndarray's.
Methods
validate
validatevalidate(val: typing.Any, field: pydantic.v1.fields.ModelField) -> Optional[numpy.ndarray]val
typing.Any
field
pydantic.v1.fields.ModelField
Returns
Type:
Optional[numpy.ndarray]
Functions
coerce_2_tensor
coerce_2_tensorcoerce_2_tensor(value: Union[float, List[float]], values: dict)value
Union[float, List[float]]
values
dict
coerce_int2list
coerce_int2listcoerce_int2list(value: int) -> List[int]Validator to coerce int to list (pydantic doesn't do this by default).
value
int
Returns
Type:
List[int]
validate_framework
validate_frameworkvalidate_framework(framework: str, field: pydantic.v1.fields.ModelField) -> strframework
str
field
pydantic.v1.fields.ModelField
Returns
Type:
str
Last updated
Was this helpful?

