Retrieve a random tensor by name, sampling if necessary.
(name: str, tensor_fn, batch_dim: int = 0)
| 228 | rnd: Dict[str, torch.Tensor] = OrderedDict() # we will fill this |
| 229 | |
| 230 | def _get(name: str, tensor_fn, batch_dim: int = 0): |
| 231 | """Retrieve a random tensor by name, sampling if necessary.""" |
| 232 | if params is not None and name in params: |
| 233 | return params[name].transpose(0, batch_dim) |
| 234 | t = tensor_fn() |
| 235 | rnd[name] = t.transpose(0, batch_dim) |
| 236 | return t |
| 237 | |
| 238 | labels: List[torch.Tensor] = [torch.zeros([images.shape[0], 0], device=device)] |
| 239 |
nothing calls this directly
no outgoing calls
no test coverage detected