Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/open-mmlab/mmengine
/ functions
Functions
2,962 in github.com/open-mmlab/mmengine
⨍
Functions
2,962
◇
Types & classes
482
↳
Endpoints
21
↓ 217 callers
Method
pop
Pop the value of the key. If class attribute ``lazy`` is True, the LazyObject will be built and returned. Args: key (str)
mmengine/config/config.py:173
↓ 184 callers
Method
items
Yield the keys and values of the dictionary. If class attribute ``lazy`` is False, the value of ``LazyObject`` or ``LazyAttr`` will b
mmengine/config/config.py:231
↓ 105 callers
Method
get
Get the registry record. If `key`` represents the whole object name with its module information, for example, `mmengine.model.BaseMod
mmengine/registry/registry.py:384
↓ 97 callers
Method
to
Overrides this method to call :meth:`BaseDataPreprocessor.to` additionally. Returns: nn.Module: The model itself.
mmengine/model/base_model/base_model.py:180
↓ 93 callers
Method
from_cfg
Build a runner from config. Args: cfg (ConfigType): A config used for building runner. Keys of ``cfg`` can see :m
mmengine/runner/runner.py:451
↓ 91 callers
Function
digit_version
Convert a version string into a tuple of integers. This method is usually used for comparing two versions. For pre-release versions: alpha <
mmengine/utils/version_utils.py:9
↓ 90 callers
Method
train
Launch training. Returns: nn.Module: The model after training.
mmengine/runner/runner.py:1702
↓ 88 callers
Function
print_log
Print a log message. Args: msg (str): The message to be logged. logger (Logger or str, optional): If the type of logger is
mmengine/logging/logger.py:327
↓ 87 callers
Method
get_instance
Get subclass instance by name if the name exists. If corresponding name instance has not been created, ``get_instance`` will create a
mmengine/utils/manager.py:81
↓ 84 callers
Method
build_runner
(self, cfg: Config)
mmengine/testing/runner_test_case.py:168
↓ 82 callers
Method
build
Return the attribute of the imported object. Returns: Any: attribute of the imported object.
mmengine/config/lazy.py:213
↓ 75 callers
Method
register_module
Register a module. A record will be added to ``self._module_dict``, whose key is the class name or the specified name, and value is t
mmengine/registry/registry.py:615
↓ 72 callers
Method
state_dict
Returns a dictionary containing log scalars, runtime information and resumed keys, which should be resumed. The returned ``state_dict
mmengine/logging/message_hub.py:349
↓ 70 callers
Method
get
Get the value of the key. If class attribute ``lazy`` is True, the LazyObject will be built and returned. Args: key (str)
mmengine/config/config.py:160
↓ 70 callers
Method
keys
Returns: list: Contains all keys in data_fields.
mmengine/structures/base_data_element.py:306
↓ 66 callers
Method
get_info
Get runtime information by key. If the key does not exist, this method will return default information. Args: key (str):
mmengine/logging/message_hub.py:305
↓ 60 callers
Method
fromfile
Build a Config instance from config file. Args: filename (str or Path): Name of config file. use_predefined_variables
mmengine/config/config.py:433
↓ 60 callers
Method
isfile
Check whether a file path is a file. Args: filepath (str or Path): Path to be checked whether it is a file. Returns:
mmengine/fileio/file_client.py:376
↓ 60 callers
Method
update
Override this method to make sure the LazyObject will not be built during updating.
mmengine/config/config.py:186
↓ 54 callers
Method
device
(self)
mmengine/model/base_model/data_preprocessor.py:81
↓ 53 callers
Method
step
Call the step method of optimizer.
mmengine/optim/optimizer/base.py:40
↓ 53 callers
Method
values
Yield the values of the dictionary. If class attribute ``lazy`` is False, the value of ``LazyObject`` or ``LazyAttr`` will be built a
mmengine/config/config.py:220
↓ 52 callers
Method
exists
Check whether a file path exists. Args: filepath (str or Path): Path to be checked whether exists. Returns:
mmengine/fileio/file_client.py:352
↓ 51 callers
Method
get_current_instance
Get latest created ``MMLogger`` instance. :obj:`MMLogger` can call :meth:`get_current_instance` before any instance has been created,
mmengine/logging/logger.py:278
↓ 50 callers
Function
assert_allclose
Asserts that ``actual`` and ``expected`` are close. A wrapper function of ``torch.testing.assert_allclose``. Args: actual (Any): Actu
mmengine/testing/compare.py:17
↓ 50 callers
Function
build_from_cfg
Build a module from config dict when it is a class configuration, or call a function from config dict when it is a function configuration. If
mmengine/registry/build_functions.py:17
↓ 42 callers
Method
get
(self, filepath)
tests/test_fileio/test_fileclient.py:615
↓ 40 callers
Method
cpu
Overrides this method to call :meth:`BaseDataPreprocessor.cpu` additionally. Returns: nn.Module: The model itself.
mmengine/model/base_model/base_model.py:273
↓ 40 callers
Method
rmtree
Recursively delete a directory tree. Args: dir_path (str or Path): A directory to be removed. Examples: >>>
mmengine/fileio/backends/local_backend.py:423
↓ 38 callers
Method
call_hook
Call all hooks. Args: fn_name (str): The function name in each hook to be called, such as "before_train_epoch".
mmengine/runner/runner.py:1827
↓ 38 callers
Method
list_dir_or_file
Scan a directory to find the interested directories or files in arbitrary order. Note: :meth:`list_dir_or_file` returns t
mmengine/fileio/file_client.py:435
↓ 37 callers
Method
update_info
Update runtime information. The key corresponding runtime information will be overwritten each time calling ``update_info``.
mmengine/logging/message_hub.py:182
↓ 36 callers
Method
total
Returns the total aggregated statistic across all operators for the requested module. Args: module_name (str): The submod
mmengine/analysis/jit_analysis.py:257
↓ 35 callers
Method
build
Build an instance. Build an instance by calling :attr:`build_func`. Args: cfg (dict): Config dict needs to be built.
mmengine/registry/registry.py:548
↓ 35 callers
Method
cuda
Overrides this method to call :meth:`BaseDataPreprocessor.cuda` additionally. Returns: nn.Module: The model itself.
mmengine/model/base_model/base_model.py:210
↓ 32 callers
Function
has_method
Check whether the object has a method. Args: method (str): The method name to check. obj (object): The object to check. Retu
mmengine/utils/misc.py:423
↓ 32 callers
Method
setup_data
(self)
tests/test_structures/test_data_element.py:55
↓ 31 callers
Method
format
Override the `logging.Formatter.format`` method `. Output the message according to the specified log level. Args: record
mmengine/logging/logger.py:104
↓ 31 callers
Method
join_path
r"""Concatenate all file paths. Join one or more filepath components intelligently. The return value is the concatenation of filepath
mmengine/fileio/file_client.py:388
↓ 31 callers
Method
list_dir_or_file
Scan a directory to find the interested directories or files in arbitrary order. Note: Petrel has no concept of directori
mmengine/fileio/backends/petrel_backend.py:650
↓ 30 callers
Method
copy
Returns a copy of the :class:`JitModelAnalysis` object, keeping all settings, but on a new model or new inputs. Args: new
mmengine/analysis/jit_analysis.py:417
↓ 30 callers
Method
test
Launch test. Returns: dict: A dict of metrics on testing set.
mmengine/runner/runner.py:1804
↓ 29 callers
Method
clone
Deep copy the current data element. Returns: BaseDataElement: The copy of current data element.
mmengine/structures/base_data_element.py:295
↓ 29 callers
Method
dump
Dump config to file or return config text. Args: file (str or Path, optional): If not specified, then the object is d
mmengine/config/config.py:1555
↓ 28 callers
Method
_file2dict
Transform file to variables dictionary. Args: filename (str): Name of config file. use_predefined_variables (bool, op
mmengine/config/config.py:825
↓ 28 callers
Function
assert_tensor_equal
(tensor_a, tensor_b)
tests/test_runner/test_checkpoint.py:56
↓ 27 callers
Function
get_file_backend
Return a file backend based on the prefix of uri or backend_args. Args: uri (str or Path): Uri to be parsed that contains the file prefix
mmengine/fileio/io.py:103
↓ 26 callers
Method
get
Read data from a given ``filepath`` with 'rb' mode. Note: There are two types of return values for ``get``, one is ``bytes``
mmengine/fileio/file_client.py:285
↓ 26 callers
Method
get_scalar
Get ``HistoryBuffer`` instance by key. Note: Considering the large memory footprint of history buffers in the post-tr
mmengine/logging/message_hub.py:285
↓ 26 callers
Method
get_text
Read data from a given ``filepath`` with 'r' mode. Args: filepath (str or Path): Path to read data. encoding (str): T
mmengine/fileio/file_client.py:303
↓ 24 callers
Method
_test_scheduler_value
(self, schedulers, targets,
tests/test_optim/test_scheduler/test_param_scheduler.py:242
↓ 24 callers
Method
_test_scheduler_value
(self, schedulers, targets,
tests/test_optim/test_scheduler/test_lr_scheduler.py:195
↓ 23 callers
Method
before_train
Finish all operations, related to checkpoint. This function will get the appropriate file client, and the directory to save these che
mmengine/hooks/checkpoint_hook.py:258
↓ 23 callers
Method
get_data_info
Get annotation by index and automatically call ``full_init`` if the dataset has not been fully initialized. Args: idx (in
mmengine/dataset/base_dataset.py:250
↓ 22 callers
Method
__setattr__
(self, name, value)
mmengine/config/config.py:1505
↓ 22 callers
Method
_test_scheduler_value
(self, optimizer, schedulers,
tests/test_optim/test_scheduler/test_momentum_scheduler.py:214
↓ 22 callers
Function
autocast
A wrapper of ``torch.autocast`` and ``toch.cuda.amp.autocast``. Pytorch 1.5.0 provide ``torch.cuda.amp.autocast`` for running in mixed precis
mmengine/runner/amp.py:16
↓ 22 callers
Function
get_priority
Get priority value. Args: priority (int or str or :obj:`Priority`): Priority. Returns: int: The priority value.
mmengine/runner/priority.py:43
↓ 22 callers
Function
is_seq_of
Check whether it is a sequence of some type. Args: seq (Sequence): The sequence to be checked. expected_type (type or tuple): Exp
mmengine/utils/misc.py:132
↓ 22 callers
Method
update_scalar
Update :attr:_log_scalars. Update ``HistoryBuffer`` in :attr:`_log_scalars`. If corresponding key ``HistoryBuffer`` has been created,
mmengine/logging/message_hub.py:95
↓ 21 callers
Method
current
Return the recently updated values in log histories. Returns: np.ndarray: Recently updated values in log histories.
mmengine/logging/history_buffer.py:200
↓ 20 callers
Function
flop_count
Given a model and an input to the model, compute the per-operator Gflops of the given model. Adopted from https://github.com/facebookrese
mmengine/analysis/complexity_analysis.py:200
↓ 20 callers
Method
items
Returns: iterator: An iterator object whose element is (key, value) tuple pairs for ``data``.
mmengine/structures/base_data_element.py:366
↓ 19 callers
Method
detach
Detach all tensors in data.
mmengine/structures/base_data_element.py:546
↓ 19 callers
Method
mean
Return the mean of the latest ``window_size`` values in log histories. If ``window_size is None`` or ``window_size > len(self._log_hi
mmengine/logging/history_buffer.py:138
↓ 19 callers
Method
set_data
Set or change key-value pairs in ``data_field`` by parameter ``data``. Args: data (dict): A dict contains annotations of
mmengine/structures/base_data_element.py:235
↓ 18 callers
Method
_map_path
Map ``filepath`` to a string path whose prefix will be replaced by :attr:`self.path_mapping`. Args: filepath (str or Path
mmengine/fileio/backends/petrel_backend.py:55
↓ 18 callers
Method
to_dict
Convert all data in the config to a builtin ``dict``. Args: keep_imported (bool): Whether to keep the imported field.
mmengine/config/config.py:1710
↓ 18 callers
Method
unsupported_ops_warnings
Sets if warnings for unsupported operators are shown. Defaults to True. Counts of unsupported operators may be obtained from :meth:`u
mmengine/analysis/jit_analysis.py:482
↓ 17 callers
Method
_format_path
Convert a ``filepath`` to standard format of petrel oss. If the ``filepath`` is concatenated by ``os.path.join``, in a Windows enviro
mmengine/fileio/backends/petrel_backend.py:68
↓ 17 callers
Method
build_iter_from_epoch
Build an iter-based instance of this scheduler from an epoch-based config.
mmengine/optim/scheduler/param_scheduler.py:271
↓ 17 callers
Method
build_optim_wrapper
Build optimizer wrapper. If ``optim_wrapper`` is a config dict for only one optimizer, the keys must contain ``optimizer``, and ``typ
mmengine/runner/runner.py:987
↓ 17 callers
Method
draw_featmap
Draw featmap. - If `overlaid_image` is not None, the final output image will be the weighted sum of img and featmap. - If
mmengine/visualization/visualizer.py:918
↓ 17 callers
Method
isfile
Check whether a file path is a file. Args: filepath (str or Path): Path to be checked whether it is a file. Returns:
mmengine/fileio/backends/petrel_backend.py:222
↓ 17 callers
Function
register_backend
Register a backend. Args: name (str): The name of the registered backend. backend (class, optional): The backend class to be regi
mmengine/fileio/backends/registry_utils.py:63
↓ 17 callers
Function
save_checkpoint
Save checkpoint to file. Args: checkpoint (dict): Module whose params are to be saved. filename (str): Checkpoint filename.
mmengine/runner/checkpoint.py:732
↓ 16 callers
Method
copyfile
Copy a file src to dst and return the destination file. src and dst should have the same prefix. If dst specifies a directory, the fi
mmengine/fileio/backends/local_backend.py:202
↓ 16 callers
Method
exists
Check whether a file path exists. Args: filepath (str or Path): Path to be checked whether exists. Returns:
mmengine/fileio/backends/petrel_backend.py:167
↓ 16 callers
Method
get_backend
Get vis backend by name. Args: name (str): The name of vis backend Returns: BaseVisBackend: The vis backend
mmengine/visualization/visualizer.py:358
↓ 16 callers
Function
is_model_wrapper
Check if a module is a model wrapper. The following 4 model in MMEngine (and their subclasses) are regarded as model wrappers: DataParallel,
mmengine/model/wrappers/utils.py:7
↓ 16 callers
Method
load_state_dict
Loads log scalars, runtime information and resumed keys from ``state_dict`` or ``message_hub``. If ``state_dict`` is a dictionary ret
mmengine/logging/message_hub.py:382
↓ 16 callers
Method
put_text
Write data to a given ``filepath`` with 'w' mode. Note: ``put_text`` should create a directory if the directory of ``
mmengine/fileio/file_client.py:329
↓ 16 callers
Method
remove
Remove a file. Args: filepath (str, Path): Path to be removed.
mmengine/fileio/file_client.py:344
↓ 16 callers
Method
val
Launch validation. Returns: dict: A dict of metrics on validation set.
mmengine/runner/runner.py:1781
↓ 15 callers
Method
__init__
(self, data_preprocessor=None)
tests/test_runner/test_runner.py:67
↓ 15 callers
Method
after_val_epoch
Save the checkpoint and synchronize buffers after each evaluation epoch. Args: runner (Runner): The runner of the trainin
mmengine/hooks/checkpoint_hook.py:347
↓ 15 callers
Method
draw_texts
Draw single or multiple text boxes. Args: texts (Union[str, List[str]]): Texts to draw. positions (Union[np.ndarray,
mmengine/visualization/visualizer.py:421
↓ 15 callers
Function
get_shape
Get the shapes from a jit value object. Args: val (torch._C.Value): jit value object. Returns: list(int): return a list of i
mmengine/analysis/jit_handles.py:26
↓ 15 callers
Function
is_list_of
Check whether it is a list of some type. A partial method of :func:`is_seq_of`.
mmengine/utils/misc.py:166
↓ 15 callers
Function
is_musa_available
()
mmengine/device/utils.py:112
↓ 15 callers
Method
time
(cls)
tests/test_hooks/test_iter_timer_hook.py:13
↓ 14 callers
Function
get_device
Returns the currently existing device type. Returns: str: cuda | npu | mlu | mps | musa | cpu.
mmengine/device/utils.py:138
↓ 14 callers
Function
is_cuda_available
Returns True if cuda devices exist.
mmengine/device/utils.py:61
↓ 14 callers
Function
load
Load data from json/yaml/pickle files. This method provides a unified api for loading data from serialized files. ``load`` supports loading
mmengine/fileio/io.py:792
↓ 13 callers
Method
add_scalar
Record the scalar data to tensorboard. Args: name (str): The scalar identifier. value (int, float, torch.Tensor, np.n
mmengine/visualization/vis_backend.py:591
↓ 13 callers
Method
build_evaluator
Build evaluator. Examples of ``evaluator``:: # evaluator could be a built Evaluator instance evaluator = Evaluator(m
mmengine/runner/runner.py:1279
↓ 13 callers
Method
build_param_scheduler
Build parameter schedulers. ``build_param_scheduler`` should be called after ``build_optim_wrapper`` because the building logic will
mmengine/runner/runner.py:1190
↓ 13 callers
Method
check_key_value
(self, instances, metainfo=None, data=None)
tests/test_structures/test_data_element.py:74
↓ 13 callers
Method
clear_work_dir
(self)
mmengine/testing/runner_test_case.py:189
↓ 13 callers
Method
exists
Check whether a file path exists. Args: filepath (str or Path): Path to be checked whether exists. Returns:
mmengine/fileio/backends/local_backend.py:105
next →
1–100 of 2,962, ranked by callers