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
HardSwish
import torch from torch import nn import torch.nn.functional as F def hard_swish(x: 'torch.Tensor', inplace: 'bool'=False) ->torch.Tensor: inner = F.relu6(x + 3.0).div_(6.0) return x.mul_(inner) if inplace else x.mul(inner) class HardSwish(nn.Module): """ HardSwish activiation layer. Applies th...
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 import torch.nn.functional as F assert_size_stride = torch._C._dynam...
SimonCqk/towhee
HardSwish
false
9,623
[ "Apache-2.0" ]
0
a187833b1411216106a80a71e6f2c6e68e1be330
https://github.com/SimonCqk/towhee/tree/a187833b1411216106a80a71e6f2c6e68e1be330
Conv2dSame
import math import torch from torch import nn from typing import List from typing import Union import torch.nn.functional as F from typing import Optional from typing import Tuple from torch.nn.common_types import _size_2_t def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int') ->int: """ Calculate asym...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn from typing import List from typing import Unio...
SimonCqk/towhee
Conv2dSame
false
9,624
[ "Apache-2.0" ]
0
a187833b1411216106a80a71e6f2c6e68e1be330
https://github.com/SimonCqk/towhee/tree/a187833b1411216106a80a71e6f2c6e68e1be330
KnowledgeDistillationLoss
import torch import torch.nn as nn class KnowledgeDistillationLoss(nn.Module): def __init__(self, reduction='mean', alpha=1.0): super().__init__() self.reduction = reduction self.alpha = alpha def forward(self, inputs, targets, mask=None): inputs = inputs.narrow(1, 0, 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 math as tl_math import torch.nn as nn ...
VitoPalmisano/MiB
KnowledgeDistillationLoss
false
9,625
[ "MIT" ]
0
4b3d81e593471f2fb57abd852114a389ead3905c
https://github.com/VitoPalmisano/MiB/tree/4b3d81e593471f2fb57abd852114a389ead3905c
TransformerLayer
import torch import torch.nn as nn class TransformerLayer(nn.Module): def __init__(self, c, num_heads): super().__init__() self.q = nn.Linear(c, c, bias=False) self.k = nn.Linear(c, c, bias=False) self.v = nn.Linear(c, c, bias=False) self.ma = nn.MultiheadAttention(embed_d...
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....
Lalihoo/yolov5-detect
TransformerLayer
false
9,626
[ "MIT" ]
0
265c3137ea3586d913541501a1562488fbe59e9e
https://github.com/Lalihoo/yolov5-detect/tree/265c3137ea3586d913541501a1562488fbe59e9e
GELU
import torch from torch import nn import torch.nn.functional as F class GELU(nn.Module): """ GELU activiation layer. Applies the Gaussian Error Linear Units function (w/ dummy inplace arg) Described in: https://arxiv.org/abs/1606.08415. Args: inplace(`Bool`): whether use inpl...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
SimonCqk/towhee
GELU
false
9,627
[ "Apache-2.0" ]
0
a187833b1411216106a80a71e6f2c6e68e1be330
https://github.com/SimonCqk/towhee/tree/a187833b1411216106a80a71e6f2c6e68e1be330
Classify
import torch import torch.nn as nn def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class Classify(nn.Module): def __init__(self, c1, c2, k=1, s=1, p=None, g=1): super().__init__() self.aap = nn.AdaptiveAvgPool2d(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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Lalihoo/yolov5-detect
Classify
false
9,628
[ "MIT" ]
0
265c3137ea3586d913541501a1562488fbe59e9e
https://github.com/Lalihoo/yolov5-detect/tree/265c3137ea3586d913541501a1562488fbe59e9e
ConvMlp
import torch from torch import nn class ConvMlp(nn.Module): """ MLP using 1x1 convs that keeps spatial dims """ def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.ReLU, norm_layer=None, drop=0.0): super().__init__() out_features = out_features or...
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...
SimonCqk/towhee
ConvMlp
false
9,629
[ "Apache-2.0" ]
0
a187833b1411216106a80a71e6f2c6e68e1be330
https://github.com/SimonCqk/towhee/tree/a187833b1411216106a80a71e6f2c6e68e1be330
CosineClassifier
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def cosine_fully_connected_layer(x_in, weight, scale=None, bias=None, normalize_x=True, normalize_w=True): assert x_in.dim() == 2 assert weight.dim() == 2 assert x_in.size(1) == weight.size(0) if normalize_x: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ZRJMoon/OMIT
CosineClassifier
false
9,630
[ "MIT" ]
0
bb063b4ac5d4fd60b28b17cb8d2119da92f936f4
https://github.com/ZRJMoon/OMIT/tree/bb063b4ac5d4fd60b28b17cb8d2119da92f936f4
ConvolModel
import torch import torch.nn as nn import torch.nn.functional as F class ConvolModel(nn.Module): def __init__(self): super(ConvolModel, self).__init__() self.conv1 = nn.Conv2d(1, 5, 2) self.conv2 = nn.Conv2d(5, 10, 2) self.conv3 = nn.Conv2d(10, 10, 2) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
VVKot/mlinseconds-die-hard
ConvolModel
false
9,631
[ "MIT" ]
0
dacbd448180bc992e0dab9e4b27bb594235d8c44
https://github.com/VVKot/mlinseconds-die-hard/tree/dacbd448180bc992e0dab9e4b27bb594235d8c44
GluMlp
import torch from torch import nn class GluMlp(nn.Module): """ MLP w/ GLU style gating See: https://arxiv.org/abs/1612.08083, https://arxiv.org/abs/2002.05202 """ def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.Sigmoid, drop=0.0): 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 torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
SimonCqk/towhee
GluMlp
false
9,632
[ "Apache-2.0" ]
0
a187833b1411216106a80a71e6f2c6e68e1be330
https://github.com/SimonCqk/towhee/tree/a187833b1411216106a80a71e6f2c6e68e1be330
NaiveGroupNorm
from torch.nn import Module import torch from torch.nn import Parameter from torch.nn import init import torch.nn.parallel import torch.utils.data class NaiveGroupNorm(Module): """NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch. It is a temporary solution to expo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module from torch.nn import Parameter from torch.nn import...
UrwLee/AdelaiDet
NaiveGroupNorm
false
9,633
[ "BSD-2-Clause" ]
0
4cd88a80355d21261e94400767f44701ebc4b402
https://github.com/UrwLee/AdelaiDet/tree/4cd88a80355d21261e94400767f44701ebc4b402
elu_modified
import torch import torch.nn as nn import torch.utils.data class elu_modified(nn.Module): def __init__(self, alpha=1.0, shift=5.0, epsilon=1e-07): super(elu_modified, self).__init__() self.alpha = alpha self.shift = shift self.epsilon = epsilon self.elu = nn.ELU(alpha=alph...
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 assert_size_stride = torch._C._dy...
aasensio/umal_pytorch
elu_modified
false
9,634
[ "MIT" ]
0
17bf1fee006c26dc277eb31f22aee022246c0367
https://github.com/aasensio/umal_pytorch/tree/17bf1fee006c26dc277eb31f22aee022246c0367
HuberLoss
import torch import torch.nn as nn class HuberLoss(nn.Module): def __init__(self, delta=1): super().__init__() self.delta = delta def forward(self, sr, hr): l1 = torch.abs(sr - hr) mask = l1 < self.delta sq_loss = 0.5 * l1 ** 2 abs_loss = self.delta * (l1 - 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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Vidit631/FLAVR
HuberLoss
false
9,635
[ "Apache-2.0" ]
0
c1cf558190761b244736786c44fe45ca114331f2
https://github.com/Vidit631/FLAVR/tree/c1cf558190761b244736786c44fe45ca114331f2
FocalLoss
import torch import torch.nn as nn class FocalLoss(nn.Module): def __init__(self, gamma=2, eps=1e-07): super(FocalLoss, self).__init__() self.gamma = gamma self.eps = eps self.ce = nn.CrossEntropyLoss() def forward(self, input, target): logp = self.ce(input, target) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
T-Visor/face.evoLVe
FocalLoss
false
9,636
[ "MIT" ]
0
73f41a63eec2d95928d4a5401977d4a913d97eba
https://github.com/T-Visor/face.evoLVe/tree/73f41a63eec2d95928d4a5401977d4a913d97eba
ReExp_Layer
import torch import torch.nn as nn class ReExp_Layer(nn.Module): """ Description: A modified exponential layer. Only the negative part of the exponential retains. The positive part is linear: y=x+1. """ def __init__(self): super().__init__() 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 assert_size_stride = torch._C._dynamo.guards.assert_size_...
Woodenonez/SimMotionPred_MDN_Pytorch
ReExp_Layer
false
9,637
[ "MIT" ]
0
7c1b3cf4f3cd2a63d28d0ca85b6aa20675b7f212
https://github.com/Woodenonez/SimMotionPred_MDN_Pytorch/tree/7c1b3cf4f3cd2a63d28d0ca85b6aa20675b7f212
MLPAutoencoder
import torch def choose_nonlinearity(name): nl = None if name == 'tanh': nl = torch.tanh elif name == 'relu': nl = torch.relu elif name == 'sigmoid': nl = torch.sigmoid elif name == 'softplus': nl = torch.nn.functional.softplus elif name == 'selu': nl = ...
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 assert_size_stride ...
UlyssesZh/selfsup_hnn
MLPAutoencoder
false
9,638
[ "MIT" ]
0
fedd261be81b38ec179cc71ea75d91964985a9e8
https://github.com/UlyssesZh/selfsup_hnn/tree/fedd261be81b38ec179cc71ea75d91964985a9e8
EntMaxSelectLayer
from torch.autograd import Function import torch import torch.nn as nn def _make_ix_like(input, dim=0): d = input.size(dim) rho = torch.arange(1, d + 1, device=input.device, dtype=input.dtype) view = [1] * input.dim() view[0] = -1 return rho.view(view).transpose(0, dim) def entmax15(input, 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....
YotamElor/ae-smote
EntMaxSelectLayer
false
9,639
[ "MIT" ]
0
730ccc414c3b832a72a48087e709d283e27e273b
https://github.com/YotamElor/ae-smote/tree/730ccc414c3b832a72a48087e709d283e27e273b
Affine
import torch import torch.nn as nn class Affine(nn.Module): def __init__(self, dim): super().__init__() self.alpha = nn.Parameter(torch.ones(dim)) self.beta = nn.Parameter(torch.zeros(dim)) def forward(self, x): return self.alpha * x + self.beta 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...
Uzair-Khattak/deit
Affine
false
9,640
[ "Apache-2.0" ]
0
896004fc84d4ad2c4c9aa792822df7426af5903d
https://github.com/Uzair-Khattak/deit/tree/896004fc84d4ad2c4c9aa792822df7426af5903d
Learned_Aggregation_Layer
import torch import torch.nn as nn class Learned_Aggregation_Layer(nn.Module): def __init__(self, dim, num_heads=1, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0): super().__init__() self.num_heads = num_heads head_dim = dim // num_heads self.scale = qk_scale...
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....
Uzair-Khattak/deit
Learned_Aggregation_Layer
false
9,641
[ "Apache-2.0" ]
0
896004fc84d4ad2c4c9aa792822df7426af5903d
https://github.com/Uzair-Khattak/deit/tree/896004fc84d4ad2c4c9aa792822df7426af5903d
AdversarialNetwork
import torch from torch import nn def init_weights(layer): """Init weights for layers w.r.t. the original paper.""" layer_name = layer.__class__.__name__ if layer_name.find('Conv') != -1: layer.weight.data.normal_(0.0, 0.02) elif layer_name.find('BatchNorm') != -1: layer.weight.data.no...
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...
adarshchbs/adda_sketch
AdversarialNetwork
false
9,642
[ "MIT" ]
0
25f7adf3563d8e1edb8c431fb93876bbed4d4e76
https://github.com/adarshchbs/adda_sketch/tree/25f7adf3563d8e1edb8c431fb93876bbed4d4e76
SC
import torch import torch.nn as nn class SC(nn.Module): def __init__(self): super(SC, self).__init__() kernel_size = 3 self.spatial = nn.Conv2d(2, 1, kernel_size, stride=1, padding=( kernel_size - 1) // 2) def forward(self, x): x_compress = torch.cat((torch.max(x,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Willamjie/CCWH
SC
false
9,643
[ "MIT" ]
0
5217d76f8d112a17b2e00775b812387ab71ce798
https://github.com/Willamjie/CCWH/tree/5217d76f8d112a17b2e00775b812387ab71ce798
CosineLoss
import torch import torch.nn.functional as F class CosineLoss(torch.nn.Module): def __init__(self): super(CosineLoss, self).__init__() self.metrics = lambda x, y: 1 - torch.mean(F.cosine_similarity(x, y, dim=-1)) def forward(self, x, label): return self.metrics(x, label) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.functional a...
ackness/eth-xgaze-estimator
CosineLoss
false
9,644
[ "MIT" ]
0
b617cda6505885942c81b7f2d41399b62985b9a7
https://github.com/ackness/eth-xgaze-estimator/tree/b617cda6505885942c81b7f2d41399b62985b9a7
GCN
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data class Conv2D(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', stride=1, dilation=1, groups=1): super(Conv2D, self).__init__() assert ty...
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.nn.functional as F import torch.nn.parallel im...
UrwLee/AdelaiDet
GCN
false
9,645
[ "BSD-2-Clause" ]
0
4cd88a80355d21261e94400767f44701ebc4b402
https://github.com/UrwLee/AdelaiDet/tree/4cd88a80355d21261e94400767f44701ebc4b402
DownsampleBlock
import torch from torch import nn class DownsampleBlock(nn.Module): def __init__(self, in_channels, out_channels): super(DownsampleBlock, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=2, stride=2) self.actv = nn.PReLU(out_channels) def forw...
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...
XaviGurrola/RDUNet
DownsampleBlock
false
9,646
[ "MIT" ]
0
549fc88c6faef1b310773944fc3988e22030d94d
https://github.com/XaviGurrola/RDUNet/tree/549fc88c6faef1b310773944fc3988e22030d94d
weighted_mae_windows
import torch import torch.nn as nn class weighted_mae_windows(nn.Module): def __init__(self, weights=(0.5, 1.2, 1.4, 1.6, 1.8, 2.0), thresholds=( 5.0, 15.0, 30.0, 40.0, 45.0)): super(weighted_mae_windows, self).__init__() assert len(thresholds) + 1 == len(weights) self.weights = w...
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 ...
YuchenGUOGYC/gan_for_radar_extrapolation
weighted_mae_windows
false
9,647
[ "MIT" ]
0
cc43e6a691a81355faf0cda53a6b5555e886d75c
https://github.com/YuchenGUOGYC/gan_for_radar_extrapolation/tree/cc43e6a691a81355faf0cda53a6b5555e886d75c
Block
import math import torch import torch.nn as nn def gelu(x): """ Original Implementation of the gelu activation function in Google Bert repo when initialy created. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(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 import triton_helpers from torch._inductor.runtime....
SpringWave1/AutoGAN
Block
false
9,648
[ "MIT" ]
0
209bd01b02f15847bd342d4019f87aef5440bda8
https://github.com/SpringWave1/AutoGAN/tree/209bd01b02f15847bd342d4019f87aef5440bda8
OutputBlock
import torch from torch import nn class OutputBlock(nn.Module): def __init__(self, in_channels, out_channels): super(OutputBlock, self).__init__() self.conv_1 = nn.Conv2d(in_channels, in_channels, 3, padding=1) self.conv_2 = nn.Conv2d(in_channels, out_channels, 3, padding=1) 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
XaviGurrola/RDUNet
OutputBlock
false
9,649
[ "MIT" ]
0
549fc88c6faef1b310773944fc3988e22030d94d
https://github.com/XaviGurrola/RDUNet/tree/549fc88c6faef1b310773944fc3988e22030d94d
MLP
import torch def choose_nonlinearity(name): nl = None if name == 'tanh': nl = torch.tanh elif name == 'relu': nl = torch.relu elif name == 'sigmoid': nl = torch.sigmoid elif name == 'softplus': nl = torch.nn.functional.softplus elif name == 'selu': nl = ...
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 assert_size_stride ...
UlyssesZh/selfsup_hnn
MLP
false
9,650
[ "MIT" ]
0
fedd261be81b38ec179cc71ea75d91964985a9e8
https://github.com/UlyssesZh/selfsup_hnn/tree/fedd261be81b38ec179cc71ea75d91964985a9e8
ChannelAttentionModule
import torch import torch.nn as nn class ChannelAttentionModule(nn.Module): def __init__(self): super().__init__() self.gamma = nn.Parameter(torch.zeros(1)) self.softmax = nn.Softmax(dim=-1) def forward(self, x): """ inputs : x : feature maps from feature ...
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....
YuSuen/ACCycleGAN
ChannelAttentionModule
false
9,651
[ "MIT" ]
0
e407f2e6e7148181109d6d49b5e1006ae26493e4
https://github.com/YuSuen/ACCycleGAN/tree/e407f2e6e7148181109d6d49b5e1006ae26493e4
ConditionTime
import torch from torch import nn as nn def condition_time(x, i=0, size=(12, 16), seq_len=15): """create one hot encoded time image-layers, i in [1, seq_len]""" assert i < seq_len times = torch.eye(seq_len, dtype=x.dtype, device=x.device)[i].unsqueeze(-1 ).unsqueeze(-1) ones = torch.ones(1, *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 import nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._emp...
ValterFallenius/metnet
ConditionTime
false
9,652
[ "MIT" ]
0
7cde48a7b5fc0b69a8ce9083f934949362620fd5
https://github.com/ValterFallenius/metnet/tree/7cde48a7b5fc0b69a8ce9083f934949362620fd5
Model
import torch import torch.nn as nn import torch.nn.functional as f class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.conv = nn.Conv2d(1, 16, 5) self.pool = nn.MaxPool2d(2, 2) self.fc = nn.Linear(2304, 10) def forward(self, x): x = self.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 import torch.nn as nn assert_...
aabobakr/adversarial-robustness-toolbox
Model
false
9,653
[ "MIT" ]
0
d62b2606132d6e6fd5946d6bdc8f1da940eb3282
https://github.com/aabobakr/adversarial-robustness-toolbox/tree/d62b2606132d6e6fd5946d6bdc8f1da940eb3282
ASPP
import torch from torch import nn import torch.nn.functional as F class ASPP(nn.Module): """ Atrous spatial pyramid pooling used in object detection and segmentation. """ def __init__(self, in_channel=512, depth=256): super().__init__() self.mean = nn.AdaptiveAvgPool2d((1, 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 import nn assert_s...
SimonCqk/towhee
ASPP
false
9,654
[ "Apache-2.0" ]
0
a187833b1411216106a80a71e6f2c6e68e1be330
https://github.com/SimonCqk/towhee/tree/a187833b1411216106a80a71e6f2c6e68e1be330
Normalize
import torch import torch.nn as nn import torch.optim import torch.nn.parallel class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) ...
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.optim import torch.nn.parallel assert_size_s...
abeSanchez/FeatureDecoupling
Normalize
false
9,655
[ "MIT" ]
0
2a5ace5d057714b0b8657c75f1cff41e779b0ba4
https://github.com/abeSanchez/FeatureDecoupling/tree/2a5ace5d057714b0b8657c75f1cff41e779b0ba4
Attention
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """Defining the attention layer to be used with Bi-LSTM""" def __init__(self, hidden_dim): """Constructor for the Attention class. Args: hidden_dim (int): The double of the hidden vector size of the...
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....
abhinavbh08/NNTI-WS2021-NLP-Project
Attention
false
9,656
[ "MIT" ]
0
946cfdcb0e0e64969d12423fa1b26dad3cb2d417
https://github.com/abhinavbh08/NNTI-WS2021-NLP-Project/tree/946cfdcb0e0e64969d12423fa1b26dad3cb2d417
MLP
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class MLP(nn.Module): """ This is just an MLP with 1 hidden layer """ def __init__(self, n_units, dropout=0.1): super(MLP, self).__init__() self.w_1 = nn.Linear(n_units, 2048) self.w_2 = nn.Line...
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 ...
adijo/ift6135-rnn
MLP
false
9,657
[ "Apache-2.0" ]
0
88ebcd621cea4042f5ada688f2452ce25d02b761
https://github.com/adijo/ift6135-rnn/tree/88ebcd621cea4042f5ada688f2452ce25d02b761
Word2Vec
import torch import torch.nn as nn import torch.nn.functional as F class Word2Vec(nn.Module): def __init__(self, vocabulary_size, embedding_size): super(Word2Vec, self).__init__() self.w1 = nn.Parameter(torch.randn(vocabulary_size, embedding_size, requires_grad=True)) self.w2 ...
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....
abhinavbh08/NNTI-WS2021-NLP-Project
Word2Vec
false
9,658
[ "MIT" ]
0
946cfdcb0e0e64969d12423fa1b26dad3cb2d417
https://github.com/abhinavbh08/NNTI-WS2021-NLP-Project/tree/946cfdcb0e0e64969d12423fa1b26dad3cb2d417
QNetwork
import torch import torch.nn.functional as F import torch.nn as nn class QNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, hidden_layer_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimensi...
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_...
ablou1/dqn-navigation
QNetwork
false
9,659
[ "MIT" ]
0
c89011220983061685ae4501d0207b8958eafc21
https://github.com/ablou1/dqn-navigation/tree/c89011220983061685ae4501d0207b8958eafc21
decoder3
import torch import torch.nn as nn class decoder3(nn.Module): def __init__(self): super(decoder3, self).__init__() self.reflecPad7 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv7 = nn.Conv2d(256, 128, 3, 1, 0) self.relu7 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingNea...
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....
SofiaValdiviesov/LinearStyleTransfer
decoder3
false
9,660
[ "BSD-2-Clause" ]
0
6837c6a9be16bb5981fa0744e5d23f61d08e6940
https://github.com/SofiaValdiviesov/LinearStyleTransfer/tree/6837c6a9be16bb5981fa0744e5d23f61d08e6940
LanguageModelCriterion
import torch import torch.nn as nn from torch.autograd import * class LanguageModelCriterion(nn.Module): def __init__(self): super(LanguageModelCriterion, self).__init__() def forward(self, input, target, mask): target = target[:, :input.size(1)] mask = mask[:, :input.size(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 import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Zhendong-Wang/arsm_image_captioning
LanguageModelCriterion
false
9,661
[ "MIT" ]
0
2282b76ab03b53952269d94d6c4b19ab98636ca5
https://github.com/Zhendong-Wang/arsm_image_captioning/tree/2282b76ab03b53952269d94d6c4b19ab98636ca5
GEGLU
import torch from torch import nn import torch.nn.functional as F class GEGLU(nn.Module): def forward(self, x): x, gates = x.chunk(2, dim=-1) return x * F.gelu(gates) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
adam-mehdi/TimeSformer-pytorch
GEGLU
false
9,662
[ "MIT" ]
0
4e6484dba2d3f9aeaaad09a3a310c0ea36b459e3
https://github.com/adam-mehdi/TimeSformer-pytorch/tree/4e6484dba2d3f9aeaaad09a3a310c0ea36b459e3
LogSoftmaxOutput
import torch import torch.nn as nn class Linear(nn.Linear): """ Apply linear projection to the last dimention of a tensor. """ def forward(self, x): size = x.size() return super().forward(x.contiguous().view(-1, size[-1])).view(* size[:-1], -1) class LogSoftmaxOutput(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....
aishwaryaprabhat/BRIDGE-Tabular-Semantic-Parsing
LogSoftmaxOutput
false
9,663
[ "BSD-3-Clause" ]
0
640858024df444006dfae106a28fdb58f36f687e
https://github.com/aishwaryaprabhat/BRIDGE-Tabular-Semantic-Parsing/tree/640858024df444006dfae106a28fdb58f36f687e
AdjustNormFunc
import torch import torch.nn as nn class AdjustNormFunc(nn.Module): """Creates a BatchNorm-like module using func : x = func(x) * scale + shift""" def __init__(self, nf, func=torch.tanh, name=None): super().__init__() self.func = func self.name = name self.nf = nf 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
akashpalrecha/tanhNorm
AdjustNormFunc
false
9,664
[ "Apache-2.0" ]
0
bff7ba81aa5c805c423a59a36339254c83a3c28a
https://github.com/akashpalrecha/tanhNorm/tree/bff7ba81aa5c805c423a59a36339254c83a3c28a
PointerSwitch
import torch import torch.nn as nn class Linear(nn.Linear): """ Apply linear projection to the last dimention of a tensor. """ def forward(self, x): size = x.size() return super().forward(x.contiguous().view(-1, size[-1])).view(* size[:-1], -1) class ConcatAndProject(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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
aishwaryaprabhat/BRIDGE-Tabular-Semantic-Parsing
PointerSwitch
false
9,665
[ "BSD-3-Clause" ]
0
640858024df444006dfae106a28fdb58f36f687e
https://github.com/aishwaryaprabhat/BRIDGE-Tabular-Semantic-Parsing/tree/640858024df444006dfae106a28fdb58f36f687e
DenoisingBlock
import torch from torch import nn class DenoisingBlock(nn.Module): def __init__(self, in_channels, inner_channels, out_channels): super(DenoisingBlock, self).__init__() self.conv_0 = nn.Conv2d(in_channels, inner_channels, 3, padding=1) self.conv_1 = nn.Conv2d(in_channels + inner_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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
XaviGurrola/RDUNet
DenoisingBlock
false
9,666
[ "MIT" ]
0
549fc88c6faef1b310773944fc3988e22030d94d
https://github.com/XaviGurrola/RDUNet/tree/549fc88c6faef1b310773944fc3988e22030d94d
ConvGRUCell
import torch from torch import nn as nn import torch.nn.functional as F def one_param(m): """First parameter in `m`""" return next(m.parameters()) class ConvGRUCell(nn.Module): def __init__(self, input_dim, hidden_dim, kernel_size=(3, 3), bias=True, activation=F.tanh, batchnorm=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.triton_helpers import libdevice from torch import n...
ValterFallenius/metnet
ConvGRUCell
false
9,667
[ "MIT" ]
0
7cde48a7b5fc0b69a8ce9083f934949362620fd5
https://github.com/ValterFallenius/metnet/tree/7cde48a7b5fc0b69a8ce9083f934949362620fd5
PerceptualLoss
import torch import torch.nn as nn import torch.nn.functional as F class PerceptualLoss(nn.Module): def __init__(self): super().__init__() self.tgt_gm = None def gram_matrix(self, x): a, b, c, d = x.shape features = x.view(a * b, c * d) G = torch.mm(features, features...
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_...
aadhithya/mobilenet-styletransfer
PerceptualLoss
false
9,668
[ "MIT" ]
0
58e2c29020864d82d92d52d01427618bc35773fd
https://github.com/aadhithya/mobilenet-styletransfer/tree/58e2c29020864d82d92d52d01427618bc35773fd
MeanEmbedding
import torch import torch.nn as nn import torch.utils.data import torch.multiprocessing import torch.nn.modules.loss from scipy.sparse import * class MeanEmbedding(nn.Module): """Mean embedding class. """ def __init__(self): super(MeanEmbedding, self).__init__() def forward(self, emb, len_):...
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.multiprocessing import torch.nn.modules.loss from scipy.sparse import * assert_si...
LucasAPayne/graph4nlp
MeanEmbedding
false
9,669
[ "Apache-2.0" ]
0
3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
https://github.com/LucasAPayne/graph4nlp/tree/3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
LayerScale_Block
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features 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 import triton_helpers from torch._inductor.runtime....
Uzair-Khattak/deit
LayerScale_Block
false
9,670
[ "Apache-2.0" ]
0
896004fc84d4ad2c4c9aa792822df7426af5903d
https://github.com/Uzair-Khattak/deit/tree/896004fc84d4ad2c4c9aa792822df7426af5903d
ChannelSqueezeAndSpatialExcitation
import torch import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed import torch.backends class ChannelSqueezeAndSpatialExcitation(nn.Module): """ The sSE (Channel Squeeze and Spatial Ex...
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 torch.nn.modules.loss import * from torch.nn.modules ...
YaLTeR/catalyst
ChannelSqueezeAndSpatialExcitation
false
9,671
[ "Apache-2.0" ]
0
4b875b50b3c63ac2dac1f19399af0c016dfb4e2f
https://github.com/YaLTeR/catalyst/tree/4b875b50b3c63ac2dac1f19399af0c016dfb4e2f
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, input_dim, n_classes): super(Net, self).__init__() self.n_classes = n_classes self.fc = nn.Linear(input_dim, 2048) def _forward2(self, x): x = self.fc(x) x = F....
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....
alexanderrichard/cvpr2016_python3
Net
false
9,672
[ "MIT" ]
0
cddd77420d1be25fe2bba3b069d2cb966c6e366a
https://github.com/alexanderrichard/cvpr2016_python3/tree/cddd77420d1be25fe2bba3b069d2cb966c6e366a
Attention
import math import torch from torch import nn from torch.nn import functional as F class Attention(nn.Module): def __init__(self, hidden_size): super(Attention, self).__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) self.v = nn.Par...
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....
alexarnimueller/smiles-transformer
Attention
false
9,673
[ "MIT" ]
0
4584a0bd043d6659a941589677951b2c6823cd2a
https://github.com/alexarnimueller/smiles-transformer/tree/4584a0bd043d6659a941589677951b2c6823cd2a
Layer_scale_init_Block_only_token
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features 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 import triton_helpers from torch._inductor.runtime....
Uzair-Khattak/deit
Layer_scale_init_Block_only_token
false
9,674
[ "Apache-2.0" ]
0
896004fc84d4ad2c4c9aa792822df7426af5903d
https://github.com/Uzair-Khattak/deit/tree/896004fc84d4ad2c4c9aa792822df7426af5903d
CNN
import torch from torch import nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(3, 32, 3) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(32, 64, 3) self.conv3 = nn.Conv2d(64, 64, 3) ...
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...
ZJU-DistributedAI/RDFL-GAN
CNN
false
9,675
[ "Apache-2.0" ]
0
e5f10b071d25db7931749515b1b8a3c477a91257
https://github.com/ZJU-DistributedAI/RDFL-GAN/tree/e5f10b071d25db7931749515b1b8a3c477a91257
TensorCumsum
import torch class TensorCumsum(torch.nn.Module): def __init__(self, dim=1): super().__init__() self.dim = dim def forward(self, input): return torch.cumsum(input, dim=self.dim) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Minyus/kedex
TensorCumsum
false
9,676
[ "Apache-2.0" ]
0
92f952eed3cb6109bc783f449051f2bd13579d2a
https://github.com/Minyus/kedex/tree/92f952eed3cb6109bc783f449051f2bd13579d2a
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
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....
adriaciurana/udacity-project-3
Actor
false
9,677
[ "MIT" ]
0
806f78e35a6699eeb0a3272e326d0edc199d16be
https://github.com/adriaciurana/udacity-project-3/tree/806f78e35a6699eeb0a3272e326d0edc199d16be
encoder3
import torch import torch.nn as nn class encoder3(nn.Module): def __init__(self): super(encoder3, self).__init__() self.conv1 = nn.Conv2d(3, 3, 1, 1, 0) self.reflecPad1 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv2 = nn.Conv2d(3, 64, 3, 1, 0) self.relu2 = nn.ReLU(inplace=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._inductor.runtime import triton_helpers from torch._inductor.runtime....
SofiaValdiviesov/LinearStyleTransfer
encoder3
false
9,678
[ "BSD-2-Clause" ]
0
6837c6a9be16bb5981fa0744e5d23f61d08e6940
https://github.com/SofiaValdiviesov/LinearStyleTransfer/tree/6837c6a9be16bb5981fa0744e5d23f61d08e6940
Critic
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, ...
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 numpy as np import tor...
adriaciurana/udacity-project-3
Critic
false
9,679
[ "MIT" ]
0
806f78e35a6699eeb0a3272e326d0edc199d16be
https://github.com/adriaciurana/udacity-project-3/tree/806f78e35a6699eeb0a3272e326d0edc199d16be
LocalDiscriminator
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class LocalDiscriminator(nn.Module): """The local discriminator class. A network that analyses the relation between the output of the encoder y, and the feature map M. It is called "local" because it compares y with...
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 ...
ValerioB88/self-supervised-relational-reasoning
LocalDiscriminator
false
9,680
[ "MIT" ]
0
12692b93d5c8dd3f56a31aa8b790366556e7a621
https://github.com/ValerioB88/self-supervised-relational-reasoning/tree/12692b93d5c8dd3f56a31aa8b790366556e7a621
CNN
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(3, 16, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(16, 32, 5) self.gap = nn.AdaptiveAvgPool2d(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_...
ai-antena/cifar10
CNN
false
9,681
[ "MIT" ]
0
a3c72693cffae4a5150f1ca5f19472098163ed1a
https://github.com/ai-antena/cifar10/tree/a3c72693cffae4a5150f1ca5f19472098163ed1a
TensorLog
import torch class TensorLog(torch.nn.Module): def forward(self, input): return torch.log(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
Minyus/kedex
TensorLog
false
9,682
[ "Apache-2.0" ]
0
92f952eed3cb6109bc783f449051f2bd13579d2a
https://github.com/Minyus/kedex/tree/92f952eed3cb6109bc783f449051f2bd13579d2a
TensorExp
import torch class TensorExp(torch.nn.Module): def forward(self, input): return torch.exp(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
Minyus/kedex
TensorExp
false
9,683
[ "Apache-2.0" ]
0
92f952eed3cb6109bc783f449051f2bd13579d2a
https://github.com/Minyus/kedex/tree/92f952eed3cb6109bc783f449051f2bd13579d2a
TensorNearestPad
import torch class TensorNearestPad(torch.nn.Module): def __init__(self, lower=1, upper=1): super().__init__() assert isinstance(lower, int) and lower >= 0 assert isinstance(upper, int) and upper >= 0 self.lower = lower self.upper = upper 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Minyus/kedex
TensorNearestPad
false
9,684
[ "Apache-2.0" ]
0
92f952eed3cb6109bc783f449051f2bd13579d2a
https://github.com/Minyus/kedex/tree/92f952eed3cb6109bc783f449051f2bd13579d2a
CenterNessNet
import math import torch import torch.nn as nn from torch.nn.modules.utils import _pair class BasicBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0): super(BasicBlock, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, 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 import triton_helpers from torch._inductor.runtime....
ZCDu/CenternessNet
CenterNessNet
false
9,685
[ "MIT" ]
0
03f5d01999a4e1595eaceef9f62b4450ed017843
https://github.com/ZCDu/CenternessNet/tree/03f5d01999a4e1595eaceef9f62b4450ed017843
PriorDiscriminator
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class PriorDiscriminator(nn.Module): """The prior discriminator class. This discriminate between a vector drawn from random uniform, and the vector y obtained as output of the encoder. It enforces y to be close to 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 import torch.nn as nn import ...
ValerioB88/self-supervised-relational-reasoning
PriorDiscriminator
false
9,686
[ "MIT" ]
0
12692b93d5c8dd3f56a31aa8b790366556e7a621
https://github.com/ValerioB88/self-supervised-relational-reasoning/tree/12692b93d5c8dd3f56a31aa8b790366556e7a621
TensorMin
import torch def tensor_min(input, dim, keepdim=False): if isinstance(dim, int): return torch.min(input, dim=dim, keepdim=keepdim)[0] else: if isinstance(dim, tuple): dim = list(dim) for d in dim: input = torch.min(input, dim=d, keepdim=keepdim)[0] 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Minyus/kedex
TensorMin
false
9,687
[ "Apache-2.0" ]
0
92f952eed3cb6109bc783f449051f2bd13579d2a
https://github.com/Minyus/kedex/tree/92f952eed3cb6109bc783f449051f2bd13579d2a
TensorRange
import torch def tensor_max(input, dim, keepdim=False): if isinstance(dim, int): return torch.max(input, dim=dim, keepdim=keepdim)[0] else: if isinstance(dim, tuple): dim = list(dim) for d in dim: input = torch.max(input, dim=d, keepdim=keepdim)[0] 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Minyus/kedex
TensorRange
false
9,688
[ "Apache-2.0" ]
0
92f952eed3cb6109bc783f449051f2bd13579d2a
https://github.com/Minyus/kedex/tree/92f952eed3cb6109bc783f449051f2bd13579d2a
GraphConvolution
from torch.nn import Module import torch from torch.nn import functional as F from torch.nn import Parameter import torch.utils.data import torch.multiprocessing from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn.modules.loss from scipy.sparse import * def dropout(x, d...
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.nn import Module f...
LucasAPayne/graph4nlp
GraphConvolution
false
9,689
[ "Apache-2.0" ]
0
3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
https://github.com/LucasAPayne/graph4nlp/tree/3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
GlobalDiscriminator
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class GlobalDiscriminator(nn.Module): def __init__(self, y_size, M_channels): super().__init__() self.c0 = nn.Conv2d(M_channels, 64, kernel_size=3) self.c1 = nn.Conv2d(64, 32, kernel_size=3) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ValerioB88/self-supervised-relational-reasoning
GlobalDiscriminator
false
9,690
[ "MIT" ]
0
12692b93d5c8dd3f56a31aa8b790366556e7a621
https://github.com/ValerioB88/self-supervised-relational-reasoning/tree/12692b93d5c8dd3f56a31aa8b790366556e7a621
AdaptiveAvgPool3dOutSize1
import torch import torch.nn as nn from abc import abstractmethod from typing import Tuple import torch.utils.data import torch.nn class EfficientBlockBase(nn.Module): """ PyTorchVideo/accelerator provides a set of efficient blocks that have optimal efficiency for each target hardware device. Each ef...
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 abc import abstractmethod from typing import Tuple import torch.utils.data import torch.nn assert_size_stride = t...
TheShadow29/pytorchvideo
AdaptiveAvgPool3dOutSize1
false
9,691
[ "Apache-2.0" ]
0
39a3e34e33fb0e1ec142288df08f6e8c3585961a
https://github.com/TheShadow29/pytorchvideo/tree/39a3e34e33fb0e1ec142288df08f6e8c3585961a
TensorMax
import torch def tensor_max(input, dim, keepdim=False): if isinstance(dim, int): return torch.max(input, dim=dim, keepdim=keepdim)[0] else: if isinstance(dim, tuple): dim = list(dim) for d in dim: input = torch.max(input, dim=d, keepdim=keepdim)[0] 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Minyus/kedex
TensorMax
false
9,692
[ "Apache-2.0" ]
0
92f952eed3cb6109bc783f449051f2bd13579d2a
https://github.com/Minyus/kedex/tree/92f952eed3cb6109bc783f449051f2bd13579d2a
Affine2D
import torch import torch.nn as nn class Affine2D(nn.Module): def __init__(self, cin): """ :param cin: """ super(Affine2D, self).__init__() self.weight = nn.Parameter(torch.ones(1, cin, 1, 1)) self.bias = nn.Parameter(torch.zeros(1, cin, 1, 1)) def forward(se...
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...
alexandre-giuly/Project-Acoustic-Scene-Classification-DCASE
Affine2D
false
9,693
[ "Apache-2.0" ]
0
13b565c20e59f204151d2dafbd221c7e1b9303c5
https://github.com/alexandre-giuly/Project-Acoustic-Scene-Classification-DCASE/tree/13b565c20e59f204151d2dafbd221c7e1b9303c5
ActorNetwork
import torch import torch.nn.functional as F import torch.nn as nn class ActorNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(ActorNetwork, self).__init__() torch.manual_seed(seed) hidden1 = 64 hidden2 = 64 self.fc1 = nn.Linear(state_size, hidd...
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....
aishikawa/drl-impl
ActorNetwork
false
9,694
[ "MIT" ]
0
1afe7426494cd94990cb4dae247486a25dfe37bf
https://github.com/aishikawa/drl-impl/tree/1afe7426494cd94990cb4dae247486a25dfe37bf
GRUStep
import torch import torch.nn as nn import torch.utils.data import torch.multiprocessing import torch.nn.modules.loss from scipy.sparse import * class GRUStep(nn.Module): def __init__(self, hidden_size, input_size): super(GRUStep, self).__init__() """GRU module""" self.linear_z = nn.Linear...
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 ...
LucasAPayne/graph4nlp
GRUStep
false
9,695
[ "Apache-2.0" ]
0
3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
https://github.com/LucasAPayne/graph4nlp/tree/3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
Network
import torch import torch.nn as nn import torch.nn.functional as F class Network(nn.Module): def __init__(self): nn.Module.__init__(self) self.l1 = nn.Linear(4, 24) self.l5 = nn.Linear(24, 2) def forward(self, x): x = F.relu(self.l1(x)) x = self.l5(x) return x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
alexljenkins/reinforcement-learning-agents
Network
false
9,696
[ "MIT" ]
0
d5bdfad56c9b095d5bb0ac22ca69e19553327416
https://github.com/alexljenkins/reinforcement-learning-agents/tree/d5bdfad56c9b095d5bb0ac22ca69e19553327416
MaskedTemporalPooling
import torch from typing import Optional import torch.utils.data import torch.nn class MaskedTemporalPooling(torch.nn.Module): """ Applies temporal pooling operations on masked inputs. For each pooling operation all masked values are ignored. """ def __init__(self, method: 'str'): """ ...
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 assert_size_stride = torch._C._dynamo.guards.asse...
TheShadow29/pytorchvideo
MaskedTemporalPooling
false
9,697
[ "Apache-2.0" ]
0
39a3e34e33fb0e1ec142288df08f6e8c3585961a
https://github.com/TheShadow29/pytorchvideo/tree/39a3e34e33fb0e1ec142288df08f6e8c3585961a
InnerProductDecoder
import torch from torch.nn import functional as F import torch.nn as nn import torch.utils.data import torch.multiprocessing import torch.nn.modules.loss from scipy.sparse import * def dropout(x, drop_prob, shared_axes=[], training=False): """ Apply dropout to input tensor. Parameters ---------- i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.multiprocessing impor...
LucasAPayne/graph4nlp
InnerProductDecoder
false
9,698
[ "Apache-2.0" ]
0
3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
https://github.com/LucasAPayne/graph4nlp/tree/3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
LearnMaskedDefault
import torch import torch.nn as nn import torch.utils.data import torch.nn class LearnMaskedDefault(nn.Module): """ Learns default values to fill invalid entries within input tensors. The invalid entries are represented by a mask which is passed into forward alongside the input tensor. Note the defaul...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch.nn assert_size_stride = torch....
TheShadow29/pytorchvideo
LearnMaskedDefault
false
9,699
[ "Apache-2.0" ]
0
39a3e34e33fb0e1ec142288df08f6e8c3585961a
https://github.com/TheShadow29/pytorchvideo/tree/39a3e34e33fb0e1ec142288df08f6e8c3585961a
ConvGLU
import torch import torch.cuda from torch import nn import torch.distributed import torch.utils.data import torch.optim def str2act(txt): """Translates text to neural network activation""" return {'sigmoid': nn.Sigmoid(), 'relu': nn.ReLU(), 'none': nn. Sequential(), 'lrelu': nn.LeakyReLU(0.2), 'selu':...
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.cuda from torch import nn import torch.distributed import torch.uti...
Oreoluwa1234/NeMo
ConvGLU
false
9,700
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
TransposeMultiheadAttention
import torch import torch.nn as nn from typing import Optional import torch.utils.data import torch.nn class TransposeMultiheadAttention(nn.Module): """ Wrapper for nn.MultiheadAttention which first transposes the input tensor from (batch_size, seq_len, feature_dim) to (seq_length, batch_size, feature_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....
TheShadow29/pytorchvideo
TransposeMultiheadAttention
false
9,701
[ "Apache-2.0" ]
0
39a3e34e33fb0e1ec142288df08f6e8c3585961a
https://github.com/TheShadow29/pytorchvideo/tree/39a3e34e33fb0e1ec142288df08f6e8c3585961a
LayerNorm
import torch import torch.cuda from torch import nn import torch.distributed from torch.nn import LayerNorm import torch.utils.data import torch.optim class LayerNorm(nn.Module): def __init__(self, channels, eps=0.0001): super().__init__() self.channels = channels self.eps = eps 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.triton_helpers import libdevice import torch.cuda from torch import nn import torch.distributed import torch.ut...
Oreoluwa1234/NeMo
LayerNorm
false
9,702
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
JustConvBody
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class JustConvBody(nn.Module): def __init__(self, in_channels=4): ...
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_...
Louis-Bagot/DeepRL
JustConvBody
false
9,703
[ "MIT" ]
0
0b152c52bbba90362c8276c223fee3f9a464eb32
https://github.com/Louis-Bagot/DeepRL/tree/0b152c52bbba90362c8276c223fee3f9a464eb32
Context2AnswerAttention
import torch import torch.nn as nn import torch.utils.data import torch.multiprocessing import torch.nn.modules.loss from scipy.sparse import * class Context2AnswerAttention(nn.Module): def __init__(self, dim, hidden_size): super(Context2AnswerAttention, self).__init__() self.linear_sim = nn.Line...
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....
LucasAPayne/graph4nlp
Context2AnswerAttention
false
9,704
[ "Apache-2.0" ]
0
3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
https://github.com/LucasAPayne/graph4nlp/tree/3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421
MaskedInstanceNorm1d
import torch import torch.cuda from torch import nn import torch.distributed import torch.utils.data import torch.optim class MaskedInstanceNorm1d(nn.Module): """Instance norm + masking.""" MAX_CNT = 100000.0 def __init__(self, d_channel: 'int', unbiased: 'bool'=True, affine: 'bool'=False): ...
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.cuda from torch...
Oreoluwa1234/NeMo
MaskedInstanceNorm1d
false
9,705
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
TorchModule
import torch import torch.nn class TorchLinearModule(torch.nn.Module): def __init__(self, in_size, out_size): super(TorchLinearModule, self).__init__() self._linear = torch.nn.Linear(in_size, out_size) def forward(self, x): return self._linear(x) class TorchModule(torch.nn.Module):...
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 ass...
amit828as/ivy
TorchModule
false
9,706
[ "Apache-2.0" ]
0
fd12e513c58e337cc3775e456ad26a942a501c65
https://github.com/amit828as/ivy/tree/fd12e513c58e337cc3775e456ad26a942a501c65
ConvReLUNorm
import torch import torch.cuda import torch.distributed import torch.utils.data import torch.optim class ConvReLUNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0): super(ConvReLUNorm, self).__init__() self.conv = torch.nn.Conv1d(in_channels, out_chan...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Oreoluwa1234/NeMo
ConvReLUNorm
false
9,707
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
LeakyReLU
import torch class Activation(torch.nn.Module): def __init__(self) ->None: super().__init__() def forward(self, inputs: 'torch.Tensor') ->torch.Tensor: raise NotImplementedError class LeakyReLU(Activation): def forward(self, inputs: 'torch.Tensor') ->torch.Tensor: return 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
altescy/xtorch
LeakyReLU
false
9,708
[ "MIT" ]
0
bcbbbe645f4d62c211af5b3555c526cc60792c32
https://github.com/altescy/xtorch/tree/bcbbbe645f4d62c211af5b3555c526cc60792c32
ELU
import torch class Activation(torch.nn.Module): def __init__(self) ->None: super().__init__() def forward(self, inputs: 'torch.Tensor') ->torch.Tensor: raise NotImplementedError class ELU(Activation): def forward(self, inputs: 'torch.Tensor') ->torch.Tensor: return torch.nn.fu...
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...
altescy/xtorch
ELU
false
9,709
[ "MIT" ]
0
bcbbbe645f4d62c211af5b3555c526cc60792c32
https://github.com/altescy/xtorch/tree/bcbbbe645f4d62c211af5b3555c526cc60792c32
FocalLoss
import torch import torch.nn as nn import torch.optim class FocalLoss(torch.nn.Module): """Sigmoid focal cross entropy loss. Focal loss down-weights well classified examples and focusses on the hard examples. See https://arxiv.org/pdf/1708.02002.pdf for the loss definition. """ def __init__(self, gamma...
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...
ValerioB88/self-supervised-relational-reasoning
FocalLoss
false
9,710
[ "MIT" ]
0
12692b93d5c8dd3f56a31aa8b790366556e7a621
https://github.com/ValerioB88/self-supervised-relational-reasoning/tree/12692b93d5c8dd3f56a31aa8b790366556e7a621
CriticNetwork
import torch import torch.nn.functional as F import torch.nn as nn class CriticNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(CriticNetwork, self).__init__() torch.manual_seed(seed) fcs1_units = 64 fc2_units = 64 self.fcs1 = nn.Linear(state_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
aishikawa/drl-impl
CriticNetwork
false
9,711
[ "MIT" ]
0
1afe7426494cd94990cb4dae247486a25dfe37bf
https://github.com/aishikawa/drl-impl/tree/1afe7426494cd94990cb4dae247486a25dfe37bf
DuelingNetwork
import torch import torch.nn.functional as F import torch.nn as nn class DuelingNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(DuelingNetwork, self).__init__() torch.manual_seed(seed) hidden1 = 64 hidden2 = 64 self.fc1 = nn.Linear(state_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 import torch.nn as nn assert_...
aishikawa/drl-impl
DuelingNetwork
false
9,712
[ "MIT" ]
0
1afe7426494cd94990cb4dae247486a25dfe37bf
https://github.com/aishikawa/drl-impl/tree/1afe7426494cd94990cb4dae247486a25dfe37bf
ConvSigmoidInplace
import torch from torch import nn import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class ConvSigmoidInplace(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, image_size): super(ConvSigmoidInplace, 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 import nn import torch.cuda import torch.backends.cudnn import torch....
XiaobingSuper/intel-extension-for-pytorch
ConvSigmoidInplace
false
9,713
[ "Apache-2.0" ]
0
b61029be10e46e6d2e13b0e700c81f8e59164df0
https://github.com/XiaobingSuper/intel-extension-for-pytorch/tree/b61029be10e46e6d2e13b0e700c81f8e59164df0
FocalLoss
import torch from torch import nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, alpha=1, gamma=2): super().__init__() self.alpha = alpha self.gamma = gamma def forward(self, x, y): ce = F.binary_cross_entropy_with_logits(x, y) fc = 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 libdevice, math as tl_math from torch ...
agrawalshubham01/FracNet
FocalLoss
false
9,714
[ "Apache-2.0" ]
0
8b912ca65651ff0ee203d9d73cf6ca18539728ac
https://github.com/agrawalshubham01/FracNet/tree/8b912ca65651ff0ee203d9d73cf6ca18539728ac
MultiLayerPerceptron
import torch import torch.cuda import torch.distributed import torch.utils.data import torch.optim class MultiLayerPerceptron(torch.nn.Module): """ A simple MLP that can either be used independently or put on top of pretrained models (such as BERT) and act as a classifier. Args: hidden_size (i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Oreoluwa1234/NeMo
MultiLayerPerceptron
false
9,715
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
MLP
import torch import torch.nn as nn from collections import OrderedDict class MLP(nn.Module): def __init__(self, input_dims, n_hiddens, n_class): super(MLP, self).__init__() assert isinstance(input_dims, int), 'Please provide int for input_dims' self.input_dims = input_dims current...
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 co...
ZhiTingXin/pytorch-playground
MLP
false
9,716
[ "MIT" ]
0
b319eaf290ad6d793e41efc488309cedf24eba96
https://github.com/ZhiTingXin/pytorch-playground/tree/b319eaf290ad6d793e41efc488309cedf24eba96
MultiHeadAttention
import math import torch import torch.cuda from torch import nn import torch.distributed import torch.utils.data import torch.optim class MultiHeadAttention(nn.Module): """ Multi-head scaled dot-product attention layer. Args: hidden_size: size of the embeddings in the model, also known as d_model...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Oreoluwa1234/NeMo
MultiHeadAttention
false
9,717
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
ConvElu
import torch from torch import nn import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class ConvElu(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, image_size, inplace=False): super(ConvElu, 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 from torch import n...
XiaobingSuper/intel-extension-for-pytorch
ConvElu
false
9,718
[ "Apache-2.0" ]
0
b61029be10e46e6d2e13b0e700c81f8e59164df0
https://github.com/XiaobingSuper/intel-extension-for-pytorch/tree/b61029be10e46e6d2e13b0e700c81f8e59164df0
ConvSwishInplace
import torch from torch import nn import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class ConvSwishInplace(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, image_size): super(ConvSwishInplace, self).__i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.cuda import torch.backends.cudnn import torch....
XiaobingSuper/intel-extension-for-pytorch
ConvSwishInplace
false
9,719
[ "Apache-2.0" ]
0
b61029be10e46e6d2e13b0e700c81f8e59164df0
https://github.com/XiaobingSuper/intel-extension-for-pytorch/tree/b61029be10e46e6d2e13b0e700c81f8e59164df0
ConvSwishOutplace
import torch from torch import nn import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class ConvSwishOutplace(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, image_size): super(ConvSwishOutplace, 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 import nn import torch.cuda import torch.backends.cudnn import torch....
XiaobingSuper/intel-extension-for-pytorch
ConvSwishOutplace
false
9,720
[ "Apache-2.0" ]
0
b61029be10e46e6d2e13b0e700c81f8e59164df0
https://github.com/XiaobingSuper/intel-extension-for-pytorch/tree/b61029be10e46e6d2e13b0e700c81f8e59164df0
ConvHardtanh
import torch from torch import nn import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class ConvHardtanh(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, image_size, inplace=False): super(ConvHard...
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...
XiaobingSuper/intel-extension-for-pytorch
ConvHardtanh
false
9,721
[ "Apache-2.0" ]
0
b61029be10e46e6d2e13b0e700c81f8e59164df0
https://github.com/XiaobingSuper/intel-extension-for-pytorch/tree/b61029be10e46e6d2e13b0e700c81f8e59164df0
MultiHeadAttn
import torch import torch.cuda from torch.nn import functional as F from torch import nn import torch.distributed import torch.utils.data import torch.optim class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0.1, pre_lnorm=False): super(MultiHeadAttn, 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....
Oreoluwa1234/NeMo
MultiHeadAttn
false
9,722
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928