CoolFace
Apppublic

souging/TRELLIS_TextTo3D

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
linear.py16 linesDownload Raw Back to sparse
1import torch2import torch.nn as nn3from . import SparseTensor4 5__all__ = [6    'SparseLinear'7]8 9 10class SparseLinear(nn.Linear):11    def __init__(self, in_features, out_features, bias=True):12        super(SparseLinear, self).__init__(in_features, out_features, bias)13 14    def forward(self, input: SparseTensor) -> SparseTensor:15        return input.replace(super().forward(input.feats))16