Spaces:
Configuration error
Configuration error
Download trellis2/modules/sparse/linear.py from opsiclear-admin/Trellis.2.multiview: direct link, hf CLI and curl.
- Browser
- Download file 402 Bytes
-
https://huggingface.co/spaces/opsiclear-admin/Trellis.2.multiview/resolve/main/trellis2/modules/sparse/linear.py
- Command line
-
hf download hf://spaces/opsiclear-admin/Trellis.2.multiview/trellis2/modules/sparse/linear.py
-
curl -L -o linear.py https://huggingface.co/spaces/opsiclear-admin/Trellis.2.multiview/resolve/main/trellis2/modules/sparse/linear.py
402 Bytes
| import torch | |
| import torch.nn as nn | |
| from . import VarLenTensor | |
| __all__ = [ | |
| 'SparseLinear' | |
| ] | |
| class SparseLinear(nn.Linear): | |
| def __init__(self, in_features, out_features, bias=True): | |
| super(SparseLinear, self).__init__(in_features, out_features, bias) | |
| def forward(self, input: VarLenTensor) -> VarLenTensor: | |
| return input.replace(super().forward(input.feats)) | |