MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / to_tensor

Function to_tensor

utils/general_util.py:182–191  ·  view source on GitHub ↗
(x,from_numpy=True,dtype='float32',device='cuda:0')

Source from the content-addressed store, hash-verified

180
181
182def to_tensor(x,from_numpy=True,dtype='float32',device='cuda:0'):
183 if from_numpy:
184 x = torch.from_numpy(x)
185
186 if dtype=='float32':
187 x = x.type(torch.float32)
188 elif dtype =='long':
189 x = x.type(torch.long)
190 x = x.to(device)
191 return x
192
193def summary(model,file=sys.stderr):
194 def repr(model):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected