(img)
| 144 | |
| 145 | |
| 146 | def numpy2tensor(img): |
| 147 | x0 = torch.from_numpy(img.copy()).float().cuda() / 255.0 * 2.0 - 1.0 |
| 148 | x0 = torch.stack([x0], dim=0) |
| 149 | # einops.rearrange(x0, 'b h w c -> b c h w').clone() |
| 150 | return x0.permute(0, 3, 1, 2) |
| 151 | |
| 152 | |
| 153 | def calc_mean_std(feat, eps=1e-5, chunk=1): |
no test coverage detected