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
ConvLayer
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, norm ='instance'): super().__init__() padding_size = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(padding_size) self.conv_layer = ...
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...
Gradient-PG/live-nst
ConvLayer
false
17,320
[ "MIT" ]
5
02244172646375ff4a4a417bc8220064fadae5a9
https://github.com/Gradient-PG/live-nst/tree/02244172646375ff4a4a417bc8220064fadae5a9
Bottleneck
import torch import torch.nn as nn import torch.nn.functional as F class Bottleneck(nn.Module): def __init__(self, inplanes, planes, droprate=0.2, attention=None): super(Bottleneck, self).__init__() self.conv1 = nn.Conv2d(inplanes, inplanes, kernel_size=1, stride=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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Galaxies99/alpha-protein
Bottleneck
false
17,321
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa
DECModule
import torch from torch import nn from typing import Optional from torch.nn import Parameter class DECModule(nn.Module): def __init__(self, cluster_number: 'int', embedding_dimension: 'int', alpha: 'float'=1.0, cluster_centers: 'Optional[torch.Tensor]'=None ) ->None: """ Module 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 from typing import Optional from torch.nn import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_str...
Guanzhou-Ke/conan
DECModule
false
17,322
[ "MIT" ]
5
5eb0a051e3a2893a12fe690ac443471abbcd1ee3
https://github.com/Guanzhou-Ke/conan/tree/5eb0a051e3a2893a12fe690ac443471abbcd1ee3
SEModule
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class FastAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastAvgPool2d, self).__init__() self.flatten = flatten def forward(self, x): if self.flatten: ...
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 ...
GuillaumeAI/gia-labeling-ImageNet21K
SEModule
false
17,323
[ "MIT" ]
4
825ff49f1558f848fc8a798e2e393b708e75bb0e
https://github.com/GuillaumeAI/gia-labeling-ImageNet21K/tree/825ff49f1558f848fc8a798e2e393b708e75bb0e
FSM
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class FSM(nn.Module): def __init__(self, c1, c2): super().__init__() self.conv_atten = nn.Conv2d(c1, c1, 1, bias=False) self.conv = nn.Conv2d(c1, c2, 1, bias=False) def forward(self, x: 'T...
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...
Genevievekim/segformer
FSM
false
17,324
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
Downsample
import torch from torch import Tensor from torch import nn class Downsample(nn.Module): """Downsample transition stage""" def __init__(self, c1, c2): super().__init__() self.proj = nn.Conv2d(c1, c2, 3, 2, 1) def forward(self, x: 'Tensor') ->Tensor: x = x.permute(0, 3, 1, 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 torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Genevievekim/segformer
Downsample
false
17,325
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
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...
Genevievekim/segformer
MLP
false
17,326
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
Join
import torch import torch.random class Join(torch.nn.Module): """Join layer """ def forward(self, unary: 'torch.Tensor', binary: 'torch.Tensor', index1: 'torch.Tensor', index2: 'torch.Tensor'): """Join the unary and binary tensors. :param unary: [u, |U|] the tensor with unary pred...
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.random assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
HEmile/KENN-PyTorch
Join
false
17,327
[ "BSD-3-Clause" ]
5
e39386f298587ab70ecea88180121ef8cf6ff9bc
https://github.com/HEmile/KENN-PyTorch/tree/e39386f298587ab70ecea88180121ef8cf6ff9bc
VGG11
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class VGG11(nn.Module): def __init__(self, num_classes=10, out_ch_conv1=17, out_ch_conv2=27, out_ch_conv3=39, out_ch_conv4=35, out_ch_...
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 ...
FujitsuLaboratories/CAC
VGG11
false
17,328
[ "Apache-2.0" ]
8
d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
https://github.com/FujitsuLaboratories/CAC/tree/d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
Sin
import torch from torch import nn class Sin(nn.Module): """An element-wise sin activation wrapped as a nn.Module. Shape: - Input: `(N, *)` where `*` means, any number of additional dimensions - Output: `(N, *)`, same shape as the input Examples: >>> m = Sin() >>> input = torch.randn(...
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_...
HJReachability/safety_rl
Sin
false
17,329
[ "BSD-3-Clause" ]
5
00b441b41cea2a5062ffdc4ac30903b51364c2f9
https://github.com/HJReachability/safety_rl/tree/00b441b41cea2a5062ffdc4ac30903b51364c2f9
Standard
import torch from torch.nn.functional import softmax from torch.nn import Linear from torch.nn import Dropout import torch.random class Standard(torch.nn.Module): def __init__(self, in_features: 'int'): super().__init__() self.h1 = Linear(in_features, 50) self.d1 = Dropout() 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....
HEmile/KENN-PyTorch
Standard
false
17,330
[ "BSD-3-Clause" ]
5
e39386f298587ab70ecea88180121ef8cf6ff9bc
https://github.com/HEmile/KENN-PyTorch/tree/e39386f298587ab70ecea88180121ef8cf6ff9bc
ConcatCell
import torch import torch as th import torch.nn as nn class ConcatCell(nn.Module): def __init__(self, input_dim): super(ConcatCell, self).__init__() self.input_dim = input_dim def forward(self, x1, x2): return th.cat([x1, x2], dim=-1) def get_output_dim(self): return 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
HKUST-KnowComp/DisCOC
ConcatCell
false
17,331
[ "MIT" ]
4
d9e10d4938ef485254551fdb6c1a36eb31a26cfd
https://github.com/HKUST-KnowComp/DisCOC/tree/d9e10d4938ef485254551fdb6c1a36eb31a26cfd
ZeroPad1d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class ZeroPad1d(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left 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 import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler assert_size_str...
GT-SALT/FormalityStyleTransfer
ZeroPad1d
false
17,332
[ "MIT" ]
8
a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
https://github.com/GT-SALT/FormalityStyleTransfer/tree/a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
ResidualLayer
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, norm ='instance'): super().__init__() padding_size = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(padding_size) self.conv_layer = ...
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....
Gradient-PG/live-nst
ResidualLayer
false
17,333
[ "MIT" ]
5
02244172646375ff4a4a417bc8220064fadae5a9
https://github.com/Gradient-PG/live-nst/tree/02244172646375ff4a4a417bc8220064fadae5a9
GlobalNonLocal
import torch import torch.nn as nn import torch.nn.functional as F class GlobalNonLocal(nn.Module): def __init__(self, in_channel=64): super(GlobalNonLocal, self).__init__() assert in_channel % 2 == 0 self.hidden_channel = in_channel // 2 self.theta = nn.Conv2d(in_channel, self.hi...
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....
Galaxies99/alpha-protein
GlobalNonLocal
false
17,334
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa
Fp32GroupNorm
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32GroupNorm(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data import torch.onnx.operators impor...
GT-SALT/FormalityStyleTransfer
Fp32GroupNorm
false
17,335
[ "MIT" ]
8
a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
https://github.com/GT-SALT/FormalityStyleTransfer/tree/a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
DiceLoss
import torch from torch import nn class DiceLoss(nn.Module): def __init__(self, eps=1e-07): super(DiceLoss, self).__init__() self.eps = eps def forward(self, pred, target): pred = torch.sigmoid(pred) intersection = (pred * target).sum() loss = 1 - 2.0 * intersection /...
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...
ForrestPi/semanticSegmentation
DiceLoss
false
17,336
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
EncoderBlock
import torch from torch import nn import torch.nn.functional as F class MlpBlock(nn.Module): def __init__(self, in_dim, mlp_dim, out_dim, dropout_rate=0.1): super(MlpBlock, self).__init__() self.fc1 = nn.Linear(in_dim, mlp_dim) self.fc2 = nn.Linear(mlp_dim, out_dim) self.act = 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 from torch._inductor.runtime....
Graeme22/VisionTransformer-Pytorch
EncoderBlock
false
17,337
[ "Apache-2.0" ]
5
4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
https://github.com/Graeme22/VisionTransformer-Pytorch/tree/4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
TorchDense
import torch import numpy as np import torch.nn as nn class TorchDense(nn.Module): def __init__(self, state_shape, action_size: 'int'): super(TorchDense, self).__init__() input_size_flatten = self.num_flat_features(state_shape) self.flatten = nn.Flatten(start_dim=1, end_dim=-1) se...
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 numpy as np ...
Hadjubuntu/sweet-rl
TorchDense
false
17,338
[ "MIT" ]
3
f0dedadf8a7187e9b9b70436f05c637960fd72a7
https://github.com/Hadjubuntu/sweet-rl/tree/f0dedadf8a7187e9b9b70436f05c637960fd72a7
LayerNormConv2d
import torch from torchvision.transforms import * import torch.nn import torch import torch.nn as nn class LayerNormConv2d(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super().__init__() self.num_features = num_features self.affine = affine self.eps = eps ...
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 torchvision.transforms import * import torch.nn import torch import torch....
COMHTVM/lensless
LayerNormConv2d
false
17,339
[ "MIT" ]
6
0d67a310bab08551d7422fa792f3422a7ee7d9cb
https://github.com/COMHTVM/lensless/tree/0d67a310bab08551d7422fa792f3422a7ee7d9cb
GradientLoss
import torch from torch import nn class GradientLoss(nn.Module): """ L1 loss on the gradient of the picture """ def __init__(self): super(GradientLoss, self).__init__() def forward(self, a): gradient_a_x = torch.abs(a[:, :, :, :-1] - a[:, :, :, 1:]) gradient_a_y = torch.a...
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_...
GuYuanjie/Deep-Retinex-fusion
GradientLoss
false
17,340
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
BCEWithLogitsLossWithOHEM
import torch from torch import nn def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class BCEWithLogitsLossWithOHEM(nn.Module): def __init__(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 from torch ...
ForrestPi/semanticSegmentation
BCEWithLogitsLossWithOHEM
false
17,341
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
GrayscaleLoss
import torch from torch import nn class GrayscaleLayer(nn.Module): def __init__(self): super(GrayscaleLayer, self).__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) class GrayscaleLoss(nn.Module): def __init__(self): super(GrayscaleLoss, self).__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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GuYuanjie/Deep-Retinex-fusion
GrayscaleLoss
false
17,342
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
GenNoise
import torch from torch import nn class GenNoise(nn.Module): def __init__(self, dim2): super(GenNoise, self).__init__() self.dim2 = dim2 def forward(self, x): a = list(x.size()) a[1] = self.dim2 b = torch.zeros(a).type_as(x.data) b.normal_() x = 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GuYuanjie/Deep-Retinex-fusion
GenNoise
false
17,343
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
CrossEntropyLossWithOHEM
import torch from torch import nn def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class CrossEntropyLossWithOHEM(nn.Module): def __init__(self, o...
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 a...
ForrestPi/semanticSegmentation
CrossEntropyLossWithOHEM
false
17,344
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
SoftCrossEntropyLossWithOHEM
import torch from torch import nn import torch.nn.functional as F def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class SoftCrossEntropyLossWithOHEM(n...
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 a...
ForrestPi/semanticSegmentation
SoftCrossEntropyLossWithOHEM
false
17,345
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
GrayscaleLayer
import torch from torch import nn class GrayscaleLayer(nn.Module): def __init__(self): super(GrayscaleLayer, self).__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GuYuanjie/Deep-Retinex-fusion
GrayscaleLayer
false
17,346
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
MultiAttributeLoss
import torch import torch.nn.functional as F class MultiAttributeLoss(torch.nn.Module): def __init__(self): super(MultiAttributeLoss, self).__init__() def forward(self, input, target): product = 1 count = len(input) for i in range(count): attribute_loss = F.cross_...
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...
GregoryEHunter/generalization_to_OOD_category_viewpoint_combinations
MultiAttributeLoss
false
17,347
[ "MIT" ]
10
52aacbb3420639cae64ce65085c17b245e5ef865
https://github.com/GregoryEHunter/generalization_to_OOD_category_viewpoint_combinations/tree/52aacbb3420639cae64ce65085c17b245e5ef865
NonBlurryLoss
import torch from torch import nn class NonBlurryLoss(nn.Module): def __init__(self): """ Loss on the distance to 0.5 """ super(NonBlurryLoss, self).__init__() self.mse = nn.MSELoss() def forward(self, x): return 1 - self.mse(x, torch.ones_like(x) * 0.5) def...
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...
GuYuanjie/Deep-Retinex-fusion
NonBlurryLoss
false
17,348
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
GrayLoss
import torch from torch import nn class GrayLoss(nn.Module): def __init__(self): super(GrayLoss, self).__init__() self.l1 = nn.L1Loss() def forward(self, x): y = torch.ones_like(x) / 2.0 return 1 / self.l1(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
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 a...
GuYuanjie/Deep-Retinex-fusion
GrayLoss
false
17,349
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
FixedBlurLayer
import torch import numpy as np import torch.nn.functional as F from torch import nn class FixedBlurLayer(nn.Module): def __init__(self, kernel): super(FixedBlurLayer, self).__init__() self.kernel = kernel to_pad_x = int((self.kernel.shape[0] - 1) / 2) to_pad_y = int((self.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 from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
GuYuanjie/Deep-Retinex-fusion
FixedBlurLayer
false
17,350
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
NoiseNet
import torch import torch.nn.functional as F from torch import nn class NoiseNet(nn.Module): def __init__(self, channels=3, kernel_size=5): super(NoiseNet, self).__init__() self.kernel_size = kernel_size self.channels = channels to_pad = int((self.kernel_size - 1) / 2) sel...
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....
GuYuanjie/Deep-Retinex-fusion
NoiseNet
false
17,351
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
VarianceLayer
import torch import numpy as np import torch.nn.functional as F from torch import nn class VarianceLayer(nn.Module): def __init__(self, patch_size=5, channels=1): self.patch_size = patch_size super(VarianceLayer, self).__init__() mean_mask = np.ones((channels, channels, patch_size, patch_...
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 numpy as np from torch import nn assert_size_stride = torch._C._dynamo.gu...
GuYuanjie/Deep-Retinex-fusion
VarianceLayer
false
17,352
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
CovarianceLayer
import torch import numpy as np import torch.nn.functional as F from torch import nn class CovarianceLayer(nn.Module): def __init__(self, patch_size=5, channels=1): self.patch_size = patch_size super(CovarianceLayer, self).__init__() mean_mask = np.ones((channels, channels, patch_size, pa...
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 numpy as np from torch import nn assert_size_stride = torch._C._dynamo.gu...
GuYuanjie/Deep-Retinex-fusion
CovarianceLayer
false
17,353
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
PAM
import torch from typing import Union import torch.nn.functional as F from typing import Tuple from torch import nn from typing import Dict from typing import List def strip_param_name(param_name: 'str') ->str: """Input an module's param name, return it's origin name with out parent modules' name 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....
HAL-42/AlchemyCat
PAM
false
17,354
[ "Apache-2.0" ]
8
ca924755ff48e2ff74543bb0e446376eb2b1f150
https://github.com/HAL-42/AlchemyCat/tree/ca924755ff48e2ff74543bb0e446376eb2b1f150
UpsamplerModel
import torch import numpy as np from torch import nn class UpsamplerModel(nn.Module): def __init__(self, output_shape, factor): assert output_shape[0] % factor == 0 assert output_shape[1] % factor == 0 super(UpsamplerModel, self).__init__() self.output_shape = output_shape ...
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 from torch import nn assert_size_stride = torch._C._dynamo.guards.asse...
GuYuanjie/Deep-Retinex-fusion
UpsamplerModel
false
17,355
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
GeLU
import math import torch from torch import nn def gelu(x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class GeLU(nn.Module): def __init__(self): super().__init__() def forward(self, x): return gelu(x) 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.triton_helpers import libdevice import math from torch import nn assert_size_stride = torch._C._dynamo.guards.a...
HS-YN/PanoAVQA
GeLU
false
17,356
[ "MIT" ]
3
657b83421ce64ea18b3e79fb580afc7034403ccc
https://github.com/HS-YN/PanoAVQA/tree/657b83421ce64ea18b3e79fb580afc7034403ccc
NLKProjection
import torch from torch import nn import torch.nn.functional as F class TwoLayerNet(nn.Module): def __init__(self, dim, hidden_dim, output_dim): super(TwoLayerNet, self).__init__() self.layer1 = nn.Linear(dim, hidden_dim) self.layer2 = nn.Linear(hidden_dim, output_dim) nn.init.xav...
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 import t...
HKUST-KnowComp/EFO-1-QA-benchmark
NLKProjection
false
17,357
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
NLKDifferenceCenter
import torch from torch import nn import torch.nn.functional as F class NLKDifferenceCenter(nn.Module): def __init__(self, dim, hidden_dim): super(NLKDifferenceCenter, self).__init__() self.dim = dim self.hidden_dim = hidden_dim self.layer1 = nn.Linear(self.dim, self.hidden_dim) ...
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....
HKUST-KnowComp/EFO-1-QA-benchmark
NLKDifferenceCenter
false
17,358
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
StdLoss
import torch import numpy as np from torch import nn from torch.nn import functional class GrayscaleLayer(nn.Module): def __init__(self): super(GrayscaleLayer, self).__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) class StdLoss(nn.Module): def __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 import numpy as np from torch import nn assert_size_stride = torch._C._dynamo.gu...
GuYuanjie/Deep-Retinex-fusion
StdLoss
false
17,359
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
CenterIntersection
import torch from torch import nn import torch.nn.functional as F class CenterIntersection(nn.Module): def __init__(self, dim): super(CenterIntersection, self).__init__() self.dim = dim self.layer1 = nn.Linear(self.dim, self.dim) self.layer2 = nn.Linear(self.dim, self.dim) ...
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....
HKUST-KnowComp/EFO-1-QA-benchmark
CenterIntersection
false
17,360
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
SkipBlock
import torch import torch.nn as nn import torch.nn.functional as F class SkipBlock(nn.Module): def __init__(self, input_dim, output_dim, activation): """ Skip Connection for feed-forward block based on ResNet idea: Refer: - Youtube: https://www.youtube.com/watch?v=ZILIbUvp5lk ...
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 ...
HareeshBahuleyan/size-fit-net
SkipBlock
false
17,361
[ "MIT" ]
8
2c5e10799b529f94748ccefc080d2af22f3e93d4
https://github.com/HareeshBahuleyan/size-fit-net/tree/2c5e10799b529f94748ccefc080d2af22f3e93d4
Mean
import torch from typing import Optional from torch import nn class Mean(nn.Module): def __init__(self, dim: 'Optional[int]'=None, keepdim: 'bool'=False): super().__init__() self.dim = dim self.keepdim = keepdim def forward(self, input: 'torch.Tensor') ->torch.Tensor: 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 from typing import Optional from torch import nn assert_size_stride = torch._C._dynamo.gu...
HiroakiMikami/mlprogram
Mean
false
17,362
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
Highway
import torch from torch import nn class Highway(nn.Module): def __init__(self, input_size): super(Highway, self).__init__() self.fc1 = nn.Linear(input_size, input_size, bias=True) self.fc2 = nn.Linear(input_size, input_size, bias=True) self.sigmoid = nn.Sigmoid() self.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 import nn assert_s...
HephaestusProject/pytorch-CharLM
Highway
false
17,363
[ "MIT" ]
4
ebe8b9a04c4ba4dcf78d1f2673edb90731a5f3ad
https://github.com/HephaestusProject/pytorch-CharLM/tree/ebe8b9a04c4ba4dcf78d1f2673edb90731a5f3ad
NLKDifferenceOffset
import torch from torch import nn import torch.nn.functional as F class NLKDifferenceOffset(nn.Module): def __init__(self, dim, hidden_dim): super(NLKDifferenceOffset, self).__init__() self.dim = dim self.hidden_dim = hidden_dim self.layer1 = nn.Linear(self.dim, self.hidden_dim) ...
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....
HKUST-KnowComp/EFO-1-QA-benchmark
NLKDifferenceOffset
false
17,364
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
MockModule
import torch from torch import nn class MockModule(nn.Module): def __init__(self, k: 'int'): super().__init__() self.p = nn.Parameter(torch.tensor(k, dtype=torch.float)) def forward(self, x, y=None): assert len(x.shape) == 2 out = x + self.p if y is not 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
HiroakiMikami/mlprogram
MockModule
false
17,365
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
LogicProjection
import torch from torch import nn import torch.nn.functional as F class LogicProjection(nn.Module): def __init__(self, entity_dim, relation_dim, hidden_dim, num_layers, bounded): super(LogicProjection, self).__init__() self.entity_dim = entity_dim self.relation_dim = relation_dim ...
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...
HKUST-KnowComp/EFO-1-QA-benchmark
LogicProjection
false
17,366
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
ExponentialLoss
import torch from torch.nn.modules.loss import _Loss class ExponentialLoss(_Loss): def __init__(self): super(ExponentialLoss, self).__init__() self.mseCriterion = torch.nn.modules.MSELoss() def forward(self, img, ref): return self.mseCriterion(img, ref) + 0.005 * self.mseCriterion(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 from torch.nn.modules....
HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping
ExponentialLoss
false
17,367
[ "MIT" ]
4
1e2dee8d6d1f97722eba91618462537faf9efba7
https://github.com/HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping/tree/1e2dee8d6d1f97722eba91618462537faf9efba7
CNNLayerNorm
import torch import torch.nn as nn class CNNLayerNorm(nn.Module): """Layer normalization built for cnns input""" def __init__(self, n_feats): super(CNNLayerNorm, self).__init__() self.layer_norm = nn.LayerNorm(n_feats) def forward(self, x): x = x.transpose(2, 3).contiguous() ...
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_...
HikaruHotta/M2M-VC-CycleGAN
CNNLayerNorm
false
17,368
[ "MIT" ]
5
a93b06221c787cc3e13b2d92fee728b811e5d526
https://github.com/HikaruHotta/M2M-VC-CycleGAN/tree/a93b06221c787cc3e13b2d92fee728b811e5d526
BoxOffsetIntersection
import torch from torch import nn import torch.nn.functional as F class BoxOffsetIntersection(nn.Module): def __init__(self, dim): super(BoxOffsetIntersection, self).__init__() self.dim = dim self.layer1 = nn.Linear(self.dim, self.dim) self.layer2 = nn.Linear(self.dim, self.dim) ...
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...
HKUST-KnowComp/EFO-1-QA-benchmark
BoxOffsetIntersection
false
17,369
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
MLP
import torch from typing import Optional from torch import nn from collections import OrderedDict class MLP(nn.Module): def __init__(self, in_channel: 'int', out_channel: 'int', hidden_channel: 'int', n_linear: 'int', activation: 'Optional[nn.Module]'=None): super().__init__() ass...
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 typing import Optional f...
HiroakiMikami/mlprogram
MLP
false
17,370
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
weighted_mse
import torch from torch.nn.modules.loss import _Loss class weighted_mse(_Loss): def __init__(self): super(weighted_mse, self).__init__() def forward(self, input, output, weight): return torch.sum(weight * (input - output) ** 2) / input.numel() def get_inputs(): return [torch.rand([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 import triton_helpers from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.guards.asse...
HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping
weighted_mse
false
17,371
[ "MIT" ]
4
1e2dee8d6d1f97722eba91618462537faf9efba7
https://github.com/HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping/tree/1e2dee8d6d1f97722eba91618462537faf9efba7
ActLog
import torch import torch.nn as nn class ActLog(nn.Module): def __init__(self, eps=1e-06): super(ActLog, self).__init__() self.eps = eps def forward(self, x): return torch.log(torch.clamp(x, min=self.eps)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
High-East/BCI-ToolBox
ActLog
false
17,372
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
BetaIntersection
import torch from torch import nn import torch.nn.functional as F class BetaIntersection(nn.Module): def __init__(self, dim): super(BetaIntersection, self).__init__() self.dim = dim self.layer1 = nn.Linear(2 * self.dim, 2 * self.dim) self.layer2 = nn.Linear(2 * self.dim, self.dim)...
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....
HKUST-KnowComp/EFO-1-QA-benchmark
BetaIntersection
false
17,373
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
ActSquare
import torch import torch.nn as nn class ActSquare(nn.Module): def __init__(self): super(ActSquare, self).__init__() pass def forward(self, x): return torch.square(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...
High-East/BCI-ToolBox
ActSquare
false
17,374
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
Selection
import torch import torch.nn as nn class Selection(nn.Module): """ Selection neurons to sample from a latent representation for a decoder agent. An abstract representation :math:`l_i` is disturbed by a value :math:`r_i` sampled from a normal standard distribution which is scaled by the selection neur...
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 import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
HendrikPN/reinforced_scinet
Selection
false
17,375
[ "Apache-2.0" ]
4
b57c9d1d997cc56647db4faa0690364e7039a5ee
https://github.com/HendrikPN/reinforced_scinet/tree/b57c9d1d997cc56647db4faa0690364e7039a5ee
MaxPoolStride1
import torch import torch.nn as nn import torch.nn.functional as F class MaxPoolStride1(nn.Module): def __init__(self, kernel_size): super(MaxPoolStride1, self).__init__() self.kernel_size = kernel_size self.pad = kernel_size - 1 def forward(self, x): padded_x = F.pad(x, (0, ...
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...
HongBeenKim/pams-skku
MaxPoolStride1
false
17,376
[ "MIT" ]
8
0a12b132e4bf42570b000f60b9a1fc2c65382174
https://github.com/HongBeenKim/pams-skku/tree/0a12b132e4bf42570b000f60b9a1fc2c65382174
LogVarLayer
import torch import torch.nn as nn class LogVarLayer(nn.Module): """ The log variance layer: calculates the log variance of the data along given 'dim' (natural logarithm) """ def __init__(self, dim): super(LogVarLayer, self).__init__() self.dim = dim 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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
High-East/BCI-ToolBox
LogVarLayer
false
17,377
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
Conv2dWithConstraint
import torch import torch.nn as nn class Conv2dWithConstraint(nn.Conv2d): def __init__(self, *config, max_norm=1, **kwconfig): self.max_norm = max_norm super(Conv2dWithConstraint, self).__init__(*config, **kwconfig) def forward(self, x): self.weight.data = torch.renorm(self.weight.da...
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 ...
High-East/BCI-ToolBox
Conv2dWithConstraint
false
17,378
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
Gating
import torch from torch import nn class Gating(nn.Module): def __init__(self, in0_size: 'int', in1_size: 'int', query_size: 'int', hidden_size: 'int'): super(Gating, self).__init__() self.q = nn.Linear(in0_size, query_size, bias=False) self.w_k0 = nn.Linear(in0_size, query_size, b...
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....
HiroakiMikami/mlprogram
Gating
false
17,379
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
LinearWithConstraint
import torch import torch.nn as nn class LinearWithConstraint(nn.Linear): def __init__(self, *config, max_norm=1, **kwconfig): self.max_norm = max_norm super(LinearWithConstraint, self).__init__(*config, **kwconfig) def forward(self, x): self.weight.data = torch.renorm(self.weight.da...
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 ...
High-East/BCI-ToolBox
LinearWithConstraint
false
17,380
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
L2Norm
import torch import torch.nn as nn from random import * class L2Norm(nn.Module): def __init__(self, n_channels, scale=1.0): super(L2Norm, self).__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(self.n_channe...
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 random import * assert_size_stride = torch._C._dynam...
Hoclor/CoSADUV-Contextual-Saliency-for-Detecting-Anomalies-in-UAV-Video
L2Norm
false
17,381
[ "MIT" ]
4
674b72af15ba8833317b8daa9d1e614ea63151c1
https://github.com/Hoclor/CoSADUV-Contextual-Saliency-for-Detecting-Anomalies-in-UAV-Video/tree/674b72af15ba8833317b8daa9d1e614ea63151c1
MaxPool
import torch import torch.nn as nn class MaxPool(nn.Module): def __init__(self, kernel_size, stride): super(MaxPool, self).__init__() self.pool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride) def forward(self, x): x = self.pool(x) return x def get_inputs(): retur...
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...
Hiroaki-Ozaki/modelib-classification
MaxPool
false
17,382
[ "WTFPL" ]
10
11077704cc0bc9a42fc4b94da60b57d31ff0f65c
https://github.com/Hiroaki-Ozaki/modelib-classification/tree/11077704cc0bc9a42fc4b94da60b57d31ff0f65c
MeanVoxelFeatureExtractor
import torch import torch.nn as nn class VoxelFeatureExtractor(nn.Module): def __init__(self, **kwargs): super().__init__() def get_output_feature_dim(self): raise NotImplementedError def forward(self, **kwargs): raise NotImplementedError class MeanVoxelFeatureExtractor(VoxelF...
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...
Hub-Tian/CADNet
MeanVoxelFeatureExtractor
false
17,383
[ "Apache-2.0" ]
7
37d2be6121bb184d8ded92fa468cb6490a15caea
https://github.com/Hub-Tian/CADNet/tree/37d2be6121bb184d8ded92fa468cb6490a15caea
SAM
import torch import torch.nn as nn def conv(in_channels, out_channels, kernel_size, bias=False, stride=1): return nn.Conv2d(in_channels, out_channels, kernel_size, padding= kernel_size // 2, bias=bias, stride=stride) class SAM(nn.Module): def __init__(self, n_feat, kernel_size=3, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
HolyWu/vs-hinet
SAM
false
17,384
[ "MIT" ]
4
b1083ab169d082696d4bf40281922ee52c762714
https://github.com/HolyWu/vs-hinet/tree/b1083ab169d082696d4bf40281922ee52c762714
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): """Layer normalization class. Normalization is done on the last dimension Args: input_size: size of input sample Inputs: a Tensor with shape (batch, length, input_size) or (batch, input_size) Outputs: a Tensor wi...
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_...
Hritikbansal/RNNs_SVA_OOD
LayerNorm
false
17,385
[ "MIT" ]
4
a1c73955342d9d35c49da5fcb7b315e37b0f75d1
https://github.com/Hritikbansal/RNNs_SVA_OOD/tree/a1c73955342d9d35c49da5fcb7b315e37b0f75d1
ArcMarginProduct
import math import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel from torch.nn import Parameter class ArcMarginProduct(nn.Module): """Implement of large margin arc distance: : Args: in_features: size of each input sample out_features: 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 from torch._inductor.runtime....
HotaekHan/classification_uncertainty
ArcMarginProduct
false
17,386
[ "MIT" ]
5
f0f119b93a84f7b041baf4eddf835dd99013e6a3
https://github.com/HotaekHan/classification_uncertainty/tree/f0f119b93a84f7b041baf4eddf835dd99013e6a3
UNet
import torch from torch import nn from torch.nn import functional as F import torch.nn.parallel class down(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class to create a...
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 tor...
DA4EVENT/home
UNet
false
17,387
[ "MIT" ]
5
18cc93a795ce132e05b886aa34565a102915b1c6
https://github.com/DA4EVENT/home/tree/18cc93a795ce132e05b886aa34565a102915b1c6
CumMax
import torch import torch.nn as nn class CumMax(nn.Module): def __init__(self): super(CumMax, self).__init__() def forward(self, input): return torch.cumsum(nn.Softmax(dim=-1)(input), -1) 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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Hritikbansal/RNNs_SVA_OOD
CumMax
false
17,388
[ "MIT" ]
4
a1c73955342d9d35c49da5fcb7b315e37b0f75d1
https://github.com/Hritikbansal/RNNs_SVA_OOD/tree/a1c73955342d9d35c49da5fcb7b315e37b0f75d1
PositionWiseFeedForward
import torch from torchvision.transforms import functional as F import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.modules.module class PositionWiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.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 from torch._inductor.runtime....
ChCh1999/RTPB
PositionWiseFeedForward
false
17,389
[ "MIT" ]
8
1066a3bfe4fe1b41eff74fd152936880302a60a2
https://github.com/ChCh1999/RTPB/tree/1066a3bfe4fe1b41eff74fd152936880302a60a2
FastRCNNPredictor
import torch from torch import nn import torch.nn.functional as F import torch.utils.data from torchvision.transforms import functional as F class FastRCNNPredictor(nn.Module): """ Standard classification + bounding box regression layers for Fast R-CNN. Arguments: in_channels (int): number 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 import nn import torch.utils.data assert_size_stride = torch._C._dyna...
CancerDataScience/NuCLS
FastRCNNPredictor
false
17,390
[ "MIT" ]
7
c172b55b18d4ea78c3f51a8fd28ee6c2595c8360
https://github.com/CancerDataScience/NuCLS/tree/c172b55b18d4ea78c3f51a8fd28ee6c2595c8360
ImageDiscriminator
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class ImageDiscriminator(nn.Module): def __init__(self): super(ImageDiscriminator, self).__init__() self.conv1 = nn.Conv2d(in_channels=6, out_channels=64, kernel_size= 3, stride=2, padding=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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
HotaekHan/Synthetically_Supervised_Text_Recognition
ImageDiscriminator
false
17,391
[ "MIT" ]
8
a6bb7d3039b1280c6efe177b69d8b985d2e13285
https://github.com/HotaekHan/Synthetically_Supervised_Text_Recognition/tree/a6bb7d3039b1280c6efe177b69d8b985d2e13285
MAXATTN
import torch import torch.nn as nn class MAXATTN(nn.Module): def __init__(self, embed_dim, num_heads, dropout=0.0, bias=True, add_bias_kv=False, add_zero_attn=False, kdim=None, vdim=None): super(MAXATTN, self).__init__() self.attention_layer = nn.MultiheadAttention(embed_dim, num_heads) ...
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....
Hritikbansal/RNNs_SVA_OOD
MAXATTN
false
17,392
[ "MIT" ]
4
a1c73955342d9d35c49da5fcb7b315e37b0f75d1
https://github.com/Hritikbansal/RNNs_SVA_OOD/tree/a1c73955342d9d35c49da5fcb7b315e37b0f75d1
UIAttention
import torch import torch.nn as nn import torch.nn.functional as F class UIAttention(nn.Module): def __init__(self, latent_dim, att_size): super(UIAttention, self).__init__() self.dense = nn.Linear(in_features=latent_dim * 2, out_features= att_size) nn.init.xavier_normal_(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....
Hui-Li/MCRec_PyTorch
UIAttention
false
17,393
[ "MIT" ]
9
da4da77d2cade40c0a1961481c8e47ac396d12ee
https://github.com/Hui-Li/MCRec_PyTorch/tree/da4da77d2cade40c0a1961481c8e47ac396d12ee
GAT
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super(GraphAtten...
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....
HecatePhy/directed_graphsage
GAT
false
17,394
[ "MIT" ]
6
0e35f8971d44b8b3477fd7339225e1a69da4456a
https://github.com/HecatePhy/directed_graphsage/tree/0e35f8971d44b8b3477fd7339225e1a69da4456a
GridReduction1
import torch from torch.nn import functional as F import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, batch_norm= False, **kwargs): super(Conv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, **kwargs) ...
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_...
Hiroaki-Ozaki/modelib-classification
GridReduction1
false
17,395
[ "WTFPL" ]
10
11077704cc0bc9a42fc4b94da60b57d31ff0f65c
https://github.com/Hiroaki-Ozaki/modelib-classification/tree/11077704cc0bc9a42fc4b94da60b57d31ff0f65c
InceptionB
import torch from torch.nn import functional as F import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, batch_norm= False, **kwargs): super(Conv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, **kwargs) ...
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_...
Hiroaki-Ozaki/modelib-classification
InceptionB
false
17,396
[ "WTFPL" ]
10
11077704cc0bc9a42fc4b94da60b57d31ff0f65c
https://github.com/Hiroaki-Ozaki/modelib-classification/tree/11077704cc0bc9a42fc4b94da60b57d31ff0f65c
GroupGRUCell
import math import torch import torch.nn as nn class GroupLinearLayer(nn.Module): def __init__(self, din, dout, num_blocks): super(GroupLinearLayer, self).__init__() self.w = nn.Parameter(0.01 * torch.randn(num_blocks, din, dout)) def forward(self, x): x = x.permute(1, 0, 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 torch._inductor.runtime.triton_helpers import libdevice import math import ...
Hritikbansal/RNNs_SVA_OOD
GroupGRUCell
false
17,397
[ "MIT" ]
4
a1c73955342d9d35c49da5fcb7b315e37b0f75d1
https://github.com/Hritikbansal/RNNs_SVA_OOD/tree/a1c73955342d9d35c49da5fcb7b315e37b0f75d1
CNN
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self, action_dim=7): super(CNN, self).__init__() self.action_dim = action_dim self.conv1 = nn.Conv2d(3, 16, 5, padding=2) self.conv2 = nn.Conv2d(16, 32, 5, padding=2) 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 assert_...
HeegerGao/CRIL
CNN
false
17,398
[ "MIT" ]
9
c4095bca7cf5c8e376b0014447b1422c1b5b6cec
https://github.com/HeegerGao/CRIL/tree/c4095bca7cf5c8e376b0014447b1422c1b5b6cec
DecayModule
import math import torch import torch.nn as nn class DecayModule(nn.Module): def __init__(self, input_size, hidden_size, bias=True, num_chunks=1, activation='relu', nodiag=False): super(DecayModule, self).__init__() self.sigmoid = nn.Sigmoid() self.tanh = nn.Tanh() self.re...
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 math import torch.nn a...
Hritikbansal/RNNs_SVA_OOD
DecayModule
false
17,399
[ "MIT" ]
4
a1c73955342d9d35c49da5fcb7b315e37b0f75d1
https://github.com/Hritikbansal/RNNs_SVA_OOD/tree/a1c73955342d9d35c49da5fcb7b315e37b0f75d1
GridReduction2
import torch from torch.nn import functional as F import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, batch_norm= False, **kwargs): super(Conv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, **kwargs) ...
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_...
Hiroaki-Ozaki/modelib-classification
GridReduction2
false
17,400
[ "WTFPL" ]
10
11077704cc0bc9a42fc4b94da60b57d31ff0f65c
https://github.com/Hiroaki-Ozaki/modelib-classification/tree/11077704cc0bc9a42fc4b94da60b57d31ff0f65c
MetaPathAttention
import torch import torch.nn as nn import torch.nn.functional as F class MetaPathAttention(nn.Module): def __init__(self, att_size, latent_dim, metapath_type_num): super(MetaPathAttention, self).__init__() self.att_size = att_size self.latent_dim = latent_dim self.metapath_type_nu...
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....
Hui-Li/MCRec_PyTorch
MetaPathAttention
false
17,401
[ "MIT" ]
9
da4da77d2cade40c0a1961481c8e47ac396d12ee
https://github.com/Hui-Li/MCRec_PyTorch/tree/da4da77d2cade40c0a1961481c8e47ac396d12ee
DummyEmbedder
import torch import torch.nn as nn class DummyEmbedder(nn.Module): def __init__(self, embedding_dim): super().__init__() self.embedding_dim = embedding_dim self.day_embedding = nn.Linear(1, embedding_dim) self.week_embedding = nn.Linear(1, embedding_dim) self.month_embeddi...
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...
HumaticsLAB/GTM-Transformer
DummyEmbedder
false
17,402
[ "MIT" ]
7
94124d3246c7c22d8b952beeda53639a9ad170e3
https://github.com/HumaticsLAB/GTM-Transformer/tree/94124d3246c7c22d8b952beeda53639a9ad170e3
InceptionAux
import torch from torch.nn import functional as F import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, batch_norm= False, **kwargs): super(Conv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, **kwargs) ...
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_...
Hiroaki-Ozaki/modelib-classification
InceptionAux
false
17,403
[ "WTFPL" ]
10
11077704cc0bc9a42fc4b94da60b57d31ff0f65c
https://github.com/Hiroaki-Ozaki/modelib-classification/tree/11077704cc0bc9a42fc4b94da60b57d31ff0f65c
Gate
import torch import torch.nn as nn class Gate(nn.Module): def __init__(self, dhid, dfeature, init_range=0.1, init_dist='uniform', dropout=0.5): super(Gate, self).__init__() self.dhid = dhid self.dfeature = dfeature self.linear_z = nn.Linear(self.dhid + self.dfeature, 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 ...
Hunter-DDM/DeFT-naacl2021
Gate
false
17,404
[ "MIT" ]
6
c61aeb4f63a650a0a1b71fb1b0b245cb3925009b
https://github.com/Hunter-DDM/DeFT-naacl2021/tree/c61aeb4f63a650a0a1b71fb1b0b245cb3925009b
LayerNorm
import torch class LayerNorm(torch.nn.Module): def __init__(self, input_dim): super(LayerNorm, self).__init__() self.gamma = torch.nn.Parameter(torch.ones(input_dim)) self.beta = torch.nn.Parameter(torch.zeros(input_dim)) self.eps = 1e-06 def forward(self, x, mask): m...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
IBM/context-relevant-pruning-textrl
LayerNorm
false
17,405
[ "Apache-2.0" ]
8
c8630203af5df64c8e1e3c4624e4a158b40a5f27
https://github.com/IBM/context-relevant-pruning-textrl/tree/c8630203af5df64c8e1e3c4624e4a158b40a5f27
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, encoder_dim, decoder_dim, attention_dim): super(Attention, self).__init__() self.encoder_dim = encoder_dim self.encoder_att = nn.Linear(encoder_dim, attention_dim) self.decoder_att = nn.Linear(decode...
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....
HumaticsLAB/AttentionBasedMultiModalRNN
Attention
false
17,406
[ "MIT" ]
5
0c060a97cdddf1348938a5f2d456e83e5f8bf887
https://github.com/HumaticsLAB/AttentionBasedMultiModalRNN/tree/0c060a97cdddf1348938a5f2d456e83e5f8bf887
InceptionA
import torch from torch.nn import functional as F import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, batch_norm= False, **kwargs): super(Conv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, **kwargs) ...
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_...
Hiroaki-Ozaki/modelib-classification
InceptionA
false
17,407
[ "WTFPL" ]
10
11077704cc0bc9a42fc4b94da60b57d31ff0f65c
https://github.com/Hiroaki-Ozaki/modelib-classification/tree/11077704cc0bc9a42fc4b94da60b57d31ff0f65c
FeatLoss
import torch import torch.utils.data import torch.nn as nn from sklearn import * class FeatLoss(nn.Module): """ This criterion is a implemenation of Focal Loss, which is proposed in Focal Loss for Dense Object Detection. Loss(x, class) = - \\alpha (1-softmax(x)[class])^gamma \\log(sof...
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...
CityU-AIM-Group/SIGMA
FeatLoss
false
17,408
[ "MIT" ]
5
19f89777db8d42f750a9b87756d3326c7efd18f5
https://github.com/CityU-AIM-Group/SIGMA/tree/19f89777db8d42f750a9b87756d3326c7efd18f5
Network
import torch import torch.nn as nn import torch.nn.functional as F class Network(nn.Module): def __init__(self, input_dim): super(Network, self).__init__() self.first_layer = nn.Linear(input_dim, 6) self.out_layer = nn.Linear(6, 1) def forward(self, x): out = self.first_layer...
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_...
HyperScypion/KMS_Neural_Networks
Network
false
17,409
[ "MIT" ]
6
71d0e9c6ee02ea7978ac8ab1b899290743afac7d
https://github.com/HyperScypion/KMS_Neural_Networks/tree/71d0e9c6ee02ea7978ac8ab1b899290743afac7d
MetaPathEmbedding
import torch import torch.nn as nn import torch.nn.functional as F class MetaPathEmbedding(nn.Module): def __init__(self, path_num, hop_num, feature_size, latent_dim): super(MetaPathEmbedding, self).__init__() self.path_num = path_num self.hop_num = hop_num self.feature_size = 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 import triton_helpers import torch.nn as nn assert_...
Hui-Li/MCRec_PyTorch
MetaPathEmbedding
false
17,410
[ "MIT" ]
9
da4da77d2cade40c0a1961481c8e47ac396d12ee
https://github.com/Hui-Li/MCRec_PyTorch/tree/da4da77d2cade40c0a1961481c8e47ac396d12ee
layer_1_to_1
import torch import numpy as np import torch.nn as nn def contractions_1_to_1(inputs, dim, normalization='inf', normalization_val=1.0 ): sum_all = torch.sum(inputs, dim=2).unsqueeze(dim=2) op1 = inputs op2 = torch.cat([sum_all for d in range(dim)], dim=2) if normalization is not None: if 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 import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
HyTruongSon/InvariantGraphNetworks-PyTorch
layer_1_to_1
false
17,411
[ "Apache-2.0" ]
7
da9fdaa4f858d6fcae14b08a59d4b172a2aabaf8
https://github.com/HyTruongSon/InvariantGraphNetworks-PyTorch/tree/da9fdaa4f858d6fcae14b08a59d4b172a2aabaf8
Asym_ReLU_Block
import torch from torch import nn class Asym_ReLU_Block(nn.Module): def __init__(self): super(Asym_ReLU_Block, self).__init__() self.conv1 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size =(3, 1), stride=1, padding=(1, 0), bias=False) self.conv2 = nn.Conv2d(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 from torch import nn assert_s...
HwangToeMat/Asym_VDSR
Asym_ReLU_Block
false
17,412
[ "MIT" ]
4
598200f745434fc6e1bb46b6da7d6cf7b0fdaa50
https://github.com/HwangToeMat/Asym_VDSR/tree/598200f745434fc6e1bb46b6da7d6cf7b0fdaa50
layer_2_to_1
import torch import numpy as np import torch.nn as nn def contractions_2_to_1(inputs, dim, normalization='inf', normalization_val=1.0 ): diag_part = torch.diagonal(inputs, dim1=2, dim2=3) sum_diag_part = torch.sum(diag_part, dim=2).unsqueeze(dim=2) sum_of_rows = torch.sum(inputs, dim=3) sum_of_col...
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 numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
HyTruongSon/InvariantGraphNetworks-PyTorch
layer_2_to_1
false
17,413
[ "Apache-2.0" ]
7
da9fdaa4f858d6fcae14b08a59d4b172a2aabaf8
https://github.com/HyTruongSon/InvariantGraphNetworks-PyTorch/tree/da9fdaa4f858d6fcae14b08a59d4b172a2aabaf8
TransformerDecoderLayer
import torch import torch.nn as nn import torch.nn.functional as F class TransformerDecoderLayer(nn.Module): def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu'): super(TransformerDecoderLayer, self).__init__() self.multihead_attn = nn.MultiheadAttentio...
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....
HumaticsLAB/GTM-Transformer
TransformerDecoderLayer
false
17,414
[ "MIT" ]
7
94124d3246c7c22d8b952beeda53639a9ad170e3
https://github.com/HumaticsLAB/GTM-Transformer/tree/94124d3246c7c22d8b952beeda53639a9ad170e3
InceptionC
import torch from torch.nn import functional as F import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, batch_norm= False, **kwargs): super(Conv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, **kwargs) ...
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_...
Hiroaki-Ozaki/modelib-classification
InceptionC
false
17,415
[ "WTFPL" ]
10
11077704cc0bc9a42fc4b94da60b57d31ff0f65c
https://github.com/Hiroaki-Ozaki/modelib-classification/tree/11077704cc0bc9a42fc4b94da60b57d31ff0f65c
PositionalEncoding
import math import torch from torch import nn class PositionalEncoding(nn.Module): def __init__(self, dimension: 'int', dropout: 'float'=0.1): super().__init__() self.dropout = nn.Dropout(p=dropout) self.dimension = dimension def forward(self, x: 'torch.Tensor') ->torch.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
IMDxD/NonAttentiveTacotron
PositionalEncoding
false
17,416
[ "MIT" ]
4
a227fba1bdfa4c5ec63a0f0364313f3ac0fef1ba
https://github.com/IMDxD/NonAttentiveTacotron/tree/a227fba1bdfa4c5ec63a0f0364313f3ac0fef1ba
Conv_ReLU_Block
import torch from torch import nn class Conv_ReLU_Block(nn.Module): def __init__(self): super(Conv_ReLU_Block, self).__init__() self.conv = nn.Conv2d(in_channels=64, out_channels=64, kernel_size= 3, stride=1, padding=1, bias=False) self.relu = nn.ReLU(inplace=True) def fo...
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...
HwangToeMat/Asym_VDSR
Conv_ReLU_Block
false
17,417
[ "MIT" ]
4
598200f745434fc6e1bb46b6da7d6cf7b0fdaa50
https://github.com/HwangToeMat/Asym_VDSR/tree/598200f745434fc6e1bb46b6da7d6cf7b0fdaa50
AlexNet
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class AlexNet(nn.Module): def __init__(self, num_classes=10, out_ch_conv1=64, out_ch_conv2=256, out_ch_conv3=384, out_ch_conv4=256, 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 import triton_helpers import torch.nn as nn import ...
FujitsuLaboratories/CAC
AlexNet
false
17,418
[ "Apache-2.0" ]
8
d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
https://github.com/FujitsuLaboratories/CAC/tree/d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
nnConv2dSymQuant
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair class SymmetricQuantizeDequantize(torch.autograd.Function): @staticmethod def forward(ctx, input, precision, clamp_val): ctx.save_for_backward(input) """ Compute quantization st...
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.nn.functional as F from torch.nn.modules.util...
IBM/energy-efficient-resilience
nnConv2dSymQuant
false
17,419
[ "Apache-2.0" ]
4
13dfcac143df218abe20ed8d8752a0bd7e5a424b
https://github.com/IBM/energy-efficient-resilience/tree/13dfcac143df218abe20ed8d8752a0bd7e5a424b