MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / PoolingSequenceGroupOutput

Class PoolingSequenceGroupOutput

fastdeploy/output/pooler.py:23–48  ·  view source on GitHub ↗

The model output associated with a pooling sequence group.

Source from the content-addressed store, hash-verified

21
22
23class PoolingSequenceGroupOutput(
24 msgspec.Struct,
25 omit_defaults=True,
26 array_like=True,
27):
28 """The model output associated with a pooling sequence group."""
29
30 # Annotated as Any to be compatible with msgspec
31 # The actual type is in SequenceGroup.pooled_data
32 data: Any
33
34 def get_data_nbytes(self) -> int:
35 if isinstance(self.data, paddle.Tensor):
36 return self.data.numel() * self.data.element_size()
37 elif hasattr(self.data, "nbytes"):
38 return self.data.nbytes
39 else:
40 return 0
41
42 def __repr__(self) -> str:
43 return f"PoolingSequenceGroupOutput(data={self.data}"
44
45 def __eq__(self, other: object) -> bool:
46 if not isinstance(other, PoolingSequenceGroupOutput):
47 raise NotImplementedError()
48 return self.data == other.data
49
50
51class PoolerOutput(msgspec.Struct, omit_defaults=True, array_like=True):

Callers 13

test_reprMethod · 0.90
test_eq_sameMethod · 0.90
test_eq_diffMethod · 0.90
test_len_and_indexMethod · 0.90
test_setitemMethod · 0.90
test_eq_sameMethod · 0.90
test_eq_diffMethod · 0.90

Calls

no outgoing calls

Tested by 13

test_reprMethod · 0.72
test_eq_sameMethod · 0.72
test_eq_diffMethod · 0.72
test_len_and_indexMethod · 0.72
test_setitemMethod · 0.72
test_eq_sameMethod · 0.72
test_eq_diffMethod · 0.72