Spaces:
Runtime error
Runtime error
Download TRELLIS-main/trellis/modules/sparse/linear.py from 1xCode/FormaAI-Web: direct link, hf CLI and curl.
- Browser
- Download file 387 Bytes
-
https://huggingface.co/spaces/1xCode/FormaAI-Web/resolve/main/TRELLIS-main/trellis/modules/sparse/linear.py
- Command line
-
hf download hf://spaces/1xCode/FormaAI-Web/TRELLIS-main/trellis/modules/sparse/linear.py
-
curl -L -o linear.py https://huggingface.co/spaces/1xCode/FormaAI-Web/resolve/main/TRELLIS-main/trellis/modules/sparse/linear.py
387 Bytes
| import torch | |
| import torch.nn as nn | |
| from . import SparseTensor | |
| __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: SparseTensor) -> SparseTensor: | |
| return input.replace(super().forward(input.feats)) | |