ToTensor¶ class mmcv.transforms.ToTensor(keys: Sequence[str])[源代码]¶ Convert some results to torch.Tensor by given keys. Required keys: all these keys in keys Modified Keys: all these keys in keys 参数 keys (Sequence[str]) – Keys that need to be converted to Tensor. transform(results: dict) → dict[源代码]¶ Transform function to convert data to torch.Tensor. 参数 results (dict) – Result dict from loading pipeline. 返回 keys in results will be updated. 返回类型 dict