declearn.utils.deserialize_object
Return an object from a ObjectConfig serialization or JSON file.
This function is the counterpart to declearn.utils.serialize_object
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
Union[str, ObjectConfig, ObjectConfigDict]
|
Either an ObjectConfig object, the dict representation of one, or the path to a JSON file that stores an ObjectConfig dump. |
required |
custom |
Optional[Dict[str, Type[SupportsConfig]]]
|
Optional dict providing with a {name: type} mapping to enable
deserializing user-defined types that have not been registered
using |
None
|
Returns:
Name | Type | Description |
---|---|---|
obj |
object
|
An object instantiated from the provided configuration. |
Raises:
Type | Description |
---|---|
TypeError
|
If |
KeyError
|
If |
Source code in declearn/utils/_serialize.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|