Files
MrForExample-ComfyUI-3D-Pack/Gen_3D_Modules/Stable3DGen/trellis/modules/sparse/linear.py
T
2025-05-27 20:46:38 +00:00

16 lines
387 B
Python

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))