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

Method is_valid

extension/flat_tensor/serialize/serialize.py:175–180  ·  view source on GitHub ↗

Returns true if the flat_tensor header appears to be well-formed.

(self)

Source from the content-addressed store, hash-verified

173 )
174
175 def is_valid(self) -> bool:
176 """Returns true if the flat_tensor header appears to be well-formed."""
177 return (
178 self.magic == FlatTensorHeader.EXPECTED_MAGIC
179 and self.length >= FlatTensorHeader.EXPECTED_LENGTH
180 )
181
182 def to_bytes(self) -> bytes:
183 """Returns the binary representation of the flat_tensor header.

Callers 3

_get_extended_headerFunction · 0.45
deserializeMethod · 0.45

Calls

no outgoing calls

Tested by 1