()
| 41 | |
| 42 | |
| 43 | def test_layer_spec_validate_unset(): |
| 44 | class SubSpec(ctranslate2.specs.LayerSpec): |
| 45 | def __init__(self): |
| 46 | self.attr_1 = None |
| 47 | |
| 48 | class Spec(ctranslate2.specs.LayerSpec): |
| 49 | def __init__(self): |
| 50 | self.attr_1 = np.zeros([5], dtype=np.float32) |
| 51 | self.attr_2 = None |
| 52 | self.attr_3 = SubSpec() |
| 53 | |
| 54 | spec = Spec() |
| 55 | |
| 56 | with pytest.raises(ValueError, match="attr_2\nattr_3.attr_1"): |
| 57 | spec.validate() |
| 58 | |
| 59 | |
| 60 | def test_layer_spec_optimize(): |