MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / array2tensor

Function array2tensor

detrsmpl/core/renderer/torch3d_renderer/utils.py:53–60  ·  view source on GitHub ↗

Convert image array to tensor.

(image: np.ndarray)

Source from the content-addressed store, hash-verified

51
52
53def array2tensor(image: np.ndarray) -> torch.Tensor:
54 """Convert image array to tensor."""
55 image = torch.Tensor(image)
56 image = normalize(image,
57 origin_value_range=(0, 255),
58 out_value_range=(0, 1),
59 dtype=torch.float32)
60 return image
61
62
63def rgb2bgr(rgbs) -> Union[torch.Tensor, np.ndarray]:

Callers 1

wrap_textureMethod · 0.85

Calls 1

normalizeFunction · 0.85

Tested by

no test coverage detected