MCPcopy Create free account
hub / github.com/CompVis/diff2flow / to_float32

Method to_float32

diff2flow/dataloader.py:192–198  ·  view source on GitHub ↗
(self, sample)

Source from the content-addressed store, hash-verified

190 return sample
191
192 def to_float32(self, sample):
193 for key in sample:
194 if isinstance(sample[key], np.ndarray):
195 sample[key] = sample[key].astype(np.float32)
196 elif isinstance(sample[key], torch.Tensor):
197 sample[key] = sample[key].float()
198 return sample
199
200 def train_dataloader(self):
201 return self.make_loader(self.train)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected