Shortcuts

BaseDataPreprocessor

class mmengine.model.BaseDataPreprocessor(non_blocking=False)[源代码]

Base data pre-processor used for copying data to the target device.

Subclasses inherit from BaseDataPreprocessor could override the forward method to implement custom data pre-processing, such as batch-resize, MixUp, or CutMix.

参数:

non_blocking (bool) – Whether block current process when transferring data to device. New in version 0.3.0.

备注

Data dictionary returned by dataloader must be a dict and at least contain the inputs key.

cast_data(data)[源代码]

Copying data to the target device.

参数:

data (dict) – Data returned by DataLoader.

返回:

Inputs and data sample at target device.

返回类型:

CollatedResult

cpu(*args, **kwargs)[源代码]

Overrides this method to set the device

返回:

The model itself.

返回类型:

nn.Module

cuda(*args, **kwargs)[源代码]

Overrides this method to set the device

返回:

The model itself.

返回类型:

nn.Module

forward(data, training=False)[源代码]

Preprocesses the data into the model input format.

After the data pre-processing of cast_data(), forward will stack the input tensor list to a batch tensor at the first dimension.

参数:
  • data (dict) – Data returned by dataloader

  • training (bool) – Whether to enable training time augmentation.

返回:

Data in the same format as the model input.

返回类型:

dict or list

mlu(*args, **kwargs)[源代码]

Overrides this method to set the device

返回:

The model itself.

返回类型:

nn.Module

musa(*args, **kwargs)[源代码]

Overrides this method to set the device

返回:

The model itself.

返回类型:

nn.Module

npu(*args, **kwargs)[源代码]

Overrides this method to set the device

返回:

The model itself.

返回类型:

nn.Module

to(*args, **kwargs)[源代码]

Overrides this method to set the device

返回:

The model itself.

返回类型:

nn.Module

Read the Docs v: latest
Versions
latest
stable
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.1
v0.9.0
v0.8.5
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.