MCPcopy Create free account
hub / github.com/pytorch/executorch / serialize_sym_bool

Function serialize_sym_bool

exir/serde/export_serialize.py:258–267  ·  view source on GitHub ↗
(s: Union[bool, torch.SymBool])

Source from the content-addressed store, hash-verified

256
257
258def 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
270def serialize_tensor_meta(t: torch.Tensor) -> TensorMeta:

Callers 1

Calls 3

SymExprClass · 0.85
SerializeErrorClass · 0.85
createMethod · 0.45

Tested by

no test coverage detected