Shortcuts

mmengine.dataset.default_collate

mmengine.dataset.default_collate(data_batch)[源代码]

Convert list of data sampled from dataset into a batch of data, of which type consistent with the type of each data_itement in data_batch.

Different from pseudo_collate(), default_collate will stack tensor contained in data_batch into a batched tensor with the first dimension batch size, and then move input tensor to the target device.

Different from default_collate in pytorch, default_collate will not process BaseDataElement.

This code is referenced from: Pytorch default_collate.

备注

default_collate only accept input tensor with the same shape.

参数

data_batch (Sequence) – Data sampled from dataset.

返回

Data in the same format as the data_itement of data_batch, of which tensors have been stacked, and ndarray, int, float have been converted to tensors.

返回类型

Any

Read the Docs v: v0.7.0
Versions
latest
stable
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.