entry_point
stringlengths
1
65
original_triton_python_code
stringlengths
208
619k
optimised_triton_code
stringlengths
1.15k
275k
repo_name
stringlengths
7
115
module_name
stringlengths
1
65
synthetic
bool
1 class
uuid
int64
0
18.5k
licenses
listlengths
1
6
stars
int64
0
19.8k
sha
stringlengths
40
40
repo_link
stringlengths
72
180
TransposeGatedConv2d
import torch import torch.nn as nn from torch.nn import functional as F from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
delldu/DeepFillv2
TransposeGatedConv2d
false
6,565
[ "MIT" ]
1
a564b9589c1b42bcdddd3d7601f4059c4594a439
https://github.com/delldu/DeepFillv2/tree/a564b9589c1b42bcdddd3d7601f4059c4594a439
WSDiceLoss
import torch import torch.utils.data import torch.nn as nn import torch.nn.parallel class WSDiceLoss(nn.Module): def __init__(self, smooth=100.0, power=2.0, v2=0.85, v1=0.15): super().__init__() self.smooth = smooth self.power = power self.v2 = v2 self.v1 = v1 def dic...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
devaansh100/pytorch_connectomics
WSDiceLoss
false
6,566
[ "MIT" ]
1
b1e4b16b0480546ea806d14876208080815ed964
https://github.com/devaansh100/pytorch_connectomics/tree/b1e4b16b0480546ea806d14876208080815ed964
QuantizableHSigmoid
import torch import torch.nn as nn import torch.quantization class QuantizableHSigmoid(nn.Module): """Hard Sigmoid for quantization.""" def __init__(self, inplace: 'bool'=True) ->None: """Initialize.""" super(QuantizableHSigmoid, self).__init__() self.relu6 = nn.ReLU6(inplace=inplace)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.quantization assert_size_stride = torch._C._dynamo.gua...
dhlee347/model_compression
QuantizableHSigmoid
false
6,567
[ "MIT" ]
1
274b85ff56d81f0b7cf6907cbc1bd10e16cdb956
https://github.com/dhlee347/model_compression/tree/274b85ff56d81f0b7cf6907cbc1bd10e16cdb956
HSigmoid
import torch import torch.nn as nn import torch.quantization class HSigmoid(nn.Module): """Hard Sigmoid.""" def __init__(self, inplace: 'bool'=True) ->None: """Initialize.""" super(HSigmoid, self).__init__() self.relu6 = nn.ReLU6(inplace=inplace) def forward(self, x: 'torch.Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.quantization assert_size_stride = torch._C._dynamo.gua...
dhlee347/model_compression
HSigmoid
false
6,568
[ "MIT" ]
1
274b85ff56d81f0b7cf6907cbc1bd10e16cdb956
https://github.com/dhlee347/model_compression/tree/274b85ff56d81f0b7cf6907cbc1bd10e16cdb956
WeightedCE
import torch from typing import Optional from typing import List import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedCE(nn.Module): """Mask weighted multi-class cross-entropy (CE) loss. """ def __init__(self, class_weight: 'Optional[List[fl...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from typing import Opt...
devaansh100/pytorch_connectomics
WeightedCE
false
6,569
[ "MIT" ]
1
b1e4b16b0480546ea806d14876208080815ed964
https://github.com/devaansh100/pytorch_connectomics/tree/b1e4b16b0480546ea806d14876208080815ed964
QuantizableHSwish
import torch import torch.nn as nn import torch.quantization class QuantizableHSigmoid(nn.Module): """Hard Sigmoid for quantization.""" def __init__(self, inplace: 'bool'=True) ->None: """Initialize.""" super(QuantizableHSigmoid, self).__init__() self.relu6 = nn.ReLU6(inplace=inplace)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.quantization assert_size_stride = torch._C._dynamo.gua...
dhlee347/model_compression
QuantizableHSwish
false
6,570
[ "MIT" ]
1
274b85ff56d81f0b7cf6907cbc1bd10e16cdb956
https://github.com/dhlee347/model_compression/tree/274b85ff56d81f0b7cf6907cbc1bd10e16cdb956
SEModule
import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict import torch.utils.data def make_divisible(v, divisor, min_val=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
dercaft/XNAS
SEModule
false
6,571
[ "MIT" ]
1
d6d0fde0d4475210a41607181939188b177e44b1
https://github.com/dercaft/XNAS/tree/d6d0fde0d4475210a41607181939188b177e44b1
BinaryReg
import torch import torch.nn as nn import torch.utils.data class BinaryReg(nn.Module): """Regularization for encouraging the outputs to be binary. """ def __init__(self, alpha=1.0): super().__init__() self.alpha = alpha def forward(self, pred): diff = pred - 0.5 diff ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
divyam-goel/pytorch_connectomics
BinaryReg
false
6,572
[ "MIT" ]
1
a2c70a7cc60fd84d67be6f225c123ff11daadb83
https://github.com/divyam-goel/pytorch_connectomics/tree/a2c70a7cc60fd84d67be6f225c123ff11daadb83
Attention
import torch from torch import nn as nn from torch.nn import functional as F class Attention(nn.Module): def __init__(self, hidden_size): super().__init__() self.decoder_proj = nn.Linear(hidden_size, hidden_size) self.encoder_proj = nn.Linear(hidden_size, hidden_size) nn.init.xavi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
devjwsong/dialogue-error-correction-pytorch
Attention
false
6,573
[ "MIT" ]
1
ee0fa1f27eb995893a5943181a1fd0099a9e9202
https://github.com/devjwsong/dialogue-error-correction-pytorch/tree/ee0fa1f27eb995893a5943181a1fd0099a9e9202
MMTMBi
import torch import torch.nn as nn from typing import Sequence class MMTMBi(nn.Module): """ bi moludal fusion """ def __init__(self, dim_tab, dim_img, ratio=4): """ Parameters ---------- dim_tab: feature dimension of tabular data dim_img: feature dimension of ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ditannan/Multi-modal-Multi-instance-Learning
MMTMBi
false
6,575
[ "Apache-2.0" ]
1
06aada1ff85784d5ed50aa528c506947c892d584
https://github.com/ditannan/Multi-modal-Multi-instance-Learning/tree/06aada1ff85784d5ed50aa528c506947c892d584
JaccardLoss
import torch import torch.nn as nn import torch.utils.data class JaccardLoss(nn.Module): """Jaccard loss. """ def __init__(self, size_average=True, reduce=True, smooth=1.0): super(JaccardLoss, self).__init__() self.smooth = smooth self.reduce = reduce def jaccard_loss(self, p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
divyam-goel/pytorch_connectomics
JaccardLoss
false
6,576
[ "MIT" ]
1
a2c70a7cc60fd84d67be6f225c123ff11daadb83
https://github.com/divyam-goel/pytorch_connectomics/tree/a2c70a7cc60fd84d67be6f225c123ff11daadb83
MMTMTri
import torch import torch.nn as nn from typing import Sequence class MMTMTri(nn.Module): """ tri-modal fusion """ def __init__(self, dim_img, ratio=4): """ Parameters ---------- dim_tab: feature dimension of tabular data dim_img: feature dimension of MIL model...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ditannan/Multi-modal-Multi-instance-Learning
MMTMTri
false
6,577
[ "Apache-2.0" ]
1
06aada1ff85784d5ed50aa528c506947c892d584
https://github.com/ditannan/Multi-modal-Multi-instance-Learning/tree/06aada1ff85784d5ed50aa528c506947c892d584
Sine
import torch import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.utils.data.distributed class Sine(nn.Module): """ Applies the sine function element-wise. `"Implicit Neural Representations with Periodic Activation Functions" <https://arxiv.org/pdf/2006.09661.pdf>`_ Exa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.nn.functional import torch.nn.parallel...
doansangg/CGAN-PyTorch
Sine
false
6,578
[ "Apache-2.0" ]
1
941f5bd75102bed7f2eccd7feb9af8e6134af0e4
https://github.com/doansangg/CGAN-PyTorch/tree/941f5bd75102bed7f2eccd7feb9af8e6134af0e4
SimpleCNN
import torch import torch.nn as nn import torch.nn.functional as F class SimpleCNN(nn.Module): def __init__(self, num_channels, num_classes): super(SimpleCNN, self).__init__() C = num_channels self.conv1 = nn.Conv2d(in_channels=C, out_channels=C * 8, kernel_size=3, stride=2, p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
diogo149/doo
SimpleCNN
false
6,579
[ "MIT" ]
1
d83a1715fb9d4e5eac9f5d3d384a45cfc26fec2f
https://github.com/diogo149/doo/tree/d83a1715fb9d4e5eac9f5d3d384a45cfc26fec2f
HSigmoid
import torch import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.utils.data.distributed class HSigmoid(nn.Module): """ Applies the Hard-Sigmoid function element-wise. `"Searching for MobileNetV3" <https://arxiv.org/pdf/1905.02244.pdf>`_ Examples: >>> m = Mish()...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.ut...
doansangg/CGAN-PyTorch
HSigmoid
false
6,580
[ "Apache-2.0" ]
1
941f5bd75102bed7f2eccd7feb9af8e6134af0e4
https://github.com/doansangg/CGAN-PyTorch/tree/941f5bd75102bed7f2eccd7feb9af8e6134af0e4
MyInstanceNorm2d
import torch from torch import nn class AffineChannelwise(nn.Module): def __init__(self, num_channels): super().__init__() self.num_channels = num_channels self.register_parameter('weight', nn.Parameter(torch.ones( num_channels))) self.register_parameter('bias', nn.Par...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
dniku/dl-norms
MyInstanceNorm2d
false
6,581
[ "MIT" ]
1
0f1eef942bd318ac988ec7dfa9caea300d17e82a
https://github.com/dniku/dl-norms/tree/0f1eef942bd318ac988ec7dfa9caea300d17e82a
TSAFusion
import torch import torch.nn as nn from torch.nn import init as init from torchvision.models import vgg as vgg from torch import autograd as autograd class TSAFusion(nn.Module): """Temporal Spatial Attention (TSA) fusion module. Temporal: Calculate the correlation between center frame and neighboring...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
cyysc1998/EDVRDarts
TSAFusion
false
6,582
[ "MIT" ]
1
201badbc8c6469b519647a8869c3782ebe1176cf
https://github.com/cyysc1998/EDVRDarts/tree/201badbc8c6469b519647a8869c3782ebe1176cf
MyGroupNorm
import torch from torch import nn class AffineChannelwise(nn.Module): def __init__(self, num_channels): super().__init__() self.num_channels = num_channels self.register_parameter('weight', nn.Parameter(torch.ones( num_channels))) self.register_parameter('bias', nn.Par...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
dniku/dl-norms
MyGroupNorm
false
6,583
[ "MIT" ]
1
0f1eef942bd318ac988ec7dfa9caea300d17e82a
https://github.com/dniku/dl-norms/tree/0f1eef942bd318ac988ec7dfa9caea300d17e82a
HSwish
import torch import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.utils.data.distributed class HSwish(nn.Module): """ Applies the Hard-Swish function element-wise. `"Searching for MobileNetV3" <https://arxiv.org/pdf/1905.02244.pdf>`_ Examples: >>> m = Mish() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.ut...
doansangg/CGAN-PyTorch
HSwish
false
6,584
[ "Apache-2.0" ]
1
941f5bd75102bed7f2eccd7feb9af8e6134af0e4
https://github.com/doansangg/CGAN-PyTorch/tree/941f5bd75102bed7f2eccd7feb9af8e6134af0e4
AffineChannelwise
import torch from torch import nn class AffineChannelwise(nn.Module): def __init__(self, num_channels): super().__init__() self.num_channels = num_channels self.register_parameter('weight', nn.Parameter(torch.ones( num_channels))) self.register_parameter('bias', nn.Par...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
dniku/dl-norms
AffineChannelwise
false
6,585
[ "MIT" ]
1
0f1eef942bd318ac988ec7dfa9caea300d17e82a
https://github.com/dniku/dl-norms/tree/0f1eef942bd318ac988ec7dfa9caea300d17e82a
Model
import torch import torch.nn as nn import torch.utils.data import torch.nn.functional as f class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.conv = nn.Conv2d(1, 16, 5) self.pool = nn.MaxPool2d(2, 2) self.fc = nn.Linear(2304, 10) def forward(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
dohmatob/adversarial-robustness-toolbox
Model
false
6,586
[ "MIT" ]
1
7d3ba7d2d6690be69c08754fbc632947c2d10a97
https://github.com/dohmatob/adversarial-robustness-toolbox/tree/7d3ba7d2d6690be69c08754fbc632947c2d10a97
PowerPropLinear
import torch import torch.nn as nn import torch.nn.functional as F class PowerPropLinear(nn.Linear): """Powerpropagation Linear module.""" def __init__(self, in_features, out_fetaures, alpha, bias=True, *args, **kwargs): self._alpha = alpha super(PowerPropLinear, self).__init__(in_fea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
dlpbc/powerpropagation-pytorch
PowerPropLinear
false
6,587
[ "MIT" ]
1
99e29ce25ede9330cb8f624cb1fa7ffef6f82f03
https://github.com/dlpbc/powerpropagation-pytorch/tree/99e29ce25ede9330cb8f624cb1fa7ffef6f82f03
AllReduceLinear
import torch from torch import Tensor import torch.distributed as dist import torch.nn as nn from torch.nn import Linear class ParallelModule(nn.Module): """Parents of all parallel layer classes""" def __init__(self): super().__init__() self.mp_group = None def allreduce(self, outputs): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.distributed as dist import torch.nn as nn from torch.nn import Line...
dobbytk/parallelformers
AllReduceLinear
false
6,588
[ "Apache-2.0" ]
1
a05780b1d178b4ac5100e42c2b6eec7aedc7dd33
https://github.com/dobbytk/parallelformers/tree/a05780b1d178b4ac5100e42c2b6eec7aedc7dd33
PredictTargets
import torch from torch import nn from torch.nn import functional as F class PredictTargets(nn.Module): def __init__(self, dim): super(PredictTargets, self).__init__() self.linear1 = nn.Linear(2 * dim, dim) self.linear2 = nn.Linear(dim, 1) def forward(self, targets, embeddings): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
dmcinerney/ehr-extraction-models
PredictTargets
false
6,589
[ "Apache-2.0" ]
1
c7e7e176f69a2558d420c607254ed7e98b5e836a
https://github.com/dmcinerney/ehr-extraction-models/tree/c7e7e176f69a2558d420c607254ed7e98b5e836a
SimpleEncoder
import math import torch from torch import Tensor import torch.nn as nn class PositionalEncoding(nn.Module): """ Learnable position embeddings Args: pe_type (str): type of position embeddings, which is chosen from ['fully_learnable', 'sinusoidal'] d_model (int): embed dim (req...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import Tensor import torch.nn as nn assert_size_stride = ...
doiken23/mccformers.pytorch
SimpleEncoder
false
6,590
[ "MIT" ]
1
678bd9448e3a2f35bd408e8c8e510e0ea1f9a19f
https://github.com/doiken23/mccformers.pytorch/tree/678bd9448e3a2f35bd408e8c8e510e0ea1f9a19f
MMTMQuad
import torch import torch.nn as nn from typing import Sequence class MMTMQuad(nn.Module): """ quad modal fusion """ def __init__(self, dim_tab, dim_img, ratio=4): """ Parameters ---------- dim_tab: feature dimension of tabular data dim_img: feature dimension o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ditannan/Multi-modal-Multi-instance-Learning
MMTMQuad
false
6,591
[ "Apache-2.0" ]
1
06aada1ff85784d5ed50aa528c506947c892d584
https://github.com/ditannan/Multi-modal-Multi-instance-Learning/tree/06aada1ff85784d5ed50aa528c506947c892d584
Discrete
import torch import torch.nn as nn class Discrete(nn.Module): def __init__(self, num_outputs): super(Discrete, self).__init__() def forward(self, x): probs = nn.functional.softmax(x, dim=0) dist = torch.distributions.Categorical(probs=probs) return dist.entropy() def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
dreamflasher/client
Discrete
false
6,592
[ "MIT" ]
1
c8267f1c6b8b6970172d622bb8fbf7cc773d78b2
https://github.com/dreamflasher/client/tree/c8267f1c6b8b6970172d622bb8fbf7cc773d78b2
DiceLoss
import functools import torch import numpy as np import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
dkswxd/Swin-Spectral
DiceLoss
false
6,593
[ "Apache-2.0" ]
1
5d8c364b0d89e4dd21590bb58f7a434a5b97254c
https://github.com/dkswxd/Swin-Spectral/tree/5d8c364b0d89e4dd21590bb58f7a434a5b97254c
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_dim, action_dim): super(Critic, self).__init__() self.l1 = nn.Linear(state_dim, 400) self.l2 = nn.Linear(400 + action_dim, 300) self.l3 = nn.Linear(300, 1) def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
dmund95/bcq
Critic
false
6,594
[ "MIT" ]
1
b1ae39ad7789443f02273aaa1a433c55c6836a5f
https://github.com/dmund95/bcq/tree/b1ae39ad7789443f02273aaa1a433c55c6836a5f
SquareRoot
import torch import torch.nn.functional from torch import nn class SquareRoot(nn.Module): def forward(self, x): return x.sqrt() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.functional from torch import nn assert_size_stride = torch._C._...
drivendataorg/DrivenData-2021-Geopose-Solution
SquareRoot
false
6,595
[ "MIT" ]
1
fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
https://github.com/drivendataorg/DrivenData-2021-Geopose-Solution/tree/fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
Net
import torch import torch.nn as nn class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.fc1 = nn.Linear(4, 64) self.fc2 = nn.Linear(64, 64) self.fc3 = nn.Linear(64, 2) def forward(self, x): x = torch.tanh(self.fc1(x)) x = torch.tanh(self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
dongminlee94/supplement4deeprl
Net
false
6,596
[ "MIT" ]
1
4db1a83f5dd3254abd8135fe94734a0d8d14a957
https://github.com/dongminlee94/supplement4deeprl/tree/4db1a83f5dd3254abd8135fe94734a0d8d14a957
Value
import torch import torch.nn as nn import torch.nn.functional as F class Value(nn.Module): def __init__(self, num_inputs): super(Value, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.value_head = nn.Linear(64, 1) self.value_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
dragen1860/TRPO-Pytorch
Value
false
6,597
[ "MIT" ]
1
c5a8e5ac890ec50e331db12fd5885dd4fb753a3b
https://github.com/dragen1860/TRPO-Pytorch/tree/c5a8e5ac890ec50e331db12fd5885dd4fb753a3b
Policy
import torch import torch.nn as nn import torch.nn.functional as F class Policy(nn.Module): def __init__(self, num_inputs, num_outputs): super(Policy, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.action_mean = nn.Linear(64, num_ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
dragen1860/TRPO-Pytorch
Policy
false
6,598
[ "MIT" ]
1
c5a8e5ac890ec50e331db12fd5885dd4fb753a3b
https://github.com/dragen1860/TRPO-Pytorch/tree/c5a8e5ac890ec50e331db12fd5885dd4fb753a3b
GlobalWeightedAvgPool2d
import torch import torch.nn as nn class GlobalWeightedAvgPool2d(nn.Module): """ Global Weighted Average Pooling from paper "Global Weighted Average Pooling Bridges Pixel-level Localization and Image-level Classification" """ def __init__(self, features: 'int', flatten=False): super().__i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
dong03/DogNoseLandmarks
GlobalWeightedAvgPool2d
false
6,599
[ "MIT" ]
1
ac5d1e0436e9e0835a6939f8d125f1d36007bc62
https://github.com/dong03/DogNoseLandmarks/tree/ac5d1e0436e9e0835a6939f8d125f1d36007bc62
MSELossWithIgnore
import torch import torch.nn.functional from torch import nn class MSELossWithIgnore(nn.Module): def __init__(self, ignore_value: 'int', fraction: 'float'=1.0): super().__init__() self.ignore_value = ignore_value self.fraction = fraction def forward(self, output, target): los...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.functional from torch import nn assert_size_stride = torch._C._dynamo.gua...
drivendataorg/DrivenData-2021-Geopose-Solution
MSELossWithIgnore
false
6,600
[ "MIT" ]
1
fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
https://github.com/drivendataorg/DrivenData-2021-Geopose-Solution/tree/fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
ATTA
import torch import torch.nn as nn class ATTA(nn.Module): def __init__(self): super(ATTA, self).__init__() self.conv1 = nn.Conv2d(3, 3, 16, padding='same', groups=1, bias=False) self.lr = nn.LeakyReLU(0.2) self.conv2 = nn.Conv2d(3, 3, 3, padding='same', groups=1, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
dreamflake/ODI
ATTA
false
6,601
[ "MIT" ]
1
d58001b96821c8a74d6ebb5402bd2be2b524890a
https://github.com/dreamflake/ODI/tree/d58001b96821c8a74d6ebb5402bd2be2b524890a
Exponent
import torch import torch.nn.functional from torch import nn class Exponent(nn.Module): def forward(self, x): return x.exp() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functional from torch import nn assert_size_stride = torc...
drivendataorg/DrivenData-2021-Geopose-Solution
Exponent
false
6,602
[ "MIT" ]
1
fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
https://github.com/drivendataorg/DrivenData-2021-Geopose-Solution/tree/fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
LogCoshWithIgnore
import torch import torch.nn.functional from torch import nn class LogCoshWithIgnore(nn.Module): def __init__(self, ignore_value, fraction: 'float'=1.0): super().__init__() self.ignore_value = ignore_value self.fraction = fraction def forward(self, output, target): r = output...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
drivendataorg/DrivenData-2021-Geopose-Solution
LogCoshWithIgnore
false
6,603
[ "MIT" ]
1
fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
https://github.com/drivendataorg/DrivenData-2021-Geopose-Solution/tree/fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
GlobalAvgPool2d
import torch from torch import nn class GlobalAvgPool2d(nn.Module): """Performs global average pooling over the entire height and width of a batched 2D tensor # Arguments input: Input tensor """ def forward(self, input): return nn.functional.avg_pool2d(input, kernel_size=input.size()...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
drjosephliu/few-shot-learning
GlobalAvgPool2d
false
6,604
[ "MIT" ]
1
707c7ce2a0b1813327fb4e39660415b9437b8ec1
https://github.com/drjosephliu/few-shot-learning/tree/707c7ce2a0b1813327fb4e39660415b9437b8ec1
CosineSimilarityLoss
import torch import torch.nn.functional from torch import nn class CosineSimilarityLoss(nn.Module): def __init__(self, gamma=1): super().__init__() self.gamma = gamma def forward(self, output, target): loss = 1.0 - torch.clamp(torch.nn.functional.cosine_similarity( output...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.functional f...
drivendataorg/DrivenData-2021-Geopose-Solution
CosineSimilarityLoss
false
6,605
[ "MIT" ]
1
fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
https://github.com/drivendataorg/DrivenData-2021-Geopose-Solution/tree/fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
HuberLossWithIgnore
import torch from torch import Tensor import torch.nn.functional from torch import nn class HuberLossWithIgnore(nn.Module): def __init__(self, ignore_value: 'int', delta: 'float'=1, fraction: 'float'=1.0): super().__init__() self.ignore_value = ignore_value self.delta = delta ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functi...
drivendataorg/DrivenData-2021-Geopose-Solution
HuberLossWithIgnore
false
6,606
[ "MIT" ]
1
fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
https://github.com/drivendataorg/DrivenData-2021-Geopose-Solution/tree/fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
SmoothL1LossWithIgnore
import torch import torch.nn.functional from torch import nn class SmoothL1LossWithIgnore(nn.Module): def __init__(self, ignore_value: 'int', fraction: 'float'=1.0): super().__init__() self.ignore_value = ignore_value self.fraction = fraction def forward(self, output, target): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functi...
drivendataorg/DrivenData-2021-Geopose-Solution
SmoothL1LossWithIgnore
false
6,607
[ "MIT" ]
1
fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
https://github.com/drivendataorg/DrivenData-2021-Geopose-Solution/tree/fc1dead0aeb1ade9e9d87b55f56e631c57e966a6
MyLeakyReLU
import torch import torch.nn as nn class MyLeakyReLU(nn.Module): def __init__(self, negative_slope=0.01): super(MyLeakyReLU, self).__init__() self.negative_slope = negative_slope def forward(self, x): return torch.clamp(x, min=0.0) + torch.clamp(x, max=0.0 ) * self.negati...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
dsarrut/gaga
MyLeakyReLU
false
6,608
[ "Apache-2.0" ]
1
4b34210074f8f82acb12e0ffb38858e83c319dc3
https://github.com/dsarrut/gaga/tree/4b34210074f8f82acb12e0ffb38858e83c319dc3
GlobalMaxPool1d
import torch from torch import nn class GlobalMaxPool1d(nn.Module): """Performs global max pooling over the entire length of a batched 1D tensor # Arguments input: Input tensor """ def forward(self, input): return nn.functional.max_pool1d(input, kernel_size=input.size()[2:] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
drjosephliu/few-shot-learning
GlobalMaxPool1d
false
6,609
[ "MIT" ]
1
707c7ce2a0b1813327fb4e39660415b9437b8ec1
https://github.com/drjosephliu/few-shot-learning/tree/707c7ce2a0b1813327fb4e39660415b9437b8ec1
LabelSmoothing
import torch from torch import nn class LabelSmoothing(nn.Module): """ Label Smoothing Attributes ---------- criterion : torch.nn.KLDivLoss padding_idx : int eps : float n_vocab : int """ def __init__(self, n_vocab, eps, padding_idx=0): """ Param...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.gua...
dugusword/transformer
LabelSmoothing
false
6,610
[ "MIT" ]
1
7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
https://github.com/dugusword/transformer/tree/7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
ViTClassifierPipe
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class ViTClassifierPipe(nn.Module): def __init__(self, config: 'ViTConfig'): super().__init__() self.layernorm = nn.LayerNorm(config.hidden_size, eps=config. layer_norm_eps) self.classifier = nn.L...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
drunkcoding/huggingface-utils
ViTClassifierPipe
false
6,611
[ "MIT" ]
1
4baad306857c357d94607076c6ab0cb5d6350cbe
https://github.com/drunkcoding/huggingface-utils/tree/4baad306857c357d94607076c6ab0cb5d6350cbe
MultiHeadAttention
import math import torch from torch import nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention Layer Attributes ---------- softmax : nn.Functional softmax function applied at the last dimension """ def __init__(self, dropout=0.1): super(ScaledD...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
dugusword/transformer
MultiHeadAttention
false
6,612
[ "MIT" ]
1
7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
https://github.com/dugusword/transformer/tree/7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
Fusion
import torch import torch.nn as nn import torch.utils.checkpoint class Fusion(nn.Module): """ The subnetwork that is used in TFN for video and audio in the pre-fusion stage """ def __init__(self, in_size, hidden_size, n_class, dropout, modal_name= 'text'): """ Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
dumpmemory/MMSA
Fusion
false
6,613
[ "MIT" ]
1
08b3a7f4529c380356eeb1cf6bf9a89e7c9701e7
https://github.com/dumpmemory/MMSA/tree/08b3a7f4529c380356eeb1cf6bf9a89e7c9701e7
FeatureVolume
import torch import torch.nn as nn import torch.nn.functional as F class FeatureVolume(nn.Module): def __init__(self, fdim, fsize): super().__init__() self.fsize = fsize self.fdim = fdim var = 0.01 self.fmx = nn.Parameter(torch.randn(1, fdim, fsize, fsize) * var) s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
drixs2050/nglod
FeatureVolume
false
6,614
[ "MIT" ]
1
0f3627d3ece82464335b0fab89c2269fcb016308
https://github.com/drixs2050/nglod/tree/0f3627d3ece82464335b0fab89c2269fcb016308
CoAttentionTransformerEncoderLayer
import torch from torch import Tensor from typing import Optional import torch.nn as nn import torch.nn.functional as F def _get_activation_fn(activation): if activation == 'relu': return F.relu elif activation == 'gelu': return F.gelu raise ValueError('activation should be relu/gelu, not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
doiken23/mccformers.pytorch
CoAttentionTransformerEncoderLayer
false
6,615
[ "MIT" ]
1
678bd9448e3a2f35bd408e8c8e510e0ea1f9a19f
https://github.com/doiken23/mccformers.pytorch/tree/678bd9448e3a2f35bd408e8c8e510e0ea1f9a19f
Adversarial_Loss
import torch import torch.nn as nn from numpy import * class Adversarial_Loss(nn.Module): def __init__(self, lambda_adv): super(Adversarial_Loss, self).__init__() self.lambda_adv = lambda_adv pass def forward(self, input_p, input_h): dis_p = input_p * torch.log(input_p) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ducviet00/HMER
Adversarial_Loss
false
6,616
[ "MIT" ]
1
0fa322ed35412737a24ec3955c9a3d96d1989bd4
https://github.com/ducviet00/HMER/tree/0fa322ed35412737a24ec3955c9a3d96d1989bd4
MixedPad
import torch def mixed_pad(input, pad, mode='constant', value=0, reversed_axes=False): """Mixed mode padding. :type input: tensor[B,C,D1,D2,...,DD] :type pad: int or tuple of ints with 2*D length :type mode: str or tuple :type value: float or tuple Dimension numbering: reverse...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
dvolgyes/highresnet
MixedPad
false
6,617
[ "MIT" ]
1
12b8831ed52e2dc45d2e14cc6f2954c583c97a46
https://github.com/dvolgyes/highresnet/tree/12b8831ed52e2dc45d2e14cc6f2954c583c97a46
NetworkDQN
import torch import torch.nn as nn import torch.nn.functional as F class NetworkDQN(nn.Module): def __init__(self, fs, input_dim, fc1, fc2, n_actions): super(NetworkDQN, self).__init__() self.conv1 = nn.Conv2d(fs, 64, 8, 4) self.pool1 = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(64...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
doganjr/MarioDQN
NetworkDQN
false
6,618
[ "MIT" ]
1
62daa390f8ee0b732275e71675a2b9eae85c43a4
https://github.com/doganjr/MarioDQN/tree/62daa390f8ee0b732275e71675a2b9eae85c43a4
Loss_D
import torch import torch.nn as nn from numpy import * class Loss_D(nn.Module): """docstring for Loss_D""" def __init__(self): super(Loss_D, self).__init__() def forward(self, input_h): return -input_h * torch.log(input_h) pass def get_inputs(): return [torch.rand([4, 4, 4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn from numpy import * assert_size_stride = torch._C._...
ducviet00/HMER
Loss_D
false
6,619
[ "MIT" ]
1
0fa322ed35412737a24ec3955c9a3d96d1989bd4
https://github.com/ducviet00/HMER/tree/0fa322ed35412737a24ec3955c9a3d96d1989bd4
Invertible1x1Conv
import torch import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data import torch.nn class Invertible1x1Conv(torch.nn.Module): """ The layer outputs both the convolution, and the log determinant of its weight matrix. If reverse=True it does convolution with inverse...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.functional as F from torch.autograd import Variable import torch...
drostifrosti/TensorRT
Invertible1x1Conv
false
6,620
[ "Apache-2.0" ]
1
76d673366139538fcb47a67e08734ff429306162
https://github.com/drostifrosti/TensorRT/tree/76d673366139538fcb47a67e08734ff429306162
InterpolationBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class InterpolationBlock(nn.Module): """ Interpolation block. Parameters: ---------- scale_factor : float Multiplier for spatial size. """ def __init__(self, scale_factor): super(In...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
earhian/imgclsmob
InterpolationBlock
false
6,621
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
DiracConv
import torch import torch.nn as nn import torch.utils.data class DiracConv(nn.Module): """ DiracNetV2 specific convolution block with pre-activation. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
earhian/imgclsmob
DiracConv
false
6,622
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
MaxPoolBranch
import torch import torch.nn as nn import torch.utils.data class MaxPoolBranch(nn.Module): """ PolyNet specific max pooling branch block. """ def __init__(self): super(MaxPoolBranch, self).__init__() self.pool = nn.MaxPool2d(kernel_size=3, stride=2, padding=0) def forward(self, x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
earhian/imgclsmob
MaxPoolBranch
false
6,623
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
DiracInitBlock
import torch import torch.nn as nn import torch.utils.data class DiracInitBlock(nn.Module): """ DiracNetV2 specific initial block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. """ def __init__(self, i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
earhian/imgclsmob
DiracInitBlock
false
6,624
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
NasAvgPoolBlock
import torch import torch.nn as nn import torch.utils.data class NasAvgPoolBlock(nn.Module): """ NASNet specific 3x3 Average pooling layer with extra padding. Parameters: ---------- extra_padding : bool, default False Whether to use extra padding. """ def __init__(self, extra_pad...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
earhian/imgclsmob
NasAvgPoolBlock
false
6,625
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
IBNbConvBlock
import torch import torch.nn as nn import torch.utils.data class IBNbConvBlock(nn.Module): """ IBN(b)-ResNet specific convolution block with Instance normalization and ReLU activation. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
earhian/imgclsmob
IBNbConvBlock
false
6,626
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
Discriminator
import torch import torch.nn as nn from numpy import * class Discriminator(nn.Module): """docstring for Discriminator""" def __init__(self, in_dim, out_dim): super(Discriminator, self).__init__() self.Linear1 = nn.Linear(in_dim, out_dim) self.Relu = nn.ReLU() self.Linear2 = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from nu...
ducviet00/HMER
Discriminator
false
6,627
[ "MIT" ]
1
0fa322ed35412737a24ec3955c9a3d96d1989bd4
https://github.com/ducviet00/HMER/tree/0fa322ed35412737a24ec3955c9a3d96d1989bd4
NasPathBranch
import torch import torch.nn as nn import torch.utils.data def conv1x1(in_channels, out_channels, stride=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
earhian/imgclsmob
NasPathBranch
false
6,628
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
IBNbResInitBlock
import torch import torch.nn as nn import torch.utils.data def ibnb_conv7x7_block(in_channels, out_channels, stride=1, padding=3, bias =False, activate=True): """ 7x7 version of the IBN(b)-ResNet specific convolution block. Parameters: ---------- in_channels : int Number of input chan...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
earhian/imgclsmob
IBNbResInitBlock
false
6,629
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
BCEFocalLoss
import torch import torch.nn as nn class BCEFocalLoss(nn.Module): """Implementation of Focal Loss for Binary Classification Problems. Focal loss was proposed in [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002). """ def __init__(self, gamma=0, eps=1e-07, reduction='mean'): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
earlbabson/torchflare
BCEFocalLoss
false
6,630
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
LeNet
import torch import torch.nn as nn class LeNet(nn.Module): def __init__(self): super().__init__() self.conv_1 = nn.Conv2d(3, 6, kernel_size=5, padding=2) self.sigmoid = nn.Sigmoid() self.avgpool = nn.AvgPool2d(kernel_size=5, stride=2) self.conv_2 = nn.Conv2d(6, 16, kernel_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ducnguyenhuynh/via-trafficsign-classification
LeNet
false
6,631
[ "MIT" ]
1
e65fccc1ee377603334453eacfc3f65619dc0714
https://github.com/ducnguyenhuynh/via-trafficsign-classification/tree/e65fccc1ee377603334453eacfc3f65619dc0714
FocalLoss
import torch import torch.nn as nn class FocalLoss(nn.Module): """Implementation of Focal Loss. Focal loss was proposed in [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002). """ def __init__(self, gamma=0, eps=1e-07, reduction='mean'): """Constructor Method for FocalL...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
earlbabson/torchflare
FocalLoss
false
6,632
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
EncoderUnit
import math import torch from torch import nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention Layer Attributes ---------- softmax : nn.Functional softmax function applied at the last dimension """ def __init__(self, dropout=0.1): super(ScaledD...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
dugusword/transformer
EncoderUnit
false
6,633
[ "MIT" ]
1
7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
https://github.com/dugusword/transformer/tree/7aa10968f0e60d545bbd17f1f8c1dfb7ee88c62b
SqueezeInitBlock
import torch import torch.nn as nn import torch.utils.data class SqueezeInitBlock(nn.Module): """ SqueezeNet specific initial block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_size : int or tuple/...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
earhian/imgclsmob
SqueezeInitBlock
false
6,634
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
WRNBottleneck
import torch import torch.nn as nn import torch.utils.data def wrn_conv1x1(in_channels, out_channels, stride, activate): """ 1x1 version of the WRN specific convolution block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of outpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
earhian/imgclsmob
WRNBottleneck
false
6,635
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
SSE
import torch import torch.nn as nn class SSE(nn.Module): """SSE : Channel Squeeze and Spatial Excitation block. Paper : <https://arxiv.org/abs/1803.02579> Adapted from <https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178> """ def __init__(self, in_channels): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
earlbabson/torchflare
SSE
false
6,636
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
WRNInitBlock
import torch import torch.nn as nn import torch.utils.data class WRNConv(nn.Module): """ WRN specific convolution block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. kernel_size : int or tuple/list of 2 in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
earhian/imgclsmob
WRNInitBlock
false
6,637
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
TripletLoss
import torch import torch.nn.functional as F import torch.nn as nn def cosine_dist(x, y): """Computes Cosine Distance.""" x = F.normalize(x, dim=1) y = F.normalize(y, dim=1) dist = 2 - 2 * torch.mm(x, y.t()) return dist def euclidean_dist(x, y): """Computes Euclidean distance.""" m, n = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
earlbabson/torchflare
TripletLoss
false
6,638
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
DiceLoss
import torch import torch.nn as nn def calculate_segmentation_statistics(outputs: 'torch.Tensor', targets: 'torch.Tensor', class_dim: 'int'=1, threshold=None): """Compute calculate segmentation statistics. Args: outputs: torch.Tensor. targets: torch.Tensor. threshold: threshold fo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
earlbabson/torchflare
DiceLoss
false
6,639
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
Classifier
import torch import torch.nn as nn class Classifier(nn.Module): def __init__(self, z_dim, hidden_dim, class_dim): super().__init__() self.fc1 = nn.Linear(z_dim, hidden_dim) self.fc2 = nn.Linear(hidden_dim, class_dim) self.softplus = nn.Softplus() self.softmax = nn.Softmax(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
einbandi/samplednn
Classifier
false
6,640
[ "MIT" ]
1
3525e46ab5096a569dde40e5a10d6ee05128ec7d
https://github.com/einbandi/samplednn/tree/3525e46ab5096a569dde40e5a10d6ee05128ec7d
IOULoss
import torch import torch.nn as nn def calculate_segmentation_statistics(outputs: 'torch.Tensor', targets: 'torch.Tensor', class_dim: 'int'=1, threshold=None): """Compute calculate segmentation statistics. Args: outputs: torch.Tensor. targets: torch.Tensor. threshold: threshold fo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
earlbabson/torchflare
IOULoss
false
6,641
[ "Apache-2.0" ]
1
15db06d313a53a3ec4640869335ba87730562b28
https://github.com/earlbabson/torchflare/tree/15db06d313a53a3ec4640869335ba87730562b28
MeshEdgeEmbeddingLayer
import torch import torch.utils.data import torch from torch import nn class MeshEdgeEmbeddingLayer(nn.Module): """ Very important - who said that a-c is meaningfull at first layer... """ def __init__(self, input_size, embedding_size, bias=True): super(MeshEdgeEmbeddingLayer, self).__init__()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch from torch import nn assert_size_stride = t...
eldadp100/The-Mesh-Transformer
MeshEdgeEmbeddingLayer
false
6,642
[ "MIT" ]
1
b3ab18f774251feff1093040dfdcf7b836a43505
https://github.com/eldadp100/The-Mesh-Transformer/tree/b3ab18f774251feff1093040dfdcf7b836a43505
Decoder
import torch import torch.nn as nn class Decoder(nn.Module): def __init__(self, z_dim, hidden_dim, input_dim): super().__init__() self.fc1 = nn.Linear(z_dim, hidden_dim) self.fc21 = nn.Linear(hidden_dim, input_dim) self.softplus = nn.Softplus() self.sigmoid = nn.Sigmoid() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
einbandi/samplednn
Decoder
false
6,643
[ "MIT" ]
1
3525e46ab5096a569dde40e5a10d6ee05128ec7d
https://github.com/einbandi/samplednn/tree/3525e46ab5096a569dde40e5a10d6ee05128ec7d
AuxiliaryConvolutions
import torch from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data class AuxiliaryConvolutions(nn.Module): """ Additional convolutions to produce higher-level feature maps. """ def __init__(self): super(Auxilia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from ite...
dee-walia20/SSD-Implementation-using-Pytorch
AuxiliaryConvolutions
false
6,644
[ "MIT" ]
1
2a7dcdcea2787f4bffd45f335819f08af2b525dd
https://github.com/dee-walia20/SSD-Implementation-using-Pytorch/tree/2a7dcdcea2787f4bffd45f335819f08af2b525dd
GELU
import torch import torch.nn as nn class GELU(nn.Module): def forward(self, x): return torch.sigmoid(1.702 * x) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
endaaman/augmix
GELU
false
6,645
[ "Apache-2.0" ]
1
11c86a126c7b261ca178a715763763ca22b20b81
https://github.com/endaaman/augmix/tree/11c86a126c7b261ca178a715763763ca22b20b81
Noise_injector
import torch import torch.nn as nn def truncated_normal_(tensor, mean=0, std=1): size = tensor.shape tmp = tensor.new_empty(size + (4,)).normal_() valid = (tmp < 2) & (tmp > -2) ind = valid.max(-1, keepdim=True)[1] tensor.data.copy_(tmp.gather(-1, ind).squeeze(-1)) tensor.data.mul_(std).add_(m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
dkgupta90/CARMSS
Noise_injector
false
6,646
[ "Apache-2.0" ]
1
1f397caa39b9f504951285eff150857f7d86a7c3
https://github.com/dkgupta90/CARMSS/tree/1f397caa39b9f504951285eff150857f7d86a7c3
VoxelFeatureExtractor
import torch from torch import nn class VoxelFeatureExtractor(nn.Module): """Computes mean of non-zero points within voxel.""" def forward(self, feature, occupancy): """ :feature FloatTensor of shape (N, K, C) :return FloatTensor of shape (N, C) """ denominator = occup...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
eraofelix/PV-RCNN
VoxelFeatureExtractor
false
6,647
[ "MIT" ]
1
6361ec99cc1c92120263ef56b2c2b003c2cd7264
https://github.com/eraofelix/PV-RCNN/tree/6361ec99cc1c92120263ef56b2c2b003c2cd7264
QModReLU
import torch import torch.nn.functional as F import torch.fx class QModReLU(torch.nn.Module): """ Quaternion ModeReLU """ def __init__(self, bias=0): super().__init__() self.bias = torch.nn.Parameter(torch.Tensor([bias])) def forward(self, x): norm = x.norm() retu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.fx assert_size_...
eleGAN23/HI2I
QModReLU
false
6,648
[ "MIT" ]
1
7730ee0963614290099b011c113048ef6d1b149c
https://github.com/eleGAN23/HI2I/tree/7730ee0963614290099b011c113048ef6d1b149c
DecoderNet
import torch import torch.nn.functional as F import torch.nn as nn class DecoderNet(nn.Module): """ The decoder takes an interpolated feature vector and turn it into the output signal. This net is intended to be very lightweight, it has only one hidden layer. """ def __init__(self, feature_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
eliemichel/ReACORN
DecoderNet
false
6,649
[ "MIT" ]
1
74501551ecb387352271674efb2ed6240d234df6
https://github.com/eliemichel/ReACORN/tree/74501551ecb387352271674efb2ed6240d234df6
AlexOutputBlock
import torch import torch.nn as nn import torch.utils.data class AlexDense(nn.Module): """ AlexNet specific dense block. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. """ def __init__(self, in_channels...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
earhian/imgclsmob
AlexOutputBlock
false
6,650
[ "MIT" ]
1
c87c0942420876941868c016211073dec4392e4d
https://github.com/earhian/imgclsmob/tree/c87c0942420876941868c016211073dec4392e4d
SelfAttentionLayer
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class SelfAttentionLayer(nn.Module): def __init__(self, elem_size, embd_size): super(SelfAttentionLayer, self).__init__() self.embd_size = embd_size self.query_lin = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
eldadp100/The-Mesh-Transformer
SelfAttentionLayer
false
6,651
[ "MIT" ]
1
b3ab18f774251feff1093040dfdcf7b836a43505
https://github.com/eldadp100/The-Mesh-Transformer/tree/b3ab18f774251feff1093040dfdcf7b836a43505
BatchNorm2D_noparam
import torch import torch.nn as nn class BatchNorm2D_noparam(nn.Module): def __init__(self, eps=1e-08): super(BatchNorm2D_noparam, self).__init__() self.eps = eps def forward(self, x): _bs, _c, _h, _w = x.shape mean = torch.mean(x, (0, 2, 3), keepdim=True) var = torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ericlearning/General-I2I
BatchNorm2D_noparam
false
6,652
[ "MIT" ]
1
ba7c5d6a582bdf2e7b53c0e20c31e9097b1883a9
https://github.com/ericlearning/General-I2I/tree/ba7c5d6a582bdf2e7b53c0e20c31e9097b1883a9
CReLU
import torch import torch.nn as nn import torch.nn.functional as F class CReLU(nn.ReLU): def __init__(self): super(CReLU, self).__init__() def forward(self, input): return torch.cat((F.relu(input, self.inplace), F.relu(-input, self. inplace)), 1) def get_inputs(): return [t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
ethancaballero/multi-agent-reinforcement-learning-for-emergent-communication
CReLU
false
6,653
[ "MIT" ]
1
426edaa1ee58b467dfc0f46fe1f83ceea26f2ed7
https://github.com/ethancaballero/multi-agent-reinforcement-learning-for-emergent-communication/tree/426edaa1ee58b467dfc0f46fe1f83ceea26f2ed7
LigthSpeechLoss
import torch from torch import nn import torch.utils.data class LigthSpeechLoss(nn.Module): """ LigthSpeech Loss """ def __init__(self): super(LigthSpeechLoss, self).__init__() def forward(self, mel, padd_predicted, cemb_out, mel_tac2_target, D, cemb): mel_loss = nn.MSELoss()(mel, mel_ta...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn i...
entn-at/LightSpeech
LigthSpeechLoss
false
6,654
[ "MIT" ]
1
48250fbcede4b258ba13ab17e3e83afc5fe85a01
https://github.com/entn-at/LightSpeech/tree/48250fbcede4b258ba13ab17e3e83afc5fe85a01
Net
import torch from torch import nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=10, kernel_size= (7, 3)) self.pool = nn.MaxPool2d(kernel_size=(1, 3)) self.conv2 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
elliottwaissbluth/tensor-hero
Net
false
6,655
[ "MIT" ]
1
be99ca4380a5ec59c0826e5fc8a87ec0f8956201
https://github.com/elliottwaissbluth/tensor-hero/tree/be99ca4380a5ec59c0826e5fc8a87ec0f8956201
GaussianSample
import torch import torch.nn as nn class Stochastic(nn.Module): """ Base stochastic layer that uses the reparametrization trick [Kingma 2013] to draw a sample from a distribution parametrised by mu and log_var. """ def reparametrize(self, mu, logvar): epsilon = torch.randn(mu.size...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math...
ericli0419/SCALEX
GaussianSample
false
6,656
[ "MIT" ]
1
2fedbe4c3287cf86de7b786c98122fe45707416e
https://github.com/ericli0419/SCALEX/tree/2fedbe4c3287cf86de7b786c98122fe45707416e
PatchedSelfAttentionLayer
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F class SelfAttentionLayer(nn.Module): def __init__(self, elem_size, embd_size): super(SelfAttentionLayer, self).__init__() self.embd_size = embd_size self.query_lin = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
eldadp100/The-Mesh-Transformer
PatchedSelfAttentionLayer
false
6,657
[ "MIT" ]
1
b3ab18f774251feff1093040dfdcf7b836a43505
https://github.com/eldadp100/The-Mesh-Transformer/tree/b3ab18f774251feff1093040dfdcf7b836a43505
SpatialAttention
import torch import torch.nn as nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv1d(2, 1, kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
esbgkannan/GT-CNN
SpatialAttention
false
6,658
[ "MIT" ]
1
4f3828d7ed8f6c3ed796fa4e2e166ef5c16cb3d9
https://github.com/esbgkannan/GT-CNN/tree/4f3828d7ed8f6c3ed796fa4e2e166ef5c16cb3d9
MyLinear
import torch from torch import nn from torch.nn import functional as F class MyLinear(nn.Module): def __init__(self, in_units, units): super().__init__() self.weight = nn.Parameter(torch.randn(in_units, units)) self.bias = nn.Parameter(torch.randn(units)) def forward(self, X): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
eunice012716/Intern-Training
MyLinear
false
6,659
[ "MIT" ]
1
c3bbf42448a0b41e96d88569b6cfd57d78338716
https://github.com/eunice012716/Intern-Training/tree/c3bbf42448a0b41e96d88569b6cfd57d78338716
BCE_Dice
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=1): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
evilidol/kaggle-Steel-Defect-Detection
BCE_Dice
false
6,660
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
PrimaryCaps
import torch import torch.nn as nn class PrimaryCaps(nn.Module): """Creates a primary convolutional capsule layer that outputs a pose matrix and an activation. Note that for computation convenience, pose matrix are stored in first part while the activations are stored in the second part. Arg...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
esdrascosta/Matrix-Capsules
PrimaryCaps
false
6,661
[ "MIT" ]
1
ddf35dfa1acfb51a11a3ec27e15fe863a2ff6fa4
https://github.com/esdrascosta/Matrix-Capsules/tree/ddf35dfa1acfb51a11a3ec27e15fe863a2ff6fa4
Highway
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils import torch.onnx class Highway(nn.Module): def __init__(self, e_word): super(Highway, self).__init__() self.embed_size = e_word self.w_proj = nn.Linear(self.embed_size, self.embed_size, bias=True) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
evazhang612/honygenerator
Highway
false
6,662
[ "MIT" ]
1
cafcf1736faba978ecaed624b949ebc1498477ee
https://github.com/evazhang612/honygenerator/tree/cafcf1736faba978ecaed624b949ebc1498477ee
P2SActivationLayer
import torch import torch.nn as torch_nn from torch.nn import Parameter import torch.utils class P2SActivationLayer(torch_nn.Module): """ Output layer that produces cos heta between activation vector x and class vector w_j in_dim: dimension of input feature vectors output_dim: dimension of output ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
eurecom-asp/raw-pc-darts-anti-spoofing
P2SActivationLayer
false
6,663
[ "MIT" ]
1
f2dcb5a8fc0cb811328a341a9bd90ffb292adaa1
https://github.com/eurecom-asp/raw-pc-darts-anti-spoofing/tree/f2dcb5a8fc0cb811328a341a9bd90ffb292adaa1
ChannelGate2d
import torch import torch.nn as nn class ChannelGate2d(nn.Module): def __init__(self, channels, reduction=2): super(ChannelGate2d, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc1 = nn.Conv2d(channels, channels // reduction, kernel_size=1, padding=0) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
evilidol/kaggle-Steel-Defect-Detection
ChannelGate2d
false
6,664
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
SelfAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn from torch.nn import functional as F class SelfAttention(nn.Module): def __init__(self, config): super().__init__() assert config.n_embd % config.n_head == 0 self.qkv = nn.Linear(config.n_embd, co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
evelynmitchell/rasp
SelfAttention
false
6,665
[ "MIT" ]
1
9b33bbf911e6c4ff018c9883c39eb698c0abe803
https://github.com/evelynmitchell/rasp/tree/9b33bbf911e6c4ff018c9883c39eb698c0abe803