nerfbaselines.utils¶
- class nerfbaselines.utils.CancellationToken(parent_token: CancellationToken | None = None)[source]¶
Bases:
object
- property cancelled¶
- class nerfbaselines.utils.Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]¶
Bases:
Formatter
- format(record: LogRecord)[source]¶
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
- class nerfbaselines.utils.IndicesClickType[source]¶
Bases:
ParamType
- convert(value, param, ctx)[source]¶
Convert the value to the correct type. This is not called if the value is
None
(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
param
andctx
arguments may beNone
in certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()
with a descriptive message.- Parameters:
value – The value to convert.
param – The parameter that is using this type to convert its value. May be
None
.ctx – The current context that arrived at this value. May be
None
.
- name: str = 'indices'¶
the descriptive name of this type
- class nerfbaselines.utils.MetricsAccumulator(options: Dict[str, Literal['average', 'last', 'sum']] | None = None)[source]¶
Bases:
object
- class nerfbaselines.utils.ResourcesUtilizationInfo[source]¶
Bases:
TypedDict
- gpu_memory: int¶
- gpu_name: str¶
- memory: int¶
- class nerfbaselines.utils.SetParamOptionType[source]¶
Bases:
ParamType
- convert(value, param, ctx)[source]¶
Convert the value to the correct type. This is not called if the value is
None
(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
param
andctx
arguments may beNone
in certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()
with a descriptive message.- Parameters:
value – The value to convert.
param – The parameter that is using this type to convert its value. May be
None
.ctx – The current context that arrived at this value. May be
None
.
- name: str = 'key-value'¶
the descriptive name of this type
- nerfbaselines.utils.apply_colormap(array: TTensor, *, pallete: str = 'viridis', invert: bool = False) TTensor [source]¶
- nerfbaselines.utils.cancellable(fn: TCallable, *, mark_only: bool = False, cancellation_token: CancellationToken | None = None) TCallable [source]¶
- nerfbaselines.utils.cancellable(*, mark_only: bool = False, cancellation_token: CancellationToken | None = None) Callable[[TCallable], TCallable]
- nerfbaselines.utils.flatten_hparams(hparams: Any, *, separator: str = '/', _prefix: str = '') Dict[str, Any] [source]¶
- nerfbaselines.utils.get_package_dependencies(extra=None, ignore: Set[str] | None = None, ignore_viewer: bool = False)[source]¶
- nerfbaselines.utils.get_resources_utilization_info(pid: int | None = None) ResourcesUtilizationInfo [source]¶
- nerfbaselines.utils.image_to_srgb(tensor, dtype, color_space: str | None = None, allow_alpha: bool = False, background_color: ndarray | None = None)[source]¶
- nerfbaselines.utils.make_image_grid(*images: ndarray, ncol=None, padding=2, max_width=1920, background: None | Tuple[float, float, float] | ndarray = None)[source]¶
- nerfbaselines.utils.padded_stack(tensors: ndarray | Tuple[ndarray, ...] | List[ndarray]) ndarray [source]¶