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

Function new_array_func

detrsmpl/core/conventions/keypoints_mapping/__init__.py:123–137  ·  view source on GitHub ↗
(shape, value, device_data, if_uint8)

Source from the content-addressed store, hash-verified

121 if isinstance(keypoints, torch.Tensor):
122
123 def new_array_func(shape, value, device_data, if_uint8):
124 if if_uint8:
125 dtype = torch.uint8
126 else:
127 dtype = None
128 if value == 1:
129 return torch.ones(size=shape,
130 dtype=dtype,
131 device=device_data.device)
132 elif value == 0:
133 return torch.zeros(size=shape,
134 dtype=dtype,
135 device=device_data.device)
136 else:
137 raise ValueError
138
139 def to_type_uint8_func(data):
140 return data.to(dtype=torch.uint8)

Callers 1

convert_kpsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected