Download engine/BiRefNet/models/modules/lateral_blocks.py from HexBuddy/LHM: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/HexBuddy/LHM/resolve/main/engine/BiRefNet/models/modules/lateral_blocks.py
- Command line
-
hf download hf://spaces/HexBuddy/LHM/engine/BiRefNet/models/modules/lateral_blocks.py
-
curl -L -o lateral_blocks.py https://huggingface.co/spaces/HexBuddy/LHM/resolve/main/engine/BiRefNet/models/modules/lateral_blocks.py
555 Bytes
| from functools import partial | |
| import numpy as np | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from engine.BiRefNet.config import Config | |
| config = Config() | |
| class BasicLatBlk(nn.Module): | |
| def __init__(self, in_channels=64, out_channels=64, inter_channels=64): | |
| super(BasicLatBlk, self).__init__() | |
| inter_channels = in_channels // 4 if config.dec_channels_inter == "adap" else 64 | |
| self.conv = nn.Conv2d(in_channels, out_channels, 1, 1, 0) | |
| def forward(self, x): | |
| x = self.conv(x) | |
| return x | |