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
SmoothL1Loss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
CityU-AIM-Group/HTD
SmoothL1Loss
false
17,115
[ "MIT" ]
5
0be9fd844118c275abc6053b3cbd5ffb589e62ee
https://github.com/CityU-AIM-Group/HTD/tree/0be9fd844118c275abc6053b3cbd5ffb589e62ee
AppendDim
import torch from torch import nn class AppendDim(nn.Module): """ Append a new dim to states with size out_dim """ def __init__(self, out_dim=1): super().__init__() self.out_dim = out_dim def forward(self, states, **kwargs): x = states.unsqueeze(len(states.size())) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
AppendDim
false
17,116
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
ConvWS2d
import torch import torch.nn.functional as F import torch.nn as nn def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c_in, 1, 1, 1) std = weight...
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.fun...
CityU-AIM-Group/HTD
ConvWS2d
false
17,117
[ "MIT" ]
5
0be9fd844118c275abc6053b3cbd5ffb589e62ee
https://github.com/CityU-AIM-Group/HTD/tree/0be9fd844118c275abc6053b3cbd5ffb589e62ee
GHMR
import torch import torch.nn as nn class GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper `Gradient Harmonized Single-stage Detector <https://arxiv.org/abs/1811.05181>`_. Args: mu (float): The parameter for the Authentic Smooth L1 loss. b...
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/HTD
GHMR
false
17,118
[ "MIT" ]
5
0be9fd844118c275abc6053b3cbd5ffb589e62ee
https://github.com/CityU-AIM-Group/HTD/tree/0be9fd844118c275abc6053b3cbd5ffb589e62ee
AlignDifferential
import torch from torch import nn class AlignDifferential(nn.Module): def __init__(self): super().__init__() def new_length(self, length): return length def forward(self, states): """ :param states: [batch, length, *] """ padded_states = torch.cat([states...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
AlignDifferential
false
17,119
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
C1
import torch import torch.nn as nn from collections import OrderedDict class C1(nn.Module): def __init__(self): super(C1, self).__init__() self.c1 = nn.Sequential(OrderedDict([('c1', nn.Conv2d(1, 6, kernel_size=(5, 5))), ('relu1', nn.ReLU()), ('s1', nn.MaxPool2d (kernel_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 from co...
ConstantinSeibold/SGL
C1
false
17,120
[ "MIT" ]
7
fab4d2df515608c2a6a89b2ac8c2655ce8e08b1a
https://github.com/ConstantinSeibold/SGL/tree/fab4d2df515608c2a6a89b2ac8c2655ce8e08b1a
GaussianFocalLoss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
CityU-AIM-Group/HTD
GaussianFocalLoss
false
17,121
[ "MIT" ]
5
0be9fd844118c275abc6053b3cbd5ffb589e62ee
https://github.com/CityU-AIM-Group/HTD/tree/0be9fd844118c275abc6053b3cbd5ffb589e62ee
Differential
import torch from torch import nn class Differential(nn.Module): def __init__(self, kernel_size=3, stride=1, padding=0): super().__init__() self.kernel_size = kernel_size self.stride = stride self.padding = padding def new_length(self, length): new_length = (length + ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
Differential
false
17,122
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
MultiheadAttention
import torch import torch.nn as nn class MultiheadAttention(nn.Module): """A warpper for torch.nn.MultiheadAttention. This module implements MultiheadAttention with residual connection, and positional encoding used in DETR is also passed as input. Args: embed_dims (int): The embedding dimens...
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....
CityU-AIM-Group/HTD
MultiheadAttention
false
17,123
[ "MIT" ]
5
0be9fd844118c275abc6053b3cbd5ffb589e62ee
https://github.com/CityU-AIM-Group/HTD/tree/0be9fd844118c275abc6053b3cbd5ffb589e62ee
C2
import torch import torch.nn as nn from collections import OrderedDict class C2(nn.Module): def __init__(self): super(C2, self).__init__() self.c2 = nn.Sequential(OrderedDict([('c2', nn.Conv2d(6, 16, kernel_size=(5, 5))), ('relu2', nn.ReLU()), ('s2', nn.MaxPool2d (kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from co...
ConstantinSeibold/SGL
C2
false
17,124
[ "MIT" ]
7
fab4d2df515608c2a6a89b2ac8c2655ce8e08b1a
https://github.com/ConstantinSeibold/SGL/tree/fab4d2df515608c2a6a89b2ac8c2655ce8e08b1a
Distance
import torch from torch import nn def apply_last_dim(model, x): size = list(x.size()) y = model(x.contiguous().view(-1, size[-1])) size[-1] = y.size(-1) y = y.view(torch.Size(size)) return y def get_int_dim_index(name): if isinstance(name, int): return name name_list = 'axyz' ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
Distance
false
17,125
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
SIMSE
import torch import torch.nn as nn class SIMSE(nn.Module): def __init__(self): super(SIMSE, self).__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) simse = torch.sum(diffs).pow(2) / n ** 2 return simse def get_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Columbine21/TFR-Net
SIMSE
false
17,126
[ "MIT" ]
7
1da01577542e7f477fdf7323ec0696aebc632357
https://github.com/Columbine21/TFR-Net/tree/1da01577542e7f477fdf7323ec0696aebc632357
SoftSmall
import math import torch from torch import nn class SoftCompare(nn.Module): def __init__(self, alpha=None, beta=None): super().__init__() self.alpha = nn.Parameter(torch.ones(1) * (0 if alpha is None else alpha), requires_grad=True) self.beta = nn.Parameter(torch.ones(1) * (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.triton_helpers import math as tl_math import math from torch import nn assert_size_stride = torch._C._dynamo.gu...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
SoftSmall
false
17,127
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
GHMC
import torch import torch.nn.functional as F import torch.nn as nn def _expand_onehot_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero((labels >= 0) & (labels < label_channels), as_tuple=False).squeeze() if inds.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 import torch.nn as nn ...
CityU-AIM-Group/HTD
GHMC
false
17,128
[ "MIT" ]
5
0be9fd844118c275abc6053b3cbd5ffb589e62ee
https://github.com/CityU-AIM-Group/HTD/tree/0be9fd844118c275abc6053b3cbd5ffb589e62ee
Inequality
import math import torch from torch import nn class Normalize(nn.Module): def __init__(self, distribution=None, **kwargs): super().__init__() self.distribution = distribution self.data_ = [] if distribution is None: pass elif distribution == 'normal': ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guard...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
Inequality
false
17,129
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
MinPoolTrinary
import torch from torch import nn class MinPoolTrinary(nn.Module): def __init__(self): super().__init__() def new_length(self, length): return length def forward(self, states): """ :param states: [batch, length, *] """ assert states.size(1) >= 3 s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
MinPoolTrinary
false
17,130
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
MaxPoolTrinary
import torch from torch import nn class MaxPoolTrinary(nn.Module): def __init__(self): super().__init__() def new_length(self, length): return length def forward(self, states): """ :param states: [batch, length, *] """ assert states.size(1) >= 3 s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
MaxPoolTrinary
false
17,131
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
BalancedL1Loss
import functools import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
CityU-AIM-Group/HTD
BalancedL1Loss
false
17,132
[ "MIT" ]
5
0be9fd844118c275abc6053b3cbd5ffb589e62ee
https://github.com/CityU-AIM-Group/HTD/tree/0be9fd844118c275abc6053b3cbd5ffb589e62ee
C3
import torch import torch.nn as nn from collections import OrderedDict class C3(nn.Module): def __init__(self): super(C3, self).__init__() self.c3 = nn.Sequential(OrderedDict([('c3', nn.Conv2d(16, 120, kernel_size=(5, 5))), ('relu3', nn.ReLU())])) def forward(self, img): ...
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...
ConstantinSeibold/SGL
C3
false
17,133
[ "MIT" ]
7
fab4d2df515608c2a6a89b2ac8c2655ce8e08b1a
https://github.com/ConstantinSeibold/SGL/tree/fab4d2df515608c2a6a89b2ac8c2655ce8e08b1a
Subsample
import torch import torch.utils.data import torch.nn as nn class Subsample(nn.Module): def __init__(self): super().__init__() def forward(self, feats, lengths): out = feats[:, ::2] lengths = lengths // 2 return out, lengths def get_inputs(): return [torch.rand([4, 4, 4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dy...
CoraJung/flexible-input-slu
Subsample
false
17,134
[ "Apache-2.0" ]
7
6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
https://github.com/CoraJung/flexible-input-slu/tree/6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
MultiheadAttention
import torch import torch.nn.functional as F import torch.nn as nn from torch.nn.parameter import Parameter from torch.nn import Parameter class MultiheadAttention(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for more details. """ def __init__(self, embed_dim, num_heads, att...
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....
Columbine21/TFR-Net
MultiheadAttention
false
17,135
[ "MIT" ]
7
1da01577542e7f477fdf7323ec0696aebc632357
https://github.com/Columbine21/TFR-Net/tree/1da01577542e7f477fdf7323ec0696aebc632357
L2Norm
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product import torch.nn.init as init class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.gamma = scale or None ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from math import sqrt as sqrt from itertools import produ...
Coral-SH/TextBoxes_PyTorch
L2Norm
false
17,136
[ "MIT" ]
8
fb1636139d69e762b567a234c3a4b69e3dd43071
https://github.com/Coral-SH/TextBoxes_PyTorch/tree/fb1636139d69e762b567a234c3a4b69e3dd43071
Ternary
import torch from torch import nn class Ternary(nn.Module): """ Ternarize the input activations to -1, 0, 1. """ def __init__(self, left=-0.25, right=0.25): super().__init__() self.left = left self.right = right def forward(self, input): input = input.clone() ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
Ternary
false
17,137
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
NonLocalLayer
import torch from torch import nn class NonLocalLayer(nn.Module): def __init__(self, input_dim, output_dim, hidden_dim=None, t_kernel_size=1, t_stride=1, t_padding=None, t_dilation=1, bias= True, residual=True): super().__init__() if t_padding is None: t_padding = (t_k...
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....
C-SUNSHINE/TOQ-Nets-PyTorch-Release
NonLocalLayer
false
17,138
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
Abs
import torch import torch.utils.data class Abs(torch.nn.Module): def __init__(self): super(Abs, self).__init__() def forward(self, input): return torch.abs(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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asse...
CoraJung/flexible-input-slu
Abs
false
17,139
[ "Apache-2.0" ]
7
6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
https://github.com/CoraJung/flexible-input-slu/tree/6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
AvgPoolPad
import torch import torch.utils.data import torch.nn as nn import torch.backends.cudnn class AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch.backends.cudnn assert_size_stride = torch._C._dynamo.guards.assert_size_stride em...
CalebEverett/fastai-dl2
AvgPoolPad
false
17,140
[ "Apache-2.0" ]
4
64d23592eddca6ca1f3647e73c319e97c8eb392b
https://github.com/CalebEverett/fastai-dl2/tree/64d23592eddca6ca1f3647e73c319e97c8eb392b
GlobalAvgPool2d
import torch import torch.nn as nn import torch.utils.data class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): return nn.functional.adaptive_avg_pool2...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
BigFishMaster/tnt
GlobalAvgPool2d
false
17,141
[ "BSD-3-Clause" ]
3
8b80bb3b194eb87ac18924428ef0924c2fb263c5
https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5
LayerNorm
import torch import torch.utils.data import torch.nn as nn class LayerNorm(torch.nn.Module): def __init__(self, dim, eps=1e-06): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(dim)) self.beta = nn.Parameter(torch.zeros(dim)) self.eps = eps def forward(...
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.utils.data import torch.nn as nn assert_size_stride = torch._C._dy...
CoraJung/flexible-input-slu
LayerNorm
false
17,142
[ "Apache-2.0" ]
7
6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
https://github.com/CoraJung/flexible-input-slu/tree/6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
WithBall
import math import torch from torch import nn def apply_last_dim(model, x): size = list(x.size()) y = model(x.contiguous().view(-1, size[-1])) size[-1] = y.size(-1) y = y.view(torch.Size(size)) return y def get_int_dim_index(name): if isinstance(name, int): return name name_list ...
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 math from torch import nn assert_size_stride = torch._C...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
WithBall
false
17,143
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
SoftLarge
import math import torch from torch import nn class SoftCompare(nn.Module): def __init__(self, alpha=None, beta=None): super().__init__() self.alpha = nn.Parameter(torch.ones(1) * (0 if alpha is None else alpha), requires_grad=True) self.beta = nn.Parameter(torch.ones(1) * (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.triton_helpers import math as tl_math import math from torch import nn assert_size_stride = torch._C._dynamo.gu...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
SoftLarge
false
17,144
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
TernaryLinear
import torch from torch import nn import torch.nn.functional as F from torch.nn import init class Ternary(nn.Module): """ Ternarize the input activations to -1, 0, 1. """ def __init__(self, left=-0.25, right=0.25): super().__init__() self.left = left self.right = right de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.nn import init assert_size_stride = torch._C._dy...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
TernaryLinear
false
17,145
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
FinalPool
import torch import torch.utils.data class FinalPool(torch.nn.Module): def __init__(self): super(FinalPool, self).__init__() def forward(self, input): """ input : Tensor of shape (batch size, T, Cin) Outputs a Tensor of shape (batch size, Cin). """ return input.max(dim=1)[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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride e...
CoraJung/flexible-input-slu
FinalPool
false
17,146
[ "Apache-2.0" ]
7
6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
https://github.com/CoraJung/flexible-input-slu/tree/6a1a6bf105f1a0c07e8d483aa6da1df7a554392d
BinaryPrimitivesPredefined_v2
import math import torch from torch import nn def apply_last_dim(model, x): size = list(x.size()) y = model(x.contiguous().view(-1, size[-1])) size[-1] = y.size(-1) y = y.view(torch.Size(size)) return y def get_int_dim_index(name): if isinstance(name, int): return name name_list ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
BinaryPrimitivesPredefined_v2
false
17,147
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
BinaryPrimitivesPredefined
import math import torch from torch import nn def apply_last_dim(model, x): size = list(x.size()) y = model(x.contiguous().view(-1, size[-1])) size[-1] = y.size(-1) y = y.view(torch.Size(size)) return y def get_int_dim_index(name): if isinstance(name, int): return name name_list ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
BinaryPrimitivesPredefined
false
17,148
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
Conv3BN
import torch import torch.utils.data import torch.nn as nn import torch.backends.cudnn def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class Conv3BN(nn.Module): def __init__(self, in_: 'int', out: 'int', bn=False): super().__init__() self.conv = conv3x3(in_, out) 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 import torch.utils.data impor...
CalebEverett/fastai-dl2
Conv3BN
false
17,149
[ "Apache-2.0" ]
4
64d23592eddca6ca1f3647e73c319e97c8eb392b
https://github.com/CalebEverett/fastai-dl2/tree/64d23592eddca6ca1f3647e73c319e97c8eb392b
MatrixTree
import torch import torch.nn as nn import torch.cuda import torch.distributed class MatrixTree(nn.Module): """Implementation of the matrix-tree theorem for computing marginals of non-projective dependency parsing. This attention layer is used in the paper "Learning Structured Text Representations" :ci...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda import torch.distributed assert_s...
ChenRocks/Distill-BERT-Textgen-ONMT
MatrixTree
false
17,150
[ "MIT" ]
7
d83dd1a95af7513cbfae4a2768f6effc2f3a589f
https://github.com/ChenRocks/Distill-BERT-Textgen-ONMT/tree/d83dd1a95af7513cbfae4a2768f6effc2f3a589f
NullaryPrimitivesPredefined_v2
import math import torch from torch import nn class Normalize(nn.Module): def __init__(self, distribution=None, **kwargs): super().__init__() self.distribution = distribution self.data_ = [] if distribution is None: pass elif distribution == 'normal': ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
NullaryPrimitivesPredefined_v2
false
17,151
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
MaxPoolPad
import torch import torch.utils.data import torch.nn as nn import torch.backends.cudnn class MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data import torch.nn as nn import torch.backends.cudnn assert_size_str...
CalebEverett/fastai-dl2
MaxPoolPad
false
17,152
[ "Apache-2.0" ]
4
64d23592eddca6ca1f3647e73c319e97c8eb392b
https://github.com/CalebEverett/fastai-dl2/tree/64d23592eddca6ca1f3647e73c319e97c8eb392b
MaxPool
import torch import torch.nn as nn import torch.utils.data class MaxPool(nn.Module): def __init__(self, kernel_size, stride=1, padding=1, zero_pad=False): super(MaxPool, self).__init__() self.zero_pad = nn.ZeroPad2d((1, 0, 1, 0)) if zero_pad else None self.pool = nn.MaxPool2d(kernel_size,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
BigFishMaster/tnt
MaxPool
false
17,153
[ "BSD-3-Clause" ]
3
8b80bb3b194eb87ac18924428ef0924c2fb263c5
https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5
UnaryPrimitivesToyotaJoint
import math import torch from torch import nn class Normalize(nn.Module): def __init__(self, distribution=None, **kwargs): super().__init__() self.distribution = distribution self.data_ = [] if distribution is None: pass elif distribution == 'normal': ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guard...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
UnaryPrimitivesToyotaJoint
false
17,154
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
MaxPoolPad
import torch import torch.nn as nn import torch.utils.data class MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
BigFishMaster/tnt
MaxPoolPad
false
17,155
[ "BSD-3-Clause" ]
3
8b80bb3b194eb87ac18924428ef0924c2fb263c5
https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5
SpaceTimeRegionalConv
import torch from torch import nn class SpaceTimeRegionalConv(nn.Module): """ Space Time Region Graph """ def __init__(self, input_dim, output_dim, t_kernel_size=1, t_stride=1, t_padding=None, t_dilation=1, bias=True, residual=True): super().__init__() self.input_dim = input_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 import nn assert_s...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
SpaceTimeRegionalConv
false
17,156
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
Sigmoid
import torch import torch.nn as nn import torch.utils.data from torch.nn import Sigmoid class Sigmoid(nn.Module): def __init__(self, inplace: 'bool'=False): super(Sigmoid, self).__init__() self.inplace = inplace def forward(self, x): return x.sigmoid_() if self.inplace else x.sigmoid...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
BigFishMaster/tnt
Sigmoid
false
17,157
[ "BSD-3-Clause" ]
3
8b80bb3b194eb87ac18924428ef0924c2fb263c5
https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5
AvgPoolPad
import torch import torch.nn as nn import torch.utils.data class AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
BigFishMaster/tnt
AvgPoolPad
false
17,158
[ "BSD-3-Clause" ]
3
8b80bb3b194eb87ac18924428ef0924c2fb263c5
https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5
Tanh
import torch import torch.nn as nn import torch.utils.data class Tanh(nn.Module): def __init__(self, inplace: 'bool'=False): super(Tanh, self).__init__() self.inplace = inplace def forward(self, x): return x.tanh_() if self.inplace else x.tanh() def get_inputs(): 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dy...
BigFishMaster/tnt
Tanh
false
17,159
[ "BSD-3-Clause" ]
3
8b80bb3b194eb87ac18924428ef0924c2fb263c5
https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5
ValueNetwork
import torch import torch.nn.functional as F import torch.nn as nn def mish(x): """ Mish: A Self Regularized Non-Monotonic Neural Activation Function https://arxiv.org/abs/1908.08681v1 implemented for PyTorch / FastAI by lessw2020 https://github.com/lessw2020/mish param: ...
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....
Crawford-fang/ROS_pytorch_RL
ValueNetwork
false
17,160
[ "Apache-2.0" ]
10
2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
https://github.com/Crawford-fang/ROS_pytorch_RL/tree/2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
AdaptiveConcatPool2d
import torch import torch.utils.data import torch.nn as nn import torch.backends.cudnn class AdaptiveConcatPool2d(nn.Module): def __init__(self, sz=None): super().__init__() sz = sz or (1, 1) self.ap = nn.AdaptiveAvgPool2d(sz) self.mp = nn.AdaptiveMaxPool2d(sz) 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 from torch._inductor.runtime import triton_helpers import torch.utils.data import torch.nn as nn import torch.backends.cudnn assert_size_str...
CalebEverett/fastai-dl2
AdaptiveConcatPool2d
false
17,161
[ "Apache-2.0" ]
4
64d23592eddca6ca1f3647e73c319e97c8eb392b
https://github.com/CalebEverett/fastai-dl2/tree/64d23592eddca6ca1f3647e73c319e97c8eb392b
SpatialCrossMapLRN
import torch import torch.nn as nn import torch.utils.data class SpatialCrossMapLRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1, ACROSS_CHANNELS=True): super(SpatialCrossMapLRN, self).__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if ACROSS_CHANNELS: ...
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...
BigFishMaster/tnt
SpatialCrossMapLRN
false
17,162
[ "BSD-3-Clause" ]
3
8b80bb3b194eb87ac18924428ef0924c2fb263c5
https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5
MLP
import torch from torch import nn from torch.nn import functional as F class MLP(nn.Module): def __init__(self, input_dim, output_dim, dropout=0.5): super(MLP, self).__init__() self.input_fc = nn.Linear(input_dim, 250) self.hidden_fc = nn.Linear(250, 100) self.output_fc = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
CrispenGari/pneumonia-infection
MLP
false
17,163
[ "MIT" ]
4
8d1fc5f61aa8c4eb06d640e6da5abbbe23ccb85e
https://github.com/CrispenGari/pneumonia-infection/tree/8d1fc5f61aa8c4eb06d640e6da5abbbe23ccb85e
OutConv_Sigmoid
import torch import torch.nn as nn class OutConv_Sigmoid(nn.Module): def __init__(self, in_channels, out_channels): super(OutConv_Sigmoid, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=1) self.sigmoid = nn.Sigmoid() def forward(self, x): return...
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...
Curli-quan/oneshot-medical-landmark
OutConv_Sigmoid
false
17,164
[ "Apache-2.0" ]
7
572926077fffbe9832aa16baa98bd046ec326700
https://github.com/Curli-quan/oneshot-medical-landmark/tree/572926077fffbe9832aa16baa98bd046ec326700
QNetwork
import torch import torch.nn.functional as F import torch.nn as nn def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class QNetwork(nn.Module): def __init__(self, state_dim, action_dim, 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 import torch.nn as nn assert_...
Crawford-fang/ROS_pytorch_RL
QNetwork
false
17,165
[ "Apache-2.0" ]
10
2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
https://github.com/Crawford-fang/ROS_pytorch_RL/tree/2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
LayerNormalization
import torch import torch.nn as nn class LayerNormalization(nn.Module): def __init__(self, normal_shape, gamma=True, beta=True, epsilon=1e-10): """Layer normalization layer See: [Layer Normalization](https://arxiv.org/pdf/1607.06450.pdf) :param normal_shape: The shape of the input tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
CyberZHG/torch-layer-normalization
LayerNormalization
false
17,166
[ "MIT" ]
9
89f405b60f53f85da6f03fe685c190ef394ce50c
https://github.com/CyberZHG/torch-layer-normalization/tree/89f405b60f53f85da6f03fe685c190ef394ce50c
DQN_hot2
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_hot2(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation """ def __init__(self, m, n, num_actions): super(DQN_hot2, self).__init__() self.fc1 = ...
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 ...
CoAxLab/azad
DQN_hot2
false
17,167
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
PolicyNetwork
import torch import torch.nn.functional as F import torch.nn as nn from torch.distributions import Normal def mish(x): """ Mish: A Self Regularized Non-Monotonic Neural Activation Function https://arxiv.org/abs/1908.08681v1 implemented for PyTorch / FastAI by lessw2020 https://gith...
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....
Crawford-fang/ROS_pytorch_RL
PolicyNetwork
false
17,168
[ "Apache-2.0" ]
10
2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
https://github.com/Crawford-fang/ROS_pytorch_RL/tree/2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
UnaryPrimitivesPredefined_v2
import math import torch from torch import nn def apply_last_dim(model, x): size = list(x.size()) y = model(x.contiguous().view(-1, size[-1])) size[-1] = y.size(-1) y = y.view(torch.Size(size)) return y def get_int_dim_index(name): if isinstance(name, int): return name name_list ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
UnaryPrimitivesPredefined_v2
false
17,169
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
SELayer
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.backends.cudnn class SELayer(nn.Module): def __init__(self, in_channels, reduction): super(SELayer, self).__init__() mid_channels = in_channels // reduction self.fc1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
CrazyStoneonRoad/pytorch_image_classification
SELayer
false
17,170
[ "MIT" ]
4
1dcf6d0ee8f4a102ca93cc6e5e325a2e9153918b
https://github.com/CrazyStoneonRoad/pytorch_image_classification/tree/1dcf6d0ee8f4a102ca93cc6e5e325a2e9153918b
MultiHeadAttention
import torch import torch.utils.data from torch import nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ input: query --- [N, T_q, query_dim] key --- [N, T_k, key_dim] output: out --- [N, T_q, num_units] """ def __init__(self, query_dim, key_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....
CookiePPP/pag-tacotron2
MultiHeadAttention
false
17,171
[ "BSD-3-Clause" ]
10
503e7e9e892c5c0795f6278e70e72b627ed1cfb7
https://github.com/CookiePPP/pag-tacotron2/tree/503e7e9e892c5c0795f6278e70e72b627ed1cfb7
GCN
import torch import torch.nn as nn class GCN(nn.Module): def __init__(self, in_ft, out_ft, act, bias=True): super(GCN, self).__init__() self.fc = nn.Linear(in_ft, out_ft, bias=False) self.act = nn.PReLU() if act == 'prelu' else act if bias: self.bias = nn.Parameter(tor...
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...
CrowdDynamicsLab/InfoMotif
GCN
false
17,172
[ "BSD-3-Clause" ]
7
cca1ffa14cc94408a5c4c50b7b1707c608e3bc9b
https://github.com/CrowdDynamicsLab/InfoMotif/tree/cca1ffa14cc94408a5c4c50b7b1707c608e3bc9b
DQN_hot4
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_hot4(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation """ def __init__(self, m, n, num_actions): super(DQN_hot4, self).__init__() self.fc1 = ...
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 ...
CoAxLab/azad
DQN_hot4
false
17,173
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
DQN_hot1
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_hot1(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation """ def __init__(self, m, n, num_actions): super(DQN_hot1, self).__init__() self.fc1 = ...
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 ...
CoAxLab/azad
DQN_hot1
false
17,174
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
SoftQNetwork
import torch import torch.nn.functional as F import torch.nn as nn def mish(x): """ Mish: A Self Regularized Non-Monotonic Neural Activation Function https://arxiv.org/abs/1908.08681v1 implemented for PyTorch / FastAI by lessw2020 https://github.com/lessw2020/mish param: ...
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....
Crawford-fang/ROS_pytorch_RL
SoftQNetwork
false
17,175
[ "Apache-2.0" ]
10
2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
https://github.com/Crawford-fang/ROS_pytorch_RL/tree/2d3476f15d51aa1f5b5ae9edc5d7f4c776e5de9f
DQN_hot3
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_hot3(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation """ def __init__(self, m, n, num_actions): super(DQN_hot3, self).__init__() self.fc1 = ...
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 ...
CoAxLab/azad
DQN_hot3
false
17,176
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
Encoder_attention
import torch import torch.nn as nn class Encoder_attention(nn.Module): def __init__(self, n_h): super(Encoder_attention, self).__init__() self.linear = nn.Linear(n_h, 1) self.softmax = nn.Softmax(dim=1) def forward(self, x): """Output: X """ x1 = self.linear(x).squeez...
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....
CrowdDynamicsLab/InfoMotif
Encoder_attention
false
17,177
[ "BSD-3-Clause" ]
7
cca1ffa14cc94408a5c4c50b7b1707c608e3bc9b
https://github.com/CrowdDynamicsLab/InfoMotif/tree/cca1ffa14cc94408a5c4c50b7b1707c608e3bc9b
DQN_xy3
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_xy3(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation """ def __init__(self): super(DQN_xy3, self).__init__() self.fc1 = nn.Linear(4, 10) ...
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 ...
CoAxLab/azad
DQN_xy3
false
17,178
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
BPR
import torch class BPR(torch.nn.Module): def __init__(self): super(BPR, self).__init__() self._sigmoid = torch.nn.Sigmoid() def forward(self, pos, neg): loss = torch.log(self._sigmoid(pos.double() - neg.double())) return -loss.mean() def get_inputs(): return [torch.rand...
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 assert_size_stride = torch._...
DanielMorales9/FactorizationPyTorch
BPR
false
17,179
[ "MIT" ]
4
50f0644fdb4a903550fb3f1ba78fb9fb8649ceb1
https://github.com/DanielMorales9/FactorizationPyTorch/tree/50f0644fdb4a903550fb3f1ba78fb9fb8649ceb1
UpsampleConvLayer
import torch from torch import nn import torch.nn.functional as f import torch.nn.parallel class UpsampleConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, activation='relu', norm=None): super(UpsampleConvLayer, self).__init__() bias = Fa...
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...
DA4EVENT/home
UpsampleConvLayer
false
17,180
[ "MIT" ]
5
18cc93a795ce132e05b886aa34565a102915b1c6
https://github.com/DA4EVENT/home/tree/18cc93a795ce132e05b886aa34565a102915b1c6
DeepTable3
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DeepTable3(nn.Module): """A deep differentialable 'Table' for learning one-hot input and output. """ def __init__(self, in_channels, out_channels, num_hidden1=200, num_hidden2=100): super(Deep...
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....
CoAxLab/azad
DeepTable3
false
17,181
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
BinaryPrimitivesSomethingElse
import math import torch from torch import nn def apply_last_dim(model, x): size = list(x.size()) y = model(x.contiguous().view(-1, size[-1])) size[-1] = y.size(-1) y = y.view(torch.Size(size)) return y def get_int_dim_index(name): if isinstance(name, int): return name name_list ...
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...
C-SUNSHINE/TOQ-Nets-PyTorch-Release
BinaryPrimitivesSomethingElse
false
17,182
[ "MIT" ]
6
05e06bf633fb3c6b610dda9a5126ecd7af1db02f
https://github.com/C-SUNSHINE/TOQ-Nets-PyTorch-Release/tree/05e06bf633fb3c6b610dda9a5126ecd7af1db02f
DQN_xy2
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_xy2(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation """ def __init__(self): super(DQN_xy2, self).__init__() self.fc1 = nn.Linear(4, 100) ...
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 ...
CoAxLab/azad
DQN_xy2
false
17,183
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
MMDLoss
import torch from torch import nn import torch.nn.parallel def gaussian_kernel(source, target, kernel_mul=2.0, kernel_num=5, fix_sigma =None): n_samples = int(source.size()[0]) + int(target.size()[0]) total = torch.cat([source, target], dim=0) total0 = total.unsqueeze(0).expand(int(total.size(0)), int...
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 import torch.nn.parallel assert_size_stride = torch....
DA4EVENT/home
MMDLoss
false
17,184
[ "MIT" ]
5
18cc93a795ce132e05b886aa34565a102915b1c6
https://github.com/DA4EVENT/home/tree/18cc93a795ce132e05b886aa34565a102915b1c6
TransposedConvLayer
import torch from torch import nn import torch.nn.parallel class TransposedConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, activation='relu', norm=None): super(TransposedConvLayer, self).__init__() bias = False if norm == 'BN' else Tru...
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...
DA4EVENT/home
TransposedConvLayer
false
17,185
[ "MIT" ]
5
18cc93a795ce132e05b886aa34565a102915b1c6
https://github.com/DA4EVENT/home/tree/18cc93a795ce132e05b886aa34565a102915b1c6
ConvLayer
import torch from torch import nn import torch.nn.parallel class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, activation='relu', norm=None): super(ConvLayer, self).__init__() bias = False if norm == 'BN' else True self.conv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
DA4EVENT/home
ConvLayer
false
17,186
[ "MIT" ]
5
18cc93a795ce132e05b886aa34565a102915b1c6
https://github.com/DA4EVENT/home/tree/18cc93a795ce132e05b886aa34565a102915b1c6
DQN_xy4
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_xy4(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation """ def __init__(self): super(DQN_xy4, self).__init__() self.fc1 = nn.Linear(4, 100) ...
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 ...
CoAxLab/azad
DQN_xy4
false
17,187
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
DQN_hot5
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_hot5(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation Params ------ m, n: int Board size num_actions: int Number of action-valu...
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 ...
CoAxLab/azad
DQN_hot5
false
17,188
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
DQN_xy5
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_xy5(nn.Module): """ A MLP for DQN learning. Note: Uses a one hot board representation Params ------ m, n: int Board size num_actions: int Number of action-value...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
CoAxLab/azad
DQN_xy5
false
17,189
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
DQN_xy1
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_xy1(nn.Module): """ A MLP for DQN learning. Note: Uses a (x,y) coordinate board/action representation. """ def __init__(self): super(DQN_xy1, self).__init__() self.fc1 = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
CoAxLab/azad
DQN_xy1
false
17,190
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
down
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 import nn import torch.nn.parallel assert_size_stride = torch._C._dyn...
DA4EVENT/home
down
false
17,191
[ "MIT" ]
5
18cc93a795ce132e05b886aa34565a102915b1c6
https://github.com/DA4EVENT/home/tree/18cc93a795ce132e05b886aa34565a102915b1c6
MaskUpdate
import torch from torch import nn from torch.nn.parameter import Parameter class MaskUpdate(nn.Module): def __init__(self, alpha): super(MaskUpdate, self).__init__() self.updateFunc = nn.ReLU(False) self.alpha = Parameter(torch.tensor(alpha, dtype=torch.float32)) def forward(self, in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
DLwbm123/LBAM_inpainting
MaskUpdate
false
17,192
[ "MIT" ]
7
c809c3cedf09cda7c175e930c7834ac39d8f526f
https://github.com/DLwbm123/LBAM_inpainting/tree/c809c3cedf09cda7c175e930c7834ac39d8f526f
ResidualBlock
import torch from torch import nn import torch.nn.parallel class ResidualBlock(nn.Module): def __init__(self, in_channels, out_channels, stride=1, downsample=None, norm=None): super(ResidualBlock, self).__init__() bias = False if norm == 'BN' else True self.conv1 = nn.Conv2d(in_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 from torch import nn import t...
DA4EVENT/home
ResidualBlock
false
17,193
[ "MIT" ]
5
18cc93a795ce132e05b886aa34565a102915b1c6
https://github.com/DA4EVENT/home/tree/18cc93a795ce132e05b886aa34565a102915b1c6
DQN_mlp
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class DQN_mlp(nn.Module): """Layers for a Deep Q Network, based on a simple MLP.""" def __init__(self, m, n, num_actions, num_hidden1=1000, num_hidden2=2000): super(DQN_mlp, self).__init__() self.m = m ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
CoAxLab/azad
DQN_mlp
false
17,194
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, n_h): super(Attention, self).__init__() self.linear = nn.Linear(n_h * 2, 1) self.softmax = nn.Softmax(dim=2) def forward(self, x): curr_node = x[:, :, 0, :].unsqueeze(2).expand_as(x) sta...
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....
CrowdDynamicsLab/InfoMotif
Attention
false
17,195
[ "BSD-3-Clause" ]
7
cca1ffa14cc94408a5c4c50b7b1707c608e3bc9b
https://github.com/CrowdDynamicsLab/InfoMotif/tree/cca1ffa14cc94408a5c4c50b7b1707c608e3bc9b
MCDO
import torch from torch import nn class MCDO(nn.Module): def __init__(self, in_dim, out_dim, n_layers=1, hid_dim=50, p=0.05): super().__init__() self.n_layers = n_layers self.linear_in = nn.Linear(in_dim, hid_dim) nn.init.normal_(self.linear_in.weight, std=1 / (4 * hid_dim) ** 0.5...
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...
Daniil-Selikhanovych/bnn-vi
MCDO
false
17,196
[ "MIT" ]
3
6788edc1438c66609abca249e33a81da7a0ff1a2
https://github.com/Daniil-Selikhanovych/bnn-vi/tree/6788edc1438c66609abca249e33a81da7a0ff1a2
GaussActivation
import torch from torch import nn from torch.nn.parameter import Parameter class GaussActivation(nn.Module): def __init__(self, a, mu, sigma1, sigma2): super(GaussActivation, self).__init__() self.a = Parameter(torch.tensor(a, dtype=torch.float32)) self.mu = Parameter(torch.tensor(mu, dty...
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 f...
DLwbm123/LBAM_inpainting
GaussActivation
false
17,197
[ "MIT" ]
7
c809c3cedf09cda7c175e930c7834ac39d8f526f
https://github.com/DLwbm123/LBAM_inpainting/tree/c809c3cedf09cda7c175e930c7834ac39d8f526f
FactorizationMachine
from torch.nn import Module import torch from torch import FloatTensor from torch.nn import Parameter class SecondOrderInteraction(Module): """ Factorized parameters for the Second Order Interactions Parameters ---------- n_features: int Length of the input vector. n_factors: int, opt...
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.nn import Module from torch import FloatTensor from torch.nn import P...
DanielMorales9/FactorizationPyTorch
FactorizationMachine
false
17,198
[ "MIT" ]
4
50f0644fdb4a903550fb3f1ba78fb9fb8649ceb1
https://github.com/DanielMorales9/FactorizationPyTorch/tree/50f0644fdb4a903550fb3f1ba78fb9fb8649ceb1
GEGLU
import torch import torch.nn as nn import torch.nn.functional as F class GEGLU(nn.Module): def forward(self, x): x, gate = x.chunk(2, dim=-1) return F.gelu(gate) * 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
DannielSilva/MMBERT
GEGLU
false
17,199
[ "MIT" ]
4
2c9069b59b66b8f3fec6de2e68ec42b489a3a437
https://github.com/DannielSilva/MMBERT/tree/2c9069b59b66b8f3fec6de2e68ec42b489a3a437
SecondOrderInteraction
from torch.nn import Module import torch from torch.nn import Parameter class SecondOrderInteraction(Module): """ Factorized parameters for the Second Order Interactions Parameters ---------- n_features: int Length of the input vector. n_factors: int, optional Number of factor...
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.nn import Module from torch.nn import Parameter assert_size_stride = ...
DanielMorales9/FactorizationPyTorch
SecondOrderInteraction
false
17,200
[ "MIT" ]
4
50f0644fdb4a903550fb3f1ba78fb9fb8649ceb1
https://github.com/DanielMorales9/FactorizationPyTorch/tree/50f0644fdb4a903550fb3f1ba78fb9fb8649ceb1
GatedConv2d
import torch import torch.nn as nn import torch.utils.data class GatedConv2d(nn.Module): def __init__(self, input_channels, output_channels, kernel_size, stride, padding, dilation=1, activation=None): super(GatedConv2d, self).__init__() self.activation = activation self.sigmoid = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Daulbaev/IRDM
GatedConv2d
false
17,201
[ "MIT" ]
10
4bb60191ac0072e4349ca47092675d06b39a979a
https://github.com/Daulbaev/IRDM/tree/4bb60191ac0072e4349ca47092675d06b39a979a
SERF
import torch import torch.nn as nn class SERF(nn.Module): def __init__(self, thresh=50): super().__init__() self.thresh = thresh None def forward(self, x): return self.serf_log1pexp(x) def serf(self, x): return x * torch.erf(torch.log(1 + torch.exp(x))) 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 libdevice, math as tl_math import torc...
DannielSilva/MMBERT
SERF
false
17,202
[ "MIT" ]
4
2c9069b59b66b8f3fec6de2e68ec42b489a3a437
https://github.com/DannielSilva/MMBERT/tree/2c9069b59b66b8f3fec6de2e68ec42b489a3a437
BCEWithLogitsWithClassWeightLoss
import torch from torch import Tensor from typing import NoReturn from torch import nn class BCEWithLogitsWithClassWeightLoss(nn.BCEWithLogitsLoss): """ finished, checked, """ __name__ = 'BCEWithLogitsWithClassWeightsLoss' def __init__(self, class_weight: 'Tensor') ->NoReturn: """ finished, c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
DeepPSP/torch_ecg
BCEWithLogitsWithClassWeightLoss
false
17,203
[ "MIT" ]
9
6db5ffb063d0e8fb4ce97029a0d184a658f43a37
https://github.com/DeepPSP/torch_ecg/tree/6db5ffb063d0e8fb4ce97029a0d184a658f43a37
MLP
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data def create_all_possible_moves(m, n): """Create all moves on a (m,n) board.""" moves = [] for i in range(m): for j in range(n): moves.append((i, j)) return list(set(moves)) class MLP(nn.Modu...
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....
CoAxLab/azad
MLP
false
17,204
[ "MIT" ]
6
d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
https://github.com/CoAxLab/azad/tree/d1498069dd8856e93ae077b34dd7c9f1c7ce80e6
PatchEmbedding
import torch import torch.nn as nn class PatchEmbedding(nn.Module): def __init__(self, image_size, patch_size, embed_dim, channels): super().__init__() self.image_size = image_size if image_size[0] % patch_size != 0 or image_size[1] % patch_size != 0: raise ValueError( ...
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...
Curli-quan/fewshot-select
PatchEmbedding
false
17,205
[ "Apache-2.0" ]
7
34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
https://github.com/Curli-quan/fewshot-select/tree/34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
h_swish
import torch import torch.nn as nn import torch.nn.functional as F class h_swish(nn.Module): def __init__(self, inplace=True): super(h_swish, self).__init__() self.inplace = inplace def forward(self, x): out = F.relu6(x + 3.0, inplace=self.inplace) / 6.0 return out * x 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DandelionLau/NetworkCollections
h_swish
false
17,206
[ "Apache-2.0" ]
8
29e5cd2091f7085b3241209ed9447f2baadbce41
https://github.com/DandelionLau/NetworkCollections/tree/29e5cd2091f7085b3241209ed9447f2baadbce41
Net1
import torch import torch.nn.functional as F from torch import nn class Net1(nn.Module): def __init__(self): super(Net1, self).__init__() self.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=0) self.pool1 = nn.MaxPool2d(kernel_size=3, stride=2) self.conv2 = nn.Conv2d(64,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
DPBayes/DP-cross-silo-federated-learning
Net1
false
17,207
[ "Apache-2.0" ]
8
6707db703de5fae48c06116ae8ceee0685c9615d
https://github.com/DPBayes/DP-cross-silo-federated-learning/tree/6707db703de5fae48c06116ae8ceee0685c9615d
Upsample
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch._utils class Upsample(nn.Module): def __init__(self, stride=2): super(Upsample, self).__init__() self.stride = stride def forward(self, x): stride = self.stride assert ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch._utils assert_size_stride = torch._C._dynamo....
DatatangAILAB/SuanFaShiXun04
Upsample
false
17,209
[ "Apache-2.0" ]
5
f478e40dd84240ac71cbb54e6bacf9ff556fbb3e
https://github.com/DatatangAILAB/SuanFaShiXun04/tree/f478e40dd84240ac71cbb54e6bacf9ff556fbb3e
PatchEmbed
import torch import torch.nn as nn class PatchEmbed(nn.Module): """ Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() num_patches = img_size // patch_size * (img_size // patch_size) self.img_size = img_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Curli-quan/fewshot-select
PatchEmbed
false
17,210
[ "Apache-2.0" ]
7
34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
https://github.com/Curli-quan/fewshot-select/tree/34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
ExtResNetBlock
import torch from torch.nn import functional as F import torch.nn as nn def padding(im, patch_size, fill_value=0): H, W = im.size(2), im.size(3) pad_h, pad_w = 0, 0 if H % patch_size > 0: pad_h = patch_size - H % patch_size if W % patch_size > 0: pad_w = patch_size - W % patch_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.triton_helpers import libdevice from torch.nn impor...
Curli-quan/fewshot-select
ExtResNetBlock
false
17,211
[ "Apache-2.0" ]
7
34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
https://github.com/Curli-quan/fewshot-select/tree/34f8ce5069ed1fbd01c1fa73a3ef264c98dadafe
HardSwish
import torch import torch.nn as nn class HardSwish(nn.Module): def __init__(self, inplace=False): super(HardSwish, self).__init__() self.act = nn.ReLU6(inplace) """forward""" def forward(self, x): return x * self.act(x + 3) / 6 def get_inputs(): return [torch.rand([4, 4, 4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
DetectionBLWX/WSDDN.pytorch
HardSwish
false
17,212
[ "MIT" ]
7
05020d9d0445af90ba0af3f095aa12b18e3da7d2
https://github.com/DetectionBLWX/WSDDN.pytorch/tree/05020d9d0445af90ba0af3f095aa12b18e3da7d2
ReverseMaskConv
import math import torch from torch import nn from torch.nn.parameter import Parameter def weights_init(init_type='gaussian'): def init_fun(m): classname = m.__class__.__name__ if (classname.find('Conv') == 0 or classname.find('Linear') == 0 ) and hasattr(m, 'weight'): if ...
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....
DLwbm123/LBAM_inpainting
ReverseMaskConv
false
17,213
[ "MIT" ]
7
c809c3cedf09cda7c175e930c7834ac39d8f526f
https://github.com/DLwbm123/LBAM_inpainting/tree/c809c3cedf09cda7c175e930c7834ac39d8f526f
ReOrgLayer
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch._utils class ReOrgLayer(nn.Module): def __init__(self, stride=2): super(ReOrgLayer, self).__init__() self.stride = stride def forward(self, x): assert x.data.dim() == 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 import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch._utils assert_size_stride = torch._C._dynamo....
DatatangAILAB/SuanFaShiXun04
ReOrgLayer
false
17,214
[ "Apache-2.0" ]
5
f478e40dd84240ac71cbb54e6bacf9ff556fbb3e
https://github.com/DatatangAILAB/SuanFaShiXun04/tree/f478e40dd84240ac71cbb54e6bacf9ff556fbb3e
Net
import torch import torch.nn.functional as F import torch.nn as nn class Net(nn.Module): def __init__(self, x_d, w_d, out_d, hidden_d1=256, hidden_d2=512, hidden_d3=256, is_discrete_input=False, is_discrete_output=False, embedding_dim=None): super().__init__() self._x_d = 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 import torch.nn as nn assert_...
DataCanvasIO/YLearn
Net
false
17,215
[ "Apache-2.0" ]
3
d65b5afb83deed154c710de9096317165d95014a
https://github.com/DataCanvasIO/YLearn/tree/d65b5afb83deed154c710de9096317165d95014a