traceability_util
FeInputSpec
¶
A class to keep track of a model's input so that fake inputs can be generated.
This class is intentionally not @traceable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_input |
Any
|
The input to the model. |
required |
model |
Model
|
The model which corresponds to the given |
required |
Source code in fastestimator/fastestimator/util/traceability_util.py
get_dummy_input
¶
Get fake input for the model.
Returns:
Type | Description |
---|---|
Any
|
Input of the correct shape and dtype for the model. |
FeSplitSummary
¶
Bases: LatexObject
A class to summarize splits performed on an FE Dataset.
This class is intentionally not @traceable.
Source code in fastestimator/fastestimator/util/traceability_util.py
add_split
¶
Record another split on this dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent |
Union[FEID, str]
|
The id of the parent involved in the split (or 'self' if you are the parent). |
required |
fraction |
str
|
The string representation of the split fraction that was used. |
required |
seed |
Optional[int]
|
The random seed used during the split. |
required |
stratify |
Optional[str]
|
The stratify key used during the split. |
required |
Source code in fastestimator/fastestimator/util/traceability_util.py
dumps
¶
Generate a LaTeX formatted representation of this object.
Returns:
Type | Description |
---|---|
str
|
A LaTeX string representation of this object. |
Source code in fastestimator/fastestimator/util/traceability_util.py
FeSummaryTable
¶
A class containing summaries of traceability information.
This class is intentionally not @traceable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The string to be used as the title line in the summary table. |
required |
fe_id |
FEID
|
The id of this table, used for cross-referencing from other tables. |
required |
target_type |
Type
|
The type of the object being summarized. |
required |
path |
Union[None, str, LatexObject]
|
The import path of the object in question. Might be more complicated when methods/functions are involved. |
None
|
kwargs |
Optional[Dict[str, Any]]
|
The keyword arguments used to instantiate the object being summarized. |
None
|
**fields |
Any
|
Any other information about the summarized object / function. |
{}
|
Source code in fastestimator/fastestimator/util/traceability_util.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
render_table
¶
Write this table into a LaTeX document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc |
Document
|
The LaTeX document to be appended to. |
required |
name_override |
Optional[LatexObject]
|
An optional replacement for this table's name field. |
None
|
toc_ref |
Optional[str]
|
A reference to be added to the table of contents. |
None
|
extra_rows |
Optional[List[Tuple[str, Any]]]
|
Any extra rows to be added to the table before the kwargs. |
None
|
Source code in fastestimator/fastestimator/util/traceability_util.py
fe_summary
¶
Return a summary of how this class was instantiated (for traceability).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
self |
The bound class instance. |
required |
Returns:
Type | Description |
---|---|
List[FeSummaryTable]
|
A summary of the instance. |
Source code in fastestimator/fastestimator/util/traceability_util.py
is_restorable
¶
Determine whether a given object can be restored easily via Pickle.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Any
|
The object in question. |
required |
memory_limit |
int
|
The maximum memory size (in bytes) to allow for an object (or 0 for no limit). |
0
|
Returns:
Type | Description |
---|---|
bool
|
(result, memory size) where result is True iff |
int
|
the |
Source code in fastestimator/fastestimator/util/traceability_util.py
trace_model
¶
A function to add traceability information to an FE-compiled model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Model
|
The model to be made traceable. |
required |
model_idx |
int
|
Which of the return values from the |
required |
model_fn |
Any
|
The function used to generate this model. |
required |
optimizer_fn |
Any
|
The thing used to define this model's optimizer. |
required |
weights_path |
Any
|
The path to the weights for this model. |
required |
Returns:
Type | Description |
---|---|
Model
|
The |
Source code in fastestimator/fastestimator/util/traceability_util.py
traceable
¶
A decorator to be placed on classes in order to make them traceable and to enable a deep restore.
Decorated classes will gain the .fe_summary() and .fe_state() methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
whitelist |
Union[str, Tuple[str, ...]]
|
Arguments which should be included in a deep restore of the decorated class. |
()
|
blacklist |
Union[str, Tuple[str, ...]]
|
Arguments which should be excluded from a deep restore of the decorated class. |
()
|
Returns:
Type | Description |
---|---|
Callable
|
The decorated class. |