Revert normalization for a given tensor by multiplying by the std and adding the mean. Args: tensor (tensor): tensor to revert normalization. mean (tensor or list): mean value to add. std (tensor or list): std to multiply.
(tensor, mean, std)
| 381 | |
| 382 | |
| 383 | def revert_tensor_normalize(tensor, mean, std): |
| 384 | """ |
| 385 | Revert normalization for a given tensor by multiplying by the std and adding the mean. |
| 386 | Args: |
| 387 | tensor (tensor): tensor to revert normalization. |
| 388 | mean (tensor or list): mean value to add. |
| 389 | std (tensor or list): std to multiply. |
| 390 | """ |
| 391 | if type(mean) == list: |
| 392 | mean = torch.tensor(mean) |
| 393 | if type(std) == list: |
| 394 | std = torch.tensor(std) |
| 395 | tensor = tensor * std |
| 396 | tensor = tensor + mean |
| 397 | return tensor |
| 398 | |
| 399 | |
| 400 | def create_sampler(dataset, shuffle, cfg): |
nothing calls this directly
no outgoing calls
no test coverage detected