View source on GitHub |
Test item of a FeatureExpectation.
tfds.testing.FeatureExpectationItem( value: Any, expected: Optional[Any] = None, expected_np: Optional[np.ndarray] = None, expected_serialized: Optional[Any] = None, decoders: Optional[utils.TreeDict[Any]] = None, dtype: Optional[tf.dtypes.DType] = None, shape: Optional[utils.Shape] = None, raise_cls: Optional[Type[Exception]] = None, raise_cls_np: Optional[Type[Exception]] = None, raise_msg: Optional[str] = None, atol: Optional[float] = None ) Should be passed to assertFeature method of FeatureExpectationsTestCase.
Each FeatureExpectationItem test an example serialization/deserialization ( feature.encode_example -> example_serializer.serialize_example -> example_parse.parse_example -> feature.decode_example).
Attributes | |
|---|---|
value | Input to features.encode_example |
expected | Expected output after features.decode_example |
expected_np | Expected output after features.decode_example_np |
expected_serialized | Optional |
decoders | Optional tfds.decode.Decoder objects (to overwrite the default features.decode_example). See https://www.tensorflow.org/datasets/decode. |
dtype | If decoders is provided, the output of decode_example is checked against this value (otherwise, output is checked against features.dtype) |
shape | If decoders is provided, the output of decode_example is checked against this value (otherwise, output is checked against features.shape) |
raise_cls | Expected error raised during features.encode_example. When set expected and expected_serialized should be None. |
raise_cls_np | Expected error raised during features.encode_example_np. When set expected_np and expected_serialized_np should be None. |
raise_msg | Expected error message regex. |
atol | If provided, compare float values with this precision (use default otherwise). |
Methods
__eq__
__eq__( other ) Class Variables | |
|---|---|
| atol | None |
| decoders | None |
| dtype | None |
| expected | None |
| expected_np | None |
| expected_serialized | None |
| raise_cls | None |
| raise_cls_np | None |
| raise_msg | None |
| shape | None |
View source on GitHub