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

Method to_dict

fastdeploy/engine/pooling_params.py:92–105  ·  view source on GitHub ↗

Convert instance to dictionary including only non-None attributes.

(self)

Source from the content-addressed store, hash-verified

90 }
91
92 def to_dict(self) -> Dict[str, Any]:
93 """Convert instance to dictionary including only non-None attributes."""
94 result = {}
95 for field_name in self.__annotations__:
96 if field_name == "output_kind":
97 continue
98 value = getattr(self, field_name, None)
99 if isinstance(value, PoolingParams):
100 result[field_name] = value.to_dict()
101 else:
102 result[field_name] = value
103 if self.extra_kwargs:
104 result.update(self.extra_kwargs)
105 return result
106
107 @classmethod
108 def from_dict(cls, data: Dict[str, Any]) -> "PoolingParams":

Callers

nothing calls this directly

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected