(s: Union[bool, torch.SymBool])
| 256 | |
| 257 | |
| 258 | def serialize_sym_bool(s: Union[bool, torch.SymBool]) -> SymBool: |
| 259 | if isinstance(s, (torch.SymBool, bool)): |
| 260 | if symbolic_shapes.is_concrete_bool(s): |
| 261 | return SymBool.create(as_bool=bool(s)) |
| 262 | else: |
| 263 | return SymBool.create(as_expr=SymExpr(expr_str=str(s))) |
| 264 | else: |
| 265 | raise SerializeError( |
| 266 | f"SymBool should be either symbol or bool, got `{s}` of type `{type(s)}`" |
| 267 | ) |
| 268 | |
| 269 | |
| 270 | def serialize_tensor_meta(t: torch.Tensor) -> TensorMeta: |
no test coverage detected