Shortcuts

ToTensor

class mmcv.transforms.ToTensor(keys: Sequence[str])[source]

Convert some results to torch.Tensor by given keys.

Required keys:

  • all these keys in keys

Modified Keys:

  • all these keys in keys

Parameters

keys (Sequence[str]) – Keys that need to be converted to Tensor.

transform(results: dict)dict[source]

Transform function to convert data to torch.Tensor.

Parameters

results (dict) – Result dict from loading pipeline.

Returns

keys in results will be updated.

Return type

dict