Spaces:
Running
Running
Download models/conditional_vector_field.py from mradovic38/sprite-flow: direct link, hf CLI and curl.
- Browser
- Download file 491 Bytes
-
https://huggingface.co/spaces/mradovic38/sprite-flow/resolve/main/models/conditional_vector_field.py
- Command line
-
hf download hf://spaces/mradovic38/sprite-flow/models/conditional_vector_field.py
-
curl -L -o conditional_vector_field.py https://huggingface.co/spaces/mradovic38/sprite-flow/resolve/main/models/conditional_vector_field.py
491 Bytes
| from abc import abstractmethod, ABC | |
| import torch | |
| from torch import nn | |
| class ConditionalVectorField(nn.Module, ABC): | |
| """ | |
| MLP-parametrization of the learned vector field u_t^theta(x) | |
| """ | |
| def forward(self, x: torch.Tensor, t: torch.Tensor) -> torch.Tensor: | |
| """ | |
| Forward pass of the conditional vector field. | |
| :param x: shape (bs, c, h, w) | |
| :param t: shape (bs, 1, 1, 1) | |
| :return: u_t^theta(x|y) | |
| """ | |
| pass |