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
DPLSTMCell
import math import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Tuple from typing import Optional class LSTMLinear(nn.Linear): """ This function is the same as a nn.Linear layer, except that in the backward pass the gra...
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 math import ...
EXAPPAI/opacus
DPLSTMCell
false
2,195
[ "Apache-2.0" ]
0
11e188a2f03a8a08be51fdf2367cc1387879312a
https://github.com/EXAPPAI/opacus/tree/11e188a2f03a8a08be51fdf2367cc1387879312a
MaxMarginRankingLoss
import torch import numpy as np import torch as th import torch.nn.functional as F class MaxMarginRankingLoss(th.nn.Module): def __init__(self, margin=1.0, negative_weighting=False, batch_size=1, n_pair=1, hard_negative_rate=0.5): super(MaxMarginRankingLoss, self).__init__() self.margin =...
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 numpy as np import torch as th assert_size_stride = torch._C._dynamo.guards.assert...
ErinZhang1998/howto100m-erin
MaxMarginRankingLoss
false
2,196
[ "Apache-2.0" ]
0
1152ea0fe328d20fcf2218a1d548644881632656
https://github.com/ErinZhang1998/howto100m-erin/tree/1152ea0fe328d20fcf2218a1d548644881632656
Encoder
import torch import torch.nn as nn import torch.nn.functional as F class Scaled_Dot_Product_Attention(nn.Module): """Scaled Dot-Product Attention """ def __init__(self): super(Scaled_Dot_Product_Attention, self).__init__() def forward(self, Q, K, V, scale=None): """ 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 import triton_helpers from torch._inductor.runtime....
Ergtou/TextWord
Encoder
false
2,197
[ "MIT" ]
0
f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30
https://github.com/Ergtou/TextWord/tree/f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30
MLP
import torch from torch import Tensor from torch import nn class MLP(nn.Module): def __init__(self, dim, embed_dim): super().__init__() self.proj = nn.Linear(dim, embed_dim) def forward(self, x: 'Tensor') ->Tensor: x = x.flatten(2).transpose(1, 2) x = self.proj(x) ret...
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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
EmanuelNk/semantic-segmentation
MLP
false
2,198
[ "MIT" ]
0
20ff16da49691fb407724909d9c7e84b47e2fee0
https://github.com/EmanuelNk/semantic-segmentation/tree/20ff16da49691fb407724909d9c7e84b47e2fee0
Flatten
import torch import torch.nn as nn class Flatten(nn.Module): def __init__(self): super(Flatten, self).__init__() def forward(self, x): """ Arguments: x: a float tensor with shape [batch_size, c, h, w]. Returns: a float tensor with shape [batch_size, c*...
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...
Escaton615/mtcnn-pytorch
Flatten
false
2,199
[ "MIT" ]
0
4a645c1bf8dca0b5410cc0454ee0a538ada2d241
https://github.com/Escaton615/mtcnn-pytorch/tree/4a645c1bf8dca0b5410cc0454ee0a538ada2d241
SigmoidAbsoluteRelativeErrorLoss
import torch from torch import nn class SigmoidAbsoluteRelativeErrorLoss(nn.Module): def __init__(self, epsilon=0.0001): super().__init__() self.epsilon = epsilon def forward(self, pred, target): error = (pred - target) / (target + self.epsilon) return torch.sigmoid(torch.abs...
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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
ElectronicElephant/openpilot-reimplementation
SigmoidAbsoluteRelativeErrorLoss
false
2,200
[ "MIT" ]
0
063a9f5c6bbbf02c03dadc59e236e8f7c253a350
https://github.com/ElectronicElephant/openpilot-reimplementation/tree/063a9f5c6bbbf02c03dadc59e236e8f7c253a350
Position_wise_Feed_Forward
import torch import torch.nn as nn import torch.nn.functional as F class Position_wise_Feed_Forward(nn.Module): def __init__(self, dim_model, hidden, dropout=0.0): super(Position_wise_Feed_Forward, self).__init__() self.fc1 = nn.Linear(dim_model, hidden) self.fc2 = nn.Linear(hidden, dim_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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Ergtou/TextWord
Position_wise_Feed_Forward
false
2,201
[ "MIT" ]
0
f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30
https://github.com/Ergtou/TextWord/tree/f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30
TOP1_max
import torch import torch.nn as nn import torch.nn.functional as F class TOP1_max(nn.Module): def __init__(self): super(TOP1_max, self).__init__() def forward(self, logit): logit_softmax = F.softmax(logit, dim=1) diff = -(logit.diag().view(-1, 1).expand_as(logit) - logit) 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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Ethan-Yys/GRU4REC-pytorch-master
TOP1_max
false
2,202
[ "Apache-2.0" ]
0
175ccb851f881d3506680c459491e76f50aa9898
https://github.com/Ethan-Yys/GRU4REC-pytorch-master/tree/175ccb851f881d3506680c459491e76f50aa9898
Sentence_Maxpool
import torch import torch as th import torch.nn.functional as F import torch.nn as nn class Sentence_Maxpool(nn.Module): def __init__(self, word_dimension, output_dim, relu=True): super(Sentence_Maxpool, self).__init__() self.fc = nn.Linear(word_dimension, output_dim) self.out_dim = 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 assert_...
ErinZhang1998/howto100m-erin
Sentence_Maxpool
false
2,203
[ "Apache-2.0" ]
0
1152ea0fe328d20fcf2218a1d548644881632656
https://github.com/ErinZhang1998/howto100m-erin/tree/1152ea0fe328d20fcf2218a1d548644881632656
Attention
import math import torch import torch.nn.functional as F import torch.utils.data def restricted_softmax(src, dim: 'int'=-1, margin: 'float'=0.0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0.0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).e...
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....
EricAlcaide/pytorch_geometric
Attention
false
2,204
[ "MIT" ]
0
31cef566cfe22602459155fdf91e9b6ce398bfe7
https://github.com/EricAlcaide/pytorch_geometric/tree/31cef566cfe22602459155fdf91e9b6ce398bfe7
AdaptiveConcatPool2d
import torch from typing import Type from typing import Optional import torch.nn as nn class AdaptiveConcatPool2d(nn.Module): """Layer that concats `AdaptiveAvgPool2d` and `AdaptiveMaxPool2d`.""" def __init__(self, size: 'Optional[int]'=None): """Output will be 2*size or 2 if size is 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 typing import Optional import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
Erlemar/kekas
AdaptiveConcatPool2d
false
2,205
[ "MIT" ]
0
6fd8413f15390bf079bdb57a38a7094a5c53ab0f
https://github.com/Erlemar/kekas/tree/6fd8413f15390bf079bdb57a38a7094a5c53ab0f
CustomNet
import torch import torch.nn as nn class CustomNet(nn.Module): """ A network with a fully connected layer followed by a sigmoid layer. This is used for testing customized operation handles. """ def __init__(self, input_dim: 'int', output_dim: 'int') ->None: super(CustomNet, 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.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DenXX/fvcore
CustomNet
false
2,206
[ "Apache-2.0" ]
0
4b91cf092f4f5d379b2c93398780a3b5755e7179
https://github.com/DenXX/fvcore/tree/4b91cf092f4f5d379b2c93398780a3b5755e7179
BPRLoss
import torch import torch.nn as nn import torch.nn.functional as F class BPRLoss(nn.Module): def __init__(self): super(BPRLoss, self).__init__() def forward(self, logit): """ Args: logit (BxB): Variable that stores the logits for the items in the mini-batch ...
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...
Ethan-Yys/GRU4REC-pytorch-master
BPRLoss
false
2,207
[ "Apache-2.0" ]
0
175ccb851f881d3506680c459491e76f50aa9898
https://github.com/Ethan-Yys/GRU4REC-pytorch-master/tree/175ccb851f881d3506680c459491e76f50aa9898
ResBlock
import torch import torch.nn as nn def get_same_padding(kernel_size, dilation): kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1) padding = (kernel_size - 1) // 2 return padding class ResBlock(nn.Module): def __init__(self, inplanes, planes, kernel_size=3, stride=1, dilation=1): ...
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_...
Etienne66/CDVD-TSP
ResBlock
false
2,208
[ "MIT" ]
0
fccde88ff75832286612262613808eef7b1c3255
https://github.com/Etienne66/CDVD-TSP/tree/fccde88ff75832286612262613808eef7b1c3255
Copy
import torch import torch.nn as nn import torch.utils.data import torch.nn.init class Copy(nn.Module): def __init__(self, hidden_size, copy_weight=1.0): super().__init__() self.Wcopy = nn.Linear(hidden_size, hidden_size) self.copy_weight = copy_weight def forward(self, enc_out_hs, de...
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 ...
ChrisGeishauser/ConvLab-2
Copy
false
2,209
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
BinaryNLLEntropy
import torch import torch.nn.functional as F import torch.utils.data import torch.nn.init from torch.nn.modules.loss import _Loss class BinaryNLLEntropy(_Loss): def __init__(self, size_average=True): super(BinaryNLLEntropy, self).__init__() self.size_average = size_average def forward(self, ...
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...
ChrisGeishauser/ConvLab-2
BinaryNLLEntropy
false
2,210
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
ClassHead
import torch from itertools import product as product import torch.nn as nn class ClassHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(ClassHead, self).__init__() self.num_anchors = num_anchors self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 2, ...
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 itertools import product as product import torch.nn as nn assert_size_strid...
Danil328/Pytorch_Retinaface
ClassHead
false
2,211
[ "MIT" ]
0
048a1d68217b2a99fbf83e2537ecc7e281ed6bd6
https://github.com/Danil328/Pytorch_Retinaface/tree/048a1d68217b2a99fbf83e2537ecc7e281ed6bd6
SmallConvNet
import torch import torch.nn as nn from numpy import prod class SmallConvNet(nn.Module): """ A network with three conv layers. This is used for testing convolution layers for activation count. """ def __init__(self, input_dim: 'int') ->None: super(SmallConvNet, self).__init__() 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 import torch.nn as nn from numpy import prod assert_size_stride = torch._C._dyna...
DenXX/fvcore
SmallConvNet
false
2,212
[ "Apache-2.0" ]
0
4b91cf092f4f5d379b2c93398780a3b5755e7179
https://github.com/DenXX/fvcore/tree/4b91cf092f4f5d379b2c93398780a3b5755e7179
DPSLTMAdapter
import math import torch from torch import Tensor import torch.nn as nn from torch.nn.utils.rnn import pad_sequence import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Union from typing import List from typing import Tuple from typing import Optional from torch.nn.uti...
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 math from to...
EXAPPAI/opacus
DPSLTMAdapter
false
2,213
[ "Apache-2.0" ]
0
11e188a2f03a8a08be51fdf2367cc1387879312a
https://github.com/EXAPPAI/opacus/tree/11e188a2f03a8a08be51fdf2367cc1387879312a
LandmarkHead
import torch from itertools import product as product import torch.nn as nn class LandmarkHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(LandmarkHead, self).__init__() self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size= (1, 1), stride=1, padd...
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 itertools import product as product import torch.nn as nn assert_size_strid...
Danil328/Pytorch_Retinaface
LandmarkHead
false
2,214
[ "MIT" ]
0
048a1d68217b2a99fbf83e2537ecc7e281ed6bd6
https://github.com/Danil328/Pytorch_Retinaface/tree/048a1d68217b2a99fbf83e2537ecc7e281ed6bd6
Normalize
import torch import torch.nn as nn from itertools import product as product class Normalize(nn.Module): def __init__(self, n_channels, scale=1.0): super(Normalize, self).__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(...
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 as nn from itertools import product as product assert_size_stri...
DongChengdongHangZhou/caffe-to-pytorch
Normalize
false
2,215
[ "Apache-2.0" ]
0
5e3104f3aa77d35bad5d2de235b067460c136fd5
https://github.com/DongChengdongHangZhou/caffe-to-pytorch/tree/5e3104f3aa77d35bad5d2de235b067460c136fd5
BboxHead
import torch from itertools import product as product import torch.nn as nn class BboxHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(BboxHead, self).__init__() self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=( 1, 1), stride=1, padding=0) ...
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 itertools import product as product import torch.nn as nn assert_size_strid...
Danil328/Pytorch_Retinaface
BboxHead
false
2,216
[ "MIT" ]
0
048a1d68217b2a99fbf83e2537ecc7e281ed6bd6
https://github.com/Danil328/Pytorch_Retinaface/tree/048a1d68217b2a99fbf83e2537ecc7e281ed6bd6
ConvNet
import torch import torch.nn as nn class ConvNet(nn.Module): """ A network with a single convolution layer. This is used for testing flop count for convolution layers. """ def __init__(self, conv_dim: 'int', input_dim: 'int', output_dim: 'int', kernel_size: 'int', spatial_dim: 'int', stri...
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...
DenXX/fvcore
ConvNet
false
2,217
[ "Apache-2.0" ]
0
4b91cf092f4f5d379b2c93398780a3b5755e7179
https://github.com/DenXX/fvcore/tree/4b91cf092f4f5d379b2c93398780a3b5755e7179
TOP1Loss
import torch import torch.nn as nn class TOP1Loss(nn.Module): def __init__(self): super(TOP1Loss, self).__init__() def forward(self, logit): """ Args: logit (BxB): Variable that stores the logits for the items in the mini-batch The first dimension...
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...
Ethan-Yys/GRU4REC-pytorch-master
TOP1Loss
false
2,218
[ "Apache-2.0" ]
0
175ccb851f881d3506680c459491e76f50aa9898
https://github.com/Ethan-Yys/GRU4REC-pytorch-master/tree/175ccb851f881d3506680c459491e76f50aa9898
PNet
import torch import torch.nn.functional as F import torch.nn as nn from collections import OrderedDict class PNet(nn.Module): def __init__(self): super(PNet, self).__init__() self.features = nn.Sequential(OrderedDict([('conv1', nn.Conv2d(3, 10, 3, 1)), ('prelu1', nn.PReLU(10)), ('poo...
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....
Escaton615/mtcnn-pytorch
PNet
false
2,219
[ "MIT" ]
0
4a645c1bf8dca0b5410cc0454ee0a538ada2d241
https://github.com/Escaton615/mtcnn-pytorch/tree/4a645c1bf8dca0b5410cc0454ee0a538ada2d241
Conv2d_GN_ReLU
import torch import torch.nn as nn class Conv2d_GN_ReLU(nn.Module): """ Implements a module that performs conv2d + groupnorm + ReLU + Assumes kernel size is odd """ def __init__(self, in_channels, out_channels, num_groups, ksize=3, stride=1 ): super(Conv2d_GN_ReLU, ...
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....
FANG-Xiaolin/uois
Conv2d_GN_ReLU
false
2,220
[ "MIT" ]
0
7489e69d1513faf2f3f030a441abdd33ca22304c
https://github.com/FANG-Xiaolin/uois/tree/7489e69d1513faf2f3f030a441abdd33ca22304c
mlp
import torch from torch import nn class mlp(nn.Module): def __init__(self, in_feature, **kwargs): super().__init__() self.in_feature = in_feature self.relu = nn.ReLU() self.linear1 = nn.Linear(in_feature, in_feature) self.dropout1 = nn.Dropout(p=0.3) self.linear2 =...
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...
EuphoriaYan/sales_pred
mlp
false
2,221
[ "MIT" ]
0
cc39c32a3387285f3561aeeea7a133810069dc98
https://github.com/EuphoriaYan/sales_pred/tree/cc39c32a3387285f3561aeeea7a133810069dc98
ScaledDotProductAttention
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch.nn.init class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.tempera...
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....
ChrisGeishauser/ConvLab-2
ScaledDotProductAttention
false
2,222
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
CELossWeighted
import torch import torch.nn as nn class WeightedLoss(nn.Module): def __init__(self): super(WeightedLoss, self).__init__() self.weighted = False def generate_weight_mask(self, mask, to_ignore=None): """ Generates a weight mask where pixel weights are inversely proportional to ...
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 ...
FANG-Xiaolin/uois
CELossWeighted
false
2,223
[ "MIT" ]
0
7489e69d1513faf2f3f030a441abdd33ca22304c
https://github.com/FANG-Xiaolin/uois/tree/7489e69d1513faf2f3f030a441abdd33ca22304c
SelfAttn
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.nn.init import torch as th class SelfAttn(nn.Module): def __init__(self, hidden_size): super(SelfAttn, self).__init__() self.query = nn.Linear(hidden_size, 1) def forward(self, keys, 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 import triton_helpers from torch._inductor.runtime....
ChrisGeishauser/ConvLab-2
SelfAttn
false
2,224
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
BCEWithLogitsLossWeighted
import torch import torch.nn as nn class WeightedLoss(nn.Module): def __init__(self): super(WeightedLoss, self).__init__() self.weighted = False def generate_weight_mask(self, mask, to_ignore=None): """ Generates a weight mask where pixel weights are inversely proportional to ...
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...
FANG-Xiaolin/uois
BCEWithLogitsLossWeighted
false
2,225
[ "MIT" ]
0
7489e69d1513faf2f3f030a441abdd33ca22304c
https://github.com/FANG-Xiaolin/uois/tree/7489e69d1513faf2f3f030a441abdd33ca22304c
Attn
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.nn.init class Attn(nn.Module): def __init__(self, method, hidden_size): super(Attn, self).__init__() self.method = method self.hidden_size = hidden_size self.attn = ...
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....
ChrisGeishauser/ConvLab-2
Attn
false
2,226
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
Scale
import torch import torch.nn as nn from torch.nn.parameter import Parameter from itertools import product as product class Scale(nn.Module): def __init__(self, channels): super(Scale, self).__init__() self.weight = Parameter(torch.Tensor(channels)) self.bias = Parameter(torch.Tensor(chann...
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 from torch.nn.parameter import Parameter from itertools import product as product assert_size_stride = torch._C._dynam...
DongChengdongHangZhou/caffe-to-pytorch
Scale
false
2,227
[ "Apache-2.0" ]
0
5e3104f3aa77d35bad5d2de235b067460c136fd5
https://github.com/DongChengdongHangZhou/caffe-to-pytorch/tree/5e3104f3aa77d35bad5d2de235b067460c136fd5
PositionwiseFeedForward
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.nn.init class PositionwiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.1): super(PositionwiseFeedForward, self).__init__() 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 from torch._inductor.runtime....
ChrisGeishauser/ConvLab-2
PositionwiseFeedForward
false
2,228
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
BPR_max
import torch import torch.nn as nn import torch.nn.functional as F class BPR_max(nn.Module): def __init__(self): super(BPR_max, self).__init__() def forward(self, logit): logit_softmax = F.softmax(logit, dim=1) diff = logit.diag().view(-1, 1).expand_as(logit) - logit loss = -...
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 ...
Ethan-Yys/GRU4REC-pytorch-master
BPR_max
false
2,229
[ "Apache-2.0" ]
0
175ccb851f881d3506680c459491e76f50aa9898
https://github.com/Ethan-Yys/GRU4REC-pytorch-master/tree/175ccb851f881d3506680c459491e76f50aa9898
SilogLoss
import torch import torch.nn as nn class SilogLoss(nn.Module): def __init__(self, ratio=10, ratio2=0.85): super().__init__() self.ratio = ratio self.ratio2 = ratio2 def forward(self, pred, gt): log_diff = torch.log(pred * self.ratio) - torch.log(gt * self.ratio) silog...
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...
Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-
SilogLoss
false
2,230
[ "MIT" ]
0
13fac05601efed16ae8b29989aad487e04cd90a7
https://github.com/Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-/tree/13fac05601efed16ae8b29989aad487e04cd90a7
PatchEmbed
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class PatchEmbed(nn.Module): """ PatchEmbed. """ def __init__(self, dim_in=3, dim_out=768, kernel=(1, 16, 16), stride=(1, 4, 4), padding=(1, 7, 7), conv_2d=False): super().__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 itertools import chain as chain import torch.utils.data import torch.nn as ...
Drill-D/SlowFast
PatchEmbed
false
2,231
[ "Apache-2.0" ]
0
d55ae1cf30a9415858a9bd5da983790a2b418653
https://github.com/Drill-D/SlowFast/tree/d55ae1cf30a9415858a9bd5da983790a2b418653
ThreeNet
import torch import torch.nn as nn class ThreeNet(nn.Module): """ A network with three layers. This is used for testing a network with more than one operation. The network has a convolution layer followed by two fully connected layers. """ def __init__(self, input_dim: 'int', conv_dim: '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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DenXX/fvcore
ThreeNet
false
2,232
[ "Apache-2.0" ]
0
4b91cf092f4f5d379b2c93398780a3b5755e7179
https://github.com/DenXX/fvcore/tree/4b91cf092f4f5d379b2c93398780a3b5755e7179
Hidden2Discrete
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.nn.init class Hidden2Discrete(nn.Module): def __init__(self, input_size, y_size, k_size, is_lstm=False, has_bias=True ): super(Hidden2Discrete, self).__init__() self.y_size = y_size ...
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....
ChrisGeishauser/ConvLab-2
Hidden2Discrete
false
2,233
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
NormKLLoss
import torch import torch.utils.data import torch.nn.init import torch as th from torch.nn.modules.loss import _Loss class NormKLLoss(_Loss): def __init__(self, unit_average=False): super(NormKLLoss, self).__init__() self.unit_average = unit_average def forward(self, recog_mu, recog_logvar, ...
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.utils.data import torch.nn.init from torch.nn.modules.loss i...
ChrisGeishauser/ConvLab-2
NormKLLoss
false
2,234
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
tofp16
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel import torch.optim class tofp16(nn.Module): """ Model wrapper that implements:: def forward(self, input): return input.half() """ def __init__(self): su...
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 import torch.utils.data.distributed import torch.nn.parallel import torch.optim assert_size_st...
FDecaYed/apex
tofp16
false
2,235
[ "BSD-3-Clause" ]
0
789afd89fe2c5a3e772f557055a9cf0f5e9d1241
https://github.com/FDecaYed/apex/tree/789afd89fe2c5a3e772f557055a9cf0f5e9d1241
ConvBlock
import torch import torch.nn as nn class Conv3x3(nn.Module): """Layer to pad and convolve input """ def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = ...
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...
Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-
ConvBlock
false
2,236
[ "MIT" ]
0
13fac05601efed16ae8b29989aad487e04cd90a7
https://github.com/Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-/tree/13fac05601efed16ae8b29989aad487e04cd90a7
PairwiseBCELoss
import torch from abc import abstractmethod import torch.utils.data.dataloader import torch.nn.functional as F import torch.nn as nn import torch.nn class SimilarityLoss(nn.Module): def __init__(self): super(SimilarityLoss, self).__init__() @abstractmethod def forward(self, inputs, targets): ...
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 from abc im...
FranziskaKuhls/flair
PairwiseBCELoss
false
2,237
[ "MIT" ]
0
2bd9e72c961651c7c020076cb8fd80cbbb36da7c
https://github.com/FranziskaKuhls/flair/tree/2bd9e72c961651c7c020076cb8fd80cbbb36da7c
Sine
import torch import torch.nn as nn class Sine(nn.Module): """ A wrapper for PyTorch sine function. """ def __init__(self, w0=1.0): super().__init__() self.w0 = w0 @staticmethod def forward(x): return torch.sin(x) def get_inputs(): return [torch.rand([4, 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 assert_size_stride = torch._C._dynamo.guards.assert...
FinbarArgus/phynn
Sine
false
2,238
[ "Apache-2.0" ]
0
436bfd6fa4ad86692bf12b4f76c92bc177626c40
https://github.com/FinbarArgus/phynn/tree/436bfd6fa4ad86692bf12b4f76c92bc177626c40
InvDepth
import torch import torch.nn as nn class InvDepth(nn.Module): """Inverse depth layer""" def __init__(self, in_channels, out_channels=1, min_depth=0.5): """ Initializes an InvDepth object. Parameters ---------- in_channels : int Number of input 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...
Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-
InvDepth
false
2,239
[ "MIT" ]
0
13fac05601efed16ae8b29989aad487e04cd90a7
https://github.com/Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-/tree/13fac05601efed16ae8b29989aad487e04cd90a7
FeatNet
import torch import torch.nn as nn from itertools import product as product class FeatNet(nn.Module): def __init__(self): super(FeatNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size= (3, 7), stride=1, padding=(1, 3), bias=False) self.tanh...
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 ...
DongChengdongHangZhou/caffe-to-pytorch
FeatNet
false
2,240
[ "Apache-2.0" ]
0
5e3104f3aa77d35bad5d2de235b067460c136fd5
https://github.com/DongChengdongHangZhou/caffe-to-pytorch/tree/5e3104f3aa77d35bad5d2de235b067460c136fd5
PaddedMaxPool2d
import torch import torch.nn as nn import torch.nn.functional as F class PaddedMaxPool2d(nn.Module): """ Maxpool layer with a replicating padding. Args: kernel_size (int or tuple): Kernel size for maxpooling stride (int or tuple, optional): The stride of the window; Default ``kernel_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._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
FenryrMKIII/objectDetection-lightnet
PaddedMaxPool2d
false
2,241
[ "MIT" ]
0
3a1fa7b77227210060714a9e22d7d241888b36b4
https://github.com/FenryrMKIII/objectDetection-lightnet/tree/3a1fa7b77227210060714a9e22d7d241888b36b4
Residual
import torch import torch.nn as nn class Residual(nn.Sequential): """ Residual block that runs like a Sequential, but then adds the original input to the output tensor. See :class:`torch.nn.Sequential` for more information. Warning: The dimension between the input and output of the mo...
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...
FenryrMKIII/objectDetection-lightnet
Residual
false
2,242
[ "MIT" ]
0
3a1fa7b77227210060714a9e22d7d241888b36b4
https://github.com/FenryrMKIII/objectDetection-lightnet/tree/3a1fa7b77227210060714a9e22d7d241888b36b4
CELossWeightedMasked
import torch import torch.nn as nn class WeightedLoss(nn.Module): def __init__(self): super(WeightedLoss, self).__init__() self.weighted = False def generate_weight_mask(self, mask, to_ignore=None): """ Generates a weight mask where pixel weights are inversely proportional to ...
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 ...
FANG-Xiaolin/uois
CELossWeightedMasked
false
2,243
[ "MIT" ]
0
7489e69d1513faf2f3f030a441abdd33ca22304c
https://github.com/FANG-Xiaolin/uois/tree/7489e69d1513faf2f3f030a441abdd33ca22304c
upsample
import torch import torch.nn as nn class upsample(nn.Module): def __init__(self, scale_factor): super(upsample, self).__init__() self.scale_factor = scale_factor def forward(self, x): return nn.functional.interpolate(x, scale_factor=self.scale_factor) def get_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...
FMsunyh/CornerNet-Lite
upsample
false
2,244
[ "BSD-3-Clause" ]
0
85770fa6682646d572a5bd2277a0075d6dd22b93
https://github.com/FMsunyh/CornerNet-Lite/tree/85770fa6682646d572a5bd2277a0075d6dd22b93
Conv3x3
import torch import torch.nn as nn class Conv3x3(nn.Module): """Layer to pad and convolve input """ def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = ...
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....
Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-
Conv3x3
false
2,245
[ "MIT" ]
0
13fac05601efed16ae8b29989aad487e04cd90a7
https://github.com/Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-/tree/13fac05601efed16ae8b29989aad487e04cd90a7
Conv2d_GN_ReLUx2
import torch import torch.nn as nn class Conv2d_GN_ReLU(nn.Module): """ Implements a module that performs conv2d + groupnorm + ReLU + Assumes kernel size is odd """ def __init__(self, in_channels, out_channels, num_groups, ksize=3, stride=1 ): super(Conv2d_GN_ReLU, ...
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....
FANG-Xiaolin/uois
Conv2d_GN_ReLUx2
false
2,246
[ "MIT" ]
0
7489e69d1513faf2f3f030a441abdd33ca22304c
https://github.com/FANG-Xiaolin/uois/tree/7489e69d1513faf2f3f030a441abdd33ca22304c
Reorg
import torch import torch.nn as nn class Reorg(nn.Module): """ This layer reorganizes a tensor according to a stride. The dimensions 2,3 will be sliced by the stride and then stacked in dimension 1. (input must have 4 dimensions) Args: stride (int): stride to divide the input tensor """ ...
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...
FenryrMKIII/objectDetection-lightnet
Reorg
false
2,247
[ "MIT" ]
0
3a1fa7b77227210060714a9e22d7d241888b36b4
https://github.com/FenryrMKIII/objectDetection-lightnet/tree/3a1fa7b77227210060714a9e22d7d241888b36b4
LayerNorm
import torch import torch.nn as nn import torch.nn.parallel class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: ...
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 as nn import torch.nn.parallel assert_size_stride = torch._C._d...
FUTUREEEEEE/S2R-DepthNet
LayerNorm
false
2,248
[ "MIT" ]
0
415cc40aef10f9540026ff435d14a9ba9e30ad74
https://github.com/FUTUREEEEEE/S2R-DepthNet/tree/415cc40aef10f9540026ff435d14a9ba9e30ad74
Conv2dBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps ...
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 ...
FUTUREEEEEE/S2R-DepthNet
Conv2dBlock
false
2,249
[ "MIT" ]
0
415cc40aef10f9540026ff435d14a9ba9e30ad74
https://github.com/FUTUREEEEEE/S2R-DepthNet/tree/415cc40aef10f9540026ff435d14a9ba9e30ad74
Siren
import math import torch import torch.nn as nn import torch.nn.functional as F class Sine(nn.Module): """ A wrapper for PyTorch sine function. """ def __init__(self, w0=1.0): super().__init__() self.w0 = w0 @staticmethod def forward(x): return torch.sin(x) class Sir...
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 math i...
FinbarArgus/phynn
Siren
false
2,250
[ "Apache-2.0" ]
0
436bfd6fa4ad86692bf12b4f76c92bc177626c40
https://github.com/FinbarArgus/phynn/tree/436bfd6fa4ad86692bf12b4f76c92bc177626c40
ResBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps ...
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 ...
FUTUREEEEEE/S2R-DepthNet
ResBlock
false
2,251
[ "MIT" ]
0
415cc40aef10f9540026ff435d14a9ba9e30ad74
https://github.com/FUTUREEEEEE/S2R-DepthNet/tree/415cc40aef10f9540026ff435d14a9ba9e30ad74
UnpackLayerConv2d
import torch import torch.nn as nn class Conv2D(nn.Module): """ 2D convolution with GroupNorm and ELU Parameters ---------- in_channels : int Number of input channels out_channels : int Number of output channels kernel_size : int Kernel size 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-
UnpackLayerConv2d
false
2,252
[ "MIT" ]
0
13fac05601efed16ae8b29989aad487e04cd90a7
https://github.com/Fatmangh/VIDEO-ACTION-CLASSIFICATION-USING-PRETAINED-SELF-SUPERVISED-DEPTH-AWARE-DENSE-PREDICTIVE-CODING-/tree/13fac05601efed16ae8b29989aad487e04cd90a7
DAInsHead
import torch import torch.utils.data import torch.nn.functional as F from torch import nn class DAInsHead(nn.Module): """ Adds a simple Instance-level Domain Classifier head """ def __init__(self, in_channels): """ Arguments: in_channels (int): number of channels of the 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.utils.data from ...
Feobi1999/unbiased-teacher
DAInsHead
false
2,254
[ "MIT" ]
0
9baacec16833bdff0dc089057e50903a92c700cb
https://github.com/Feobi1999/unbiased-teacher/tree/9baacec16833bdff0dc089057e50903a92c700cb
Network
import torch import torch.nn as nn import torch.nn.functional as F class Network(nn.Module): def __init__(self, input_size, nb_action): super(Network, self).__init__() self.input_size = input_size self.nb_action = nb_action self.fc1 = nn.Linear(input_size, 30) self.fc2 = 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 import torch.nn as nn assert_...
Flames-LLC/GX-V1NLPModule
Network
false
2,255
[ "MIT" ]
0
85e656c02269e57384b6e67ab4e4bceef4feb92e
https://github.com/Flames-LLC/GX-V1NLPModule/tree/85e656c02269e57384b6e67ab4e4bceef4feb92e
FocalLoss
import torch import torch.utils.data import torch.nn.functional as F from torch import nn class FocalLoss(nn.Module): def __init__(self, weight=None, gamma=1.0, num_classes=80): super(FocalLoss, self).__init__() assert gamma >= 0 self.gamma = gamma self.weight = weight sel...
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.utils.dat...
Feobi1999/unbiased-teacher
FocalLoss
false
2,256
[ "MIT" ]
0
9baacec16833bdff0dc089057e50903a92c700cb
https://github.com/Feobi1999/unbiased-teacher/tree/9baacec16833bdff0dc089057e50903a92c700cb
RankingLoss
import torch from abc import abstractmethod import torch.utils.data.dataloader import torch.nn.functional as F import torch.nn as nn import torch.nn class SimilarityLoss(nn.Module): def __init__(self): super(SimilarityLoss, self).__init__() @abstractmethod def forward(self, inputs, targets): ...
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 abc import abstractmethod import torch.utils.data.dataloader import torch.nn as nn i...
FranziskaKuhls/flair
RankingLoss
false
2,257
[ "MIT" ]
0
2bd9e72c961651c7c020076cb8fd80cbbb36da7c
https://github.com/FranziskaKuhls/flair/tree/2bd9e72c961651c7c020076cb8fd80cbbb36da7c
KeyValueAttention
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F import torch.utils.data import torch.nn.init class KeyValueAttention(nn.Module): def __init__(self, query_size, key_size, value_size, hid_size, init_range): super(KeyValueAttention, 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 import triton_helpers from torch._inductor.runtime....
ChrisGeishauser/ConvLab-2
KeyValueAttention
false
2,258
[ "Apache-2.0" ]
0
8f55d033c6e2453fdc092c4f504be3973a55e7ea
https://github.com/ChrisGeishauser/ConvLab-2/tree/8f55d033c6e2453fdc092c4f504be3973a55e7ea
NodeAdaptiveEncoder
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class NodeAdaptiveEncoder(nn.Module): def __init__(self, num_features, dropout=0.5): super(NodeAdaptiveEncoder, self).__init__() self.fc = nn.Parameter(torch.zeros(size=(num_features, 1))) nn.init.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 import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dyn...
Brickser/cogdl
NodeAdaptiveEncoder
false
2,259
[ "MIT" ]
0
3952dd11075634cc0f3b669996cfc780635ce026
https://github.com/Brickser/cogdl/tree/3952dd11075634cc0f3b669996cfc780635ce026
Wide
import math import torch from torch import Tensor from torch import nn class Wide(nn.Module): """Wide component Linear model implemented via an Embedding layer connected to the output neuron(s). Parameters ----------- wide_dim: int size of the Embedding layer. `wide_dim` is the summa...
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 math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guard...
FlyingWing/pytorch-widedeep
Wide
false
2,260
[ "MIT" ]
0
91a255d08bc9bdd5a05669465b7cf0313849ec9c
https://github.com/FlyingWing/pytorch-widedeep/tree/91a255d08bc9bdd5a05669465b7cf0313849ec9c
Classifier
import torch import torch.utils.data import torch.nn as nn class Classifier(nn.Module): def __init__(self, n_hid, n_out): super(Classifier, self).__init__() self.n_hid = n_hid self.n_out = n_out self.linear = nn.Linear(n_hid, n_out) def forward(self, x): tx = self.lin...
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....
Brickser/cogdl
Classifier
false
2,261
[ "MIT" ]
0
3952dd11075634cc0f3b669996cfc780635ce026
https://github.com/Brickser/cogdl/tree/3952dd11075634cc0f3b669996cfc780635ce026
DistMultLayer
import torch import torch.utils.data import torch.nn as nn class DistMultLayer(nn.Module): def __init__(self): super(DistMultLayer, self).__init__() def forward(self, sub_emb, obj_emb, rel_emb): return torch.sum(sub_emb * obj_emb * rel_emb, dim=-1) def predict(self, sub_emb, obj_emb, re...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Brickser/cogdl
DistMultLayer
false
2,262
[ "MIT" ]
0
3952dd11075634cc0f3b669996cfc780635ce026
https://github.com/Brickser/cogdl/tree/3952dd11075634cc0f3b669996cfc780635ce026
StdConv2d
import torch import torch.nn as nn import torch.nn.functional as F class StdConv2d(nn.Conv2d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False) w = (w - m) / torch.sqrt(v + 1e-05) return F.conv2d(x, w, self.bias, self.stri...
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 ...
GUOSHU-COOL/TransUNet
StdConv2d
false
2,263
[ "Apache-2.0" ]
0
6cb2c2f35eb6a571b12edbd095de5dda16c25015
https://github.com/GUOSHU-COOL/TransUNet/tree/6cb2c2f35eb6a571b12edbd095de5dda16c25015
clip_nonlinear
import torch import torch.nn as nn def quantize_a(x): x = Q_A.apply(x) return x def fa(x, bitA): if bitA == 32: return x return quantize_a(x) class Q_A(torch.autograd.Function): @staticmethod def forward(ctx, x): ctx.save_for_backward(x) out = x.new(x.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
GakkiChen/TWB-Net
clip_nonlinear
false
2,264
[ "MIT" ]
0
bb4917c697c09585bb3fe163a8b429b6dd250f18
https://github.com/GakkiChen/TWB-Net/tree/bb4917c697c09585bb3fe163a8b429b6dd250f18
GELU
import math import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain import torch.hub class GELU(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU """ 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.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel import torch.optim import torch....
EddieMG/LateTemporalModeling3DCNN
GELU
false
2,265
[ "MIT" ]
0
94c87dc1d31d09bc310d0e735a2e55453976cb0d
https://github.com/EddieMG/LateTemporalModeling3DCNN/tree/94c87dc1d31d09bc310d0e735a2e55453976cb0d
ChannelPool
import torch import torch.nn as nn import torch.onnx import torch.nn.parallel class ChannelPool(nn.Module): def forward(self, x): return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1) .unsqueeze(1)), dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init...
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.onnx import torch.nn.parallel assert_size_stride = tor...
Ganzooo/soil_segmentation
ChannelPool
false
2,266
[ "MIT" ]
0
56f410e3e184f24e52dd4b542ea309f0d203ca00
https://github.com/Ganzooo/soil_segmentation/tree/56f410e3e184f24e52dd4b542ea309f0d203ca00
BERTEmbedding4
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain import torch.hub class LearnedPositionalEmbedding3(nn.Module): def __init__(self, d_model, max_len=512): super().__init__() pe = torch.zeros(max_len, d_model...
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.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain import torch....
EddieMG/LateTemporalModeling3DCNN
BERTEmbedding4
false
2,267
[ "MIT" ]
0
94c87dc1d31d09bc310d0e735a2e55453976cb0d
https://github.com/EddieMG/LateTemporalModeling3DCNN/tree/94c87dc1d31d09bc310d0e735a2e55453976cb0d
BERTEmbedding3
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain import torch.hub class LearnedPositionalEmbedding(nn.Module): def __init__(self, d_model, max_len=512): super().__init__() pe = torch.zeros(max_len, d_model)...
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.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain import torch....
EddieMG/LateTemporalModeling3DCNN
BERTEmbedding3
false
2,268
[ "MIT" ]
0
94c87dc1d31d09bc310d0e735a2e55453976cb0d
https://github.com/EddieMG/LateTemporalModeling3DCNN/tree/94c87dc1d31d09bc310d0e735a2e55453976cb0d
Network
import torch import torch.nn as nn class Network(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv3d(in_channels=1, out_channels=3, kernel_size=3) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 1, 64, 64, 64])] def get_...
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...
GReguig/torchio
Network
false
2,269
[ "Apache-2.0" ]
0
0cd4f3105408410adda4fddf4873eb8c12883ecc
https://github.com/GReguig/torchio/tree/0cd4f3105408410adda4fddf4873eb8c12883ecc
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, loss_weight=1.0): super(DiceLoss, self).__init__() self.loss_weight = loss_weight def forward(self, input, target, mask, reduce=True): batch_size = input.size(0) input = torch.sigmoid(input) ...
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...
GaroneHuang/pan_pp.pytorch
DiceLoss
false
2,270
[ "Apache-2.0" ]
0
dde41ad652179433ad8a9650f671dc6742b783f9
https://github.com/GaroneHuang/pan_pp.pytorch/tree/dde41ad652179433ad8a9650f671dc6742b783f9
CMVN
import torch import torch.nn as nn class CMVN(nn.Module): __constants__ = ['mode', 'dim', 'eps'] def __init__(self, mode='global', dim=2, eps=1e-10): super(CMVN, self).__init__() if mode != 'global': raise NotImplementedError( 'Only support global mean variance nor...
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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Ethan07902050/s3prl
CMVN
false
2,271
[ "MIT" ]
0
854aff0b3062fc2cff531401923b8745f64701e7
https://github.com/Ethan07902050/s3prl/tree/854aff0b3062fc2cff531401923b8745f64701e7
Block
import torch import torch.nn as nn import torch.autograd def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, ...
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....
FelixWUS/TransReID
Block
false
2,272
[ "MIT" ]
0
9b0c6f30bd726677a4ce44450cb89427f05df9b1
https://github.com/FelixWUS/TransReID/tree/9b0c6f30bd726677a4ce44450cb89427f05df9b1
StableBCELoss
import torch class StableBCELoss(torch.nn.modules.Module): def __init__(self): super(StableBCELoss, self).__init__() def forward(self, input, target): neg_abs = -input.abs() loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log() return loss.mean() 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 assert_size_stride = t...
GenoM87/hubmap
StableBCELoss
false
2,273
[ "MIT" ]
0
4acd11c373c6bb136ea9c6627a174ff02afa5986
https://github.com/GenoM87/hubmap/tree/4acd11c373c6bb136ea9c6627a174ff02afa5986
ConsinSimilarityLoss
import torch import torch.nn as nn class ConsinSimilarityLoss(nn.Module): def __init__(self, dim: 'int'=1, eps: 'float'=1e-08, min_zero: 'bool'=True ): super().__init__() self.criterion = nn.CosineSimilarity(dim, eps) self.min_zero = min_zero def forward(self, output: '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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
Geson-anko/VQ_AutoEncoder
ConsinSimilarityLoss
false
2,274
[ "MIT" ]
0
62e1694de38ea6f152891e19abc190ad4048e587
https://github.com/Geson-anko/VQ_AutoEncoder/tree/62e1694de38ea6f152891e19abc190ad4048e587
SDNE_layer
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class SDNE_layer(nn.Module): def __init__(self, num_node, hidden_size1, hidden_size2, droput, alpha, beta, nu1, nu2): super(SDNE_layer, self).__init__() self.num_node = num_node self.hidden_...
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....
Brickser/cogdl
SDNE_layer
false
2,275
[ "MIT" ]
0
3952dd11075634cc0f3b669996cfc780635ce026
https://github.com/Brickser/cogdl/tree/3952dd11075634cc0f3b669996cfc780635ce026
MaxPool
import torch import torch.utils.data import torch.nn as nn from torch import optim as optim import torch.nn.parallel class MaxPool(nn.Module): def __init__(self, kernel_size, stride=1, padding=1, zero_pad=False): super(MaxPool, self).__init__() self.zero_pad = nn.ZeroPad2d((1, 0, 1, 0)) if zero_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 import torch.utils.data import torch.nn as nn from torch import optim as optim import tor...
Exir-lxr/crldr-prune-pytorch
MaxPool
false
2,276
[ "Apache-2.0" ]
0
adeb5e0b24ce66ff9531d4d947f72412c1b5c033
https://github.com/Exir-lxr/crldr-prune-pytorch/tree/adeb5e0b24ce66ff9531d4d947f72412c1b5c033
SelfAttentionPooling
import torch import torch.nn as nn class SelfAttentionPooling(nn.Module): """ Implementation of SelfAttentionPooling Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition https://arxiv.org/pdf/2008.01077v1.pdf """ def __init__(self, input_dim): super(SelfAttentio...
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....
Ethan07902050/s3prl
SelfAttentionPooling
false
2,277
[ "MIT" ]
0
854aff0b3062fc2cff531401923b8745f64701e7
https://github.com/Ethan07902050/s3prl/tree/854aff0b3062fc2cff531401923b8745f64701e7
CossimLoss
import torch import torch.nn as nn class CossimLoss(nn.Module): def __init__(self, dim: 'int'=1, eps: 'float'=1e-08): super().__init__() self.cos_sim = nn.CosineSimilarity(dim, eps) def forward(self, output, target): return -self.cos_sim(output, target).mean() + 1 def get_inputs():...
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 as nn assert...
Geson-anko/VQ_AutoEncoder
CossimLoss
false
2,278
[ "MIT" ]
0
62e1694de38ea6f152891e19abc190ad4048e587
https://github.com/Geson-anko/VQ_AutoEncoder/tree/62e1694de38ea6f152891e19abc190ad4048e587
MovingAverage
import torch from torch import Tensor import torch as pt from torch import nn class MovingAverage(nn.Module): def __init__(self, cond_size: 'int', pred_size: 'int') ->None: super().__init__() self.left_window = cond_size // 2 self.right_window = cond_size - self.left_window def forwa...
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...
Gandor26/cacovid
MovingAverage
false
2,279
[ "MIT" ]
0
2b966579dba1eac6e33f439515de6de9e802d08a
https://github.com/Gandor26/cacovid/tree/2b966579dba1eac6e33f439515de6de9e802d08a
MaskNet
import torch import torch.nn as nn from itertools import product as product class MaskNet(nn.Module): def __init__(self): super(MaskNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size= 5, stride=1, padding=2) self.relu1 = nn.ReLU() ...
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 it...
DongChengdongHangZhou/caffe-to-pytorch
MaskNet
false
2,280
[ "Apache-2.0" ]
0
5e3104f3aa77d35bad5d2de235b067460c136fd5
https://github.com/DongChengdongHangZhou/caffe-to-pytorch/tree/5e3104f3aa77d35bad5d2de235b067460c136fd5
self_conv
import torch import torch.nn as nn import torch.nn.functional as F def quantize_w(x): x = Q_W.apply(x) return x def fw(x, bitW): if bitW == 32: return x x = quantize_w(x) return x class Q_W(torch.autograd.Function): @staticmethod def forward(ctx, x): return x.sign() * ...
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....
GakkiChen/TWB-Net
self_conv
false
2,281
[ "MIT" ]
0
bb4917c697c09585bb3fe163a8b429b6dd250f18
https://github.com/GakkiChen/TWB-Net/tree/bb4917c697c09585bb3fe163a8b429b6dd250f18
Fp32GroupNorm
import torch import torch.nn as nn import torch.nn.functional as F class Fp32GroupNorm(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input): output = F.group_norm(input.float(), self.num_groups, self.weight. float() if sel...
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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Ethan07902050/s3prl
Fp32GroupNorm
false
2,282
[ "MIT" ]
0
854aff0b3062fc2cff531401923b8745f64701e7
https://github.com/Ethan07902050/s3prl/tree/854aff0b3062fc2cff531401923b8745f64701e7
BiTemperedLogisticLoss
import torch import torch.nn as nn def log_t(u, t): """Compute log_t for `u'.""" if t == 1.0: return u.log() else: return (u.pow(1.0 - t) - 1.0) / (1.0 - t) def exp_t(u, t): """Compute exp_t for `u'.""" if t == 1: return u.exp() else: return (1.0 + (1.0 - 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
GenoM87/cassava_leaf
BiTemperedLogisticLoss
false
2,283
[ "MIT" ]
0
51cc78b99a687b2d38be1930c40fc8aef3105b42
https://github.com/GenoM87/cassava_leaf/tree/51cc78b99a687b2d38be1930c40fc8aef3105b42
NextSentencePrediction
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain import torch.hub class NextSentencePrediction(nn.Module): """ 2-class classification model : is_next, is_not_next """ def __init__(self, hidden): """ ...
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....
EddieMG/LateTemporalModeling3DCNN
NextSentencePrediction
false
2,284
[ "MIT" ]
0
94c87dc1d31d09bc310d0e735a2e55453976cb0d
https://github.com/EddieMG/LateTemporalModeling3DCNN/tree/94c87dc1d31d09bc310d0e735a2e55453976cb0d
PositionwiseFeedForward
import math import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from itertools import chain as chain import torch.hub class GELU(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU """ 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.triton_helpers import libdevice import math import ...
EddieMG/LateTemporalModeling3DCNN
PositionwiseFeedForward
false
2,285
[ "MIT" ]
0
94c87dc1d31d09bc310d0e735a2e55453976cb0d
https://github.com/EddieMG/LateTemporalModeling3DCNN/tree/94c87dc1d31d09bc310d0e735a2e55453976cb0d
MaxPoolPad
import torch import torch.utils.data import torch.nn as nn from torch import optim as optim import torch.nn.parallel class MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=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 import torch.utils.data import torch.nn as nn from torch import optim as optim import tor...
Exir-lxr/crldr-prune-pytorch
MaxPoolPad
false
2,286
[ "Apache-2.0" ]
0
adeb5e0b24ce66ff9531d4d947f72412c1b5c033
https://github.com/Exir-lxr/crldr-prune-pytorch/tree/adeb5e0b24ce66ff9531d4d947f72412c1b5c033
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, size_average=True, ignore_index=-100, reduce=True): super(DiceLoss, self).__init__() self.size_average = size_average self.ignore_index = ignore_index self.reduce = reduce self.softMax = nn.So...
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 ...
GTreeSoftware/DB-Enhance
DiceLoss
false
2,287
[ "MIT" ]
0
98332c62297db7756f5385c038089bb8736a27c0
https://github.com/GTreeSoftware/DB-Enhance/tree/98332c62297db7756f5385c038089bb8736a27c0
ConvTransposeInstanceNorm2d
import torch import torch.nn as nn from typing import Tuple from typing import Union class ConvTransposeInstanceNorm2d(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size: 'Union[int, Tuple[int]]', stride: 'Union[int, Tuple[int]]'=1, padding: 'Union[int, Tuple[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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Geson-anko/ReimplementCycleGAN
ConvTransposeInstanceNorm2d
false
2,288
[ "MIT" ]
0
3bd40c519d53a7ebb284c718e935e3832326633f
https://github.com/Geson-anko/ReimplementCycleGAN/tree/3bd40c519d53a7ebb284c718e935e3832326633f
Quantizing
import torch import torch.nn as nn from typing import Tuple class Quantizing(nn.Module): """ This is quantizing layer. """ __initialized: 'bool' = True def __init__(self, num_quantizing: 'int', quantizing_dim: 'int', _weight: 'torch.Tensor'=None, initialize_by_dataset: 'bool'=True, ...
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...
Geson-anko/VQ_AutoEncoder
Quantizing
false
2,289
[ "MIT" ]
0
62e1694de38ea6f152891e19abc190ad4048e587
https://github.com/Geson-anko/VQ_AutoEncoder/tree/62e1694de38ea6f152891e19abc190ad4048e587
Sine
import torch from torch import nn class Sine(nn.Module): def __init__(self, w0=30): super().__init__() self.w0 = w0 def forward(self, input): return torch.sin(self.w0 * input) 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
Fred62879/ACORN
Sine
false
2,290
[ "MIT" ]
0
2de0bf747d595dbdc4d67311fb8f46cf47f9b4cb
https://github.com/Fred62879/ACORN/tree/2de0bf747d595dbdc4d67311fb8f46cf47f9b4cb
BasicConv
import torch import torch.nn as nn import torch.onnx import torch.nn.parallel class BasicConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=False, bias=False): super(BasicConv, self).__init__() self.out_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 ...
Ganzooo/soil_segmentation
BasicConv
false
2,291
[ "MIT" ]
0
56f410e3e184f24e52dd4b542ea309f0d203ca00
https://github.com/Ganzooo/soil_segmentation/tree/56f410e3e184f24e52dd4b542ea309f0d203ca00
Hardswish
import torch from torch.nn import functional as F import torch.nn as nn class Hardswish(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0 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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
GoalballAnalysis/GUI
Hardswish
false
2,292
[ "MIT" ]
0
c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
https://github.com/GoalballAnalysis/GUI/tree/c7f1cc27f4fd7f861c3ca09f5ca25d1a3f19a8a7
TransitionUp
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx import torch.nn.parallel class TransitionUp(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() def forward(self, x, skip, concat=True): out = F.interpolate(x, size=(skip.size(2), 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 import torch.nn as nn import torch.onnx import torch.nn.parallel assert_size_stride = tor...
Ganzooo/soil_segmentation
TransitionUp
false
2,293
[ "MIT" ]
0
56f410e3e184f24e52dd4b542ea309f0d203ca00
https://github.com/Ganzooo/soil_segmentation/tree/56f410e3e184f24e52dd4b542ea309f0d203ca00
AddLayer
import torch from torch import nn import torch.utils.checkpoint class AddLayer(nn.Module): def __init__(self, t1, t2): super(AddLayer, self).__init__() self.t1 = t1 self.t2 = t2 def forward(self, x, y): return x + y def get_inputs(): return [torch.rand([4, 4, 4, 4]), to...
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 import torch.utils.checkpoint assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
DeepPoolML/DeepPool
AddLayer
false
2,294
[ "MIT" ]
0
7f823f26747c9399524e74f2d81c99a2bb677f7c
https://github.com/DeepPoolML/DeepPool/tree/7f823f26747c9399524e74f2d81c99a2bb677f7c
MyModel
import torch import torch.nn as nn import torch.nn.functional as F class MyModel(nn.Module): def __init__(self, state_size, action_size): super(MyModel, self).__init__() self.fc1 = nn.Linear(state_size, 64) self.fc2 = nn.Linear(64, 64) self.fc3 = nn.Linear(64, action_size) de...
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_...
Ghazalmg/slimevolleygym
MyModel
false
2,295
[ "Apache-2.0" ]
0
d880a35625c22bbe0bc10fa0352495f0aea06364
https://github.com/Ghazalmg/slimevolleygym/tree/d880a35625c22bbe0bc10fa0352495f0aea06364