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
CharbonnierLoss
import torch import torch.utils.data import torch.nn as nn import torch.nn class CharbonnierLoss(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=0.001): super(CharbonnierLoss, self).__init__() self.eps = eps def forward(self, x, y): diff = x - y loss = torc...
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.utils.data impo...
IceClear/MW-GAN
CharbonnierLoss
false
8,288
[ "MIT" ]
36
acb962468c984681c4a21f7b5c14588ca8f58c00
https://github.com/IceClear/MW-GAN/tree/acb962468c984681c4a21f7b5c14588ca8f58c00
Transform
import torch import torch.nn as nn def calc_mean_std(feat, eps=1e-05): size = feat.size() assert len(size) == 4 N, C = size[:2] feat_var = feat.view(N, C, -1).var(dim=2) + eps feat_std = feat_var.sqrt().view(N, C, 1, 1) feat_mean = feat.view(N, C, -1).mean(dim=2).view(N, C, 1, 1) return fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
HalbertCH/IEContraAST
Transform
false
8,289
[ "MIT" ]
39
50ee949f5302a7e4a3cae3226610c03462093c21
https://github.com/HalbertCH/IEContraAST/tree/50ee949f5302a7e4a3cae3226610c03462093c21
EuclideanLoss
import torch import torch.nn as nn class EuclideanLoss(nn.Module): def __init__(self): super(EuclideanLoss, self).__init__() def forward(self, pre, gt): N = pre.shape[0] diff = torch.sum((pre - gt).pow(2)) / (N * 2) return diff def get_inputs(): return [torch.rand([4, 4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
IndigoPurple/EFENet
EuclideanLoss
false
8,290
[ "MIT" ]
11
e88234486f19534274a0a20badc251788ac67e31
https://github.com/IndigoPurple/EFENet/tree/e88234486f19534274a0a20badc251788ac67e31
loss_Textures
import torch import torch.utils.data import torch.nn as nn import torch.nn class loss_Textures(nn.Module): def __init__(self, nc=1, alpha=1.2, margin=0): super(loss_Textures, self).__init__() self.nc = nc self.alpha = alpha self.margin = margin def forward(self, x, y): ...
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.nn assert_size_stride = torch....
IceClear/MW-GAN
loss_Textures
false
8,291
[ "MIT" ]
36
acb962468c984681c4a21f7b5c14588ca8f58c00
https://github.com/IceClear/MW-GAN/tree/acb962468c984681c4a21f7b5c14588ca8f58c00
BilinearMatrixAttention
import torch import torch.nn as nn class BilinearMatrixAttention(nn.Module): """ Adopted from AllenNLP. For now there is no activation function """ def __init__(self, matrix_1_dim: 'int', matrix_2_dim: 'int', use_input_biases: 'bool'=False, label_dim: 'int'=1) ->None: 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Impavidity/relogic
BilinearMatrixAttention
false
8,292
[ "MIT" ]
24
f647106e143cd603b95b63e06ea530cdd516aefe
https://github.com/Impavidity/relogic/tree/f647106e143cd603b95b63e06ea530cdd516aefe
CharbonnierLoss
import torch import torch.nn as nn class CharbonnierLoss(nn.Module): def __init__(self): super(CharbonnierLoss, self).__init__() def forward(self, pre, gt): N = pre.shape[0] diff = torch.sum(torch.sqrt((pre - gt).pow(2) + 0.001 ** 2)) / N return diff def get_inputs(): r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
IndigoPurple/EFENet
CharbonnierLoss
false
8,293
[ "MIT" ]
11
e88234486f19534274a0a20badc251788ac67e31
https://github.com/IndigoPurple/EFENet/tree/e88234486f19534274a0a20badc251788ac67e31
ConvLayer
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size: 'int', stride: 'int'): super().__init__() self._conv = nn.Conv2d(in_channels=in_channels, out_channels= out_channels, kernel_size=kernel_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 math as tl_math import torch....
Inkln/StyleTransferWithCatalyst
ConvLayer
false
8,294
[ "Apache-2.0" ]
11
c3181ecdfd32160907efc2d9d917a55925c25c11
https://github.com/Inkln/StyleTransferWithCatalyst/tree/c3181ecdfd32160907efc2d9d917a55925c25c11
HardMish
import torch from torch import nn as nn def hard_mish(x, inplace: 'bool'=False): """ Hard Mish Experimental, based on notes by Mish author Diganta Misra at https://github.com/digantamisra98/H-Mish/blob/0da20d4bc58e696b6803f2523c58d3c8a82782d0/README.md """ if inplace: return x.mul_(0.5 *...
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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
JDAI-CV/CoTNet-ObjectDetection-InstanceSegmentation
HardMish
false
8,295
[ "Apache-2.0" ]
34
2a546ef946989fc5bac8d819b3c93a9fdc83f241
https://github.com/JDAI-CV/CoTNet-ObjectDetection-InstanceSegmentation/tree/2a546ef946989fc5bac8d819b3c93a9fdc83f241
SpatialPyramidPooling
import torch import torch.nn as nn class SpatialPyramidPooling(nn.Module): def __init__(self, pool_sizes=[5, 9, 13]): super(SpatialPyramidPooling, self).__init__() self.maxpools = nn.ModuleList([nn.MaxPool2d(pool_size, 1, pool_size // 2) for pool_size in pool_sizes]) 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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
IDayday/YOLOv4_CAM
SpatialPyramidPooling
false
8,296
[ "Apache-2.0" ]
34
8df61f1c59c197126f0385c1ec1cf65a29a80cec
https://github.com/IDayday/YOLOv4_CAM/tree/8df61f1c59c197126f0385c1ec1cf65a29a80cec
decoder4
import torch from torch import nn class decoder4(nn.Module): def __init__(self): super(decoder4, self).__init__() self.reflecPad11 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv11 = nn.Conv2d(512, 256, 3, 1, 0) self.relu11 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingN...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Holmes-Alan/RefVAE
decoder4
false
8,297
[ "MIT" ]
13
836b8f1168f1b0f923b609a48e202ace7806f79c
https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c
Normalization
import torch import torch.nn as nn class Normalization(nn.Module): def __init__(self): super(Normalization, self).__init__() self.mean = nn.Parameter(torch.tensor([0.485, 0.456, 0.406]).view(- 1, 1, 1)) self.std = nn.Parameter(torch.tensor([0.329, 0.224, 0.225]).view(-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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Inkln/StyleTransferWithCatalyst
Normalization
false
8,298
[ "Apache-2.0" ]
11
c3181ecdfd32160907efc2d9d917a55925c25c11
https://github.com/Inkln/StyleTransferWithCatalyst/tree/c3181ecdfd32160907efc2d9d917a55925c25c11
GroupNorm32
import torch import torch.nn.functional as F from torch import nn class GroupNorm32(nn.GroupNorm): def __init__(self, num_groups, num_channels, swish, eps=1e-05): super().__init__(num_groups=num_groups, num_channels=num_channels, eps=eps) self.swish = swish 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Jack000/glid-3
GroupNorm32
false
8,299
[ "MIT" ]
31
4a18efc2785339ebc743e149a7955e34fff436fb
https://github.com/Jack000/glid-3/tree/4a18efc2785339ebc743e149a7955e34fff436fb
ImageGradients
import torch import torch as th import torch.utils.data class ImageGradients(th.nn.Module): """ Args: c_in(int): number of channels expected in the images. use_sobel(bool): if True, uses a (smoother) Sobel filter instead of simple finite differences. """ def __init__(self, c_in, use_sobel=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 import torch as th import torch.utils.data assert_size_stride = torch._C._dynamo...
IlyaBizyaev/ttools
ImageGradients
false
8,300
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
decoder3
import torch from torch import 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.UpsamplingNear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Holmes-Alan/RefVAE
decoder3
false
8,301
[ "MIT" ]
13
836b8f1168f1b0f923b609a48e202ace7806f79c
https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c
CMMD
import torch import torch.nn as nn import torch.nn.functional as F class CMMD(nn.Module): def __init__(self, num_pos): super(CMMD, self).__init__() self.num_pos = num_pos def forward(self, feat_v, feat_t): feat_v = feat_v.view(feat_v.size(0), -1) feat_v = F.normalize(feat_v, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
JDAI-CV/CM-NAS
CMMD
false
8,302
[ "Apache-2.0" ]
31
bbc77f427b2c8afb9f3865f5a04e86079d33dd28
https://github.com/JDAI-CV/CM-NAS/tree/bbc77f427b2c8afb9f3865f5a04e86079d33dd28
qy
import torch import torch.nn as nn import torch.nn.functional as F def weights_init(m): if isinstance(m, nn.Conv2d): nn.init.kaiming_uniform_(m.weight, a=0, mode='fan_in', nonlinearity ='leaky_relu') try: nn.init.constant_(m.bias, 0.01) except: pass ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
IamWangYunKai/DG-TrajGen
qy
false
8,303
[ "MIT" ]
31
0a8aab7e1c05111a5afe43d53801c55942e9ff56
https://github.com/IamWangYunKai/DG-TrajGen/tree/0a8aab7e1c05111a5afe43d53801c55942e9ff56
decoder6
import torch from torch import nn class decoder6(nn.Module): def __init__(self): super(decoder6, self).__init__() self.reflecPad11 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv11 = nn.Conv2d(512, 256, 3, 1, 0) self.relu11 = nn.ReLU(inplace=True) self.unpool1 = nn.ConvTransp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Holmes-Alan/RefVAE
decoder6
false
8,304
[ "MIT" ]
13
836b8f1168f1b0f923b609a48e202ace7806f79c
https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c
SP
import torch import torch.nn as nn import torch.nn.functional as F class SP(nn.Module): def __init__(self): super(SP, self).__init__() def forward(self, feat_v, feat_t): feat_v = feat_v.view(feat_v.size(0), -1) G_v = torch.mm(feat_v, feat_v.t()) norm_G_v = F.normalize(G_v, p=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JDAI-CV/CM-NAS
SP
false
8,305
[ "Apache-2.0" ]
31
bbc77f427b2c8afb9f3865f5a04e86079d33dd28
https://github.com/JDAI-CV/CM-NAS/tree/bbc77f427b2c8afb9f3865f5a04e86079d33dd28
PSNR
import torch import torch as th import torch.utils.data class PSNR(th.nn.Module): def __init__(self): super(PSNR, self).__init__() self.mse = th.nn.MSELoss() def forward(self, out, ref): mse = self.mse(out, ref) return -10 * th.log10(mse + 1e-12) def get_inputs(): retur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch as th import to...
IlyaBizyaev/ttools
PSNR
false
8,306
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
BicubicUpsampler
import torch import torch as th import torch.utils.data class BicubicUpsampler(th.nn.Module): def __init__(self, scale=2, channels=1): super(BicubicUpsampler, self).__init__() ksize = 2 * scale * 2 total_pad = ksize - scale // 2 if scale % 2 == 1: ksize += 1 se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch as th import torch.utils.data assert_size_stride = torch._C._dynamo...
IlyaBizyaev/ttools
BicubicUpsampler
false
8,307
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
FCChain
import torch import torch.utils.data import torch.nn as nn def _get_activation(activation): valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid'] assert activation in valid, 'activation should be one of {}'.format(valid) if activation == 'relu': return nn.ReLU(inplace=True) if activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
IlyaBizyaev/ttools
FCChain
false
8,308
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
TransformerEncoderPostNormLayer
import torch import torch.nn.functional as F from torch import nn from typing import Optional from torch.nn import LayerNorm def _get_activation_fn(activation): if activation == 'relu': return F.relu elif activation == 'gelu': return F.gelu raise RuntimeError('activation should be relu/gel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JDBumgardner/stone_ground_hearth_battles
TransformerEncoderPostNormLayer
false
8,309
[ "Apache-2.0" ]
20
9fe095651fab60e8ddbf563f0b9b7f3e723d5f4f
https://github.com/JDBumgardner/stone_ground_hearth_battles/tree/9fe095651fab60e8ddbf563f0b9b7f3e723d5f4f
ResidualAttentionBlock
import torch from collections import OrderedDict from torch import nn class LayerNorm(nn.LayerNorm): """Subclass torch's LayerNorm to handle fp16.""" def forward(self, x: 'torch.Tensor'): orig_type = x.dtype ret = super().forward(x.type(torch.float32)) return ret.type(orig_type) cla...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Jack000/glid-3
ResidualAttentionBlock
false
8,310
[ "MIT" ]
31
4a18efc2785339ebc743e149a7955e34fff436fb
https://github.com/Jack000/glid-3/tree/4a18efc2785339ebc743e149a7955e34fff436fb
StyleLossBlock
import torch import torch.nn as nn import torch.nn.functional as F class StyleLossBlock(nn.Module): def __init__(self, target: 'torch.Tensor'): super().__init__() self.stored_value = None self._loss = F.mse_loss self.shape = target.shape self._target_gram_matrix = nn.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 import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
Inkln/StyleTransferWithCatalyst
StyleLossBlock
false
8,311
[ "Apache-2.0" ]
11
c3181ecdfd32160907efc2d9d917a55925c25c11
https://github.com/Inkln/StyleTransferWithCatalyst/tree/c3181ecdfd32160907efc2d9d917a55925c25c11
BilinearUpsampler
import torch import torch as th import torch.utils.data class BilinearUpsampler(th.nn.Module): def __init__(self, scale=2, channels=1): super(BilinearUpsampler, self).__init__() ksize = 2 * scale total_pad = ksize - scale // 2 if scale % 2 == 1: ksize += 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 import torch as th import torch.utils.data assert_size_stride = torch._C._dynamo...
IlyaBizyaev/ttools
BilinearUpsampler
false
8,312
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
Conv1dResBlock
import torch import torch.nn as nn class Conv1d(nn.Conv1d): """ Convolution 1d Args: x: (N, T, C_in) Returns: y: (N, T, C_out) """ def __init__(self, in_channels, out_channels, kernel_size, activation_fn=None, drop_rate=0.0, stride=1, padding='same', dilation=1, groups=1, bias=Tr...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Jackson-Kang/VQVC-Pytorch
Conv1dResBlock
false
8,313
[ "MIT" ]
13
d2267b5c52253b6ae11a5767963a65320ae335c2
https://github.com/Jackson-Kang/VQVC-Pytorch/tree/d2267b5c52253b6ae11a5767963a65320ae335c2
DepthwiseSeparableConv
import torch import torch.nn.functional as F import torch.nn as nn class DepthwiseSeparableConv(nn.Module): """ Depth-wise separable convolution uses less parameters to generate output by convolution. :Examples: >>> m = DepthwiseSeparableConv(300, 200, 5, dim=1) >>> input_tensor = torch.ra...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
IsaacChanghau/ReLoCLNet
DepthwiseSeparableConv
false
8,314
[ "MIT" ]
31
56cb666ce516cce9acbcfce78fb4e95d81e11e54
https://github.com/IsaacChanghau/ReLoCLNet/tree/56cb666ce516cce9acbcfce78fb4e95d81e11e54
NormalDivLoss
import torch import torch.nn as nn def fuzzyDist(x, a=0.1, b=2): return 1 / (1 + (x / a).abs().pow(2 * b)) class SoftHist(nn.Module): def __init__(self, bins, dist): super(SoftHist, self).__init__() bins[1] - bins[0] self.bins = nn.Parameter(bins.unsqueeze(1)) self.dist = di...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
JWHan717/CS492I-Project
NormalDivLoss
false
8,315
[ "MIT" ]
23
5da80bc41425ee90711a3de89c5501b5f7acd4b7
https://github.com/JWHan717/CS492I-Project/tree/5da80bc41425ee90711a3de89c5501b5f7acd4b7
ConvEncoder
import torch import torch.nn.functional as F import torch.nn as nn class DepthwiseSeparableConv(nn.Module): """ Depth-wise separable convolution uses less parameters to generate output by convolution. :Examples: >>> m = DepthwiseSeparableConv(300, 200, 5, dim=1) >>> input_tensor = torch.ra...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IsaacChanghau/ReLoCLNet
ConvEncoder
false
8,316
[ "MIT" ]
31
56cb666ce516cce9acbcfce78fb4e95d81e11e54
https://github.com/IsaacChanghau/ReLoCLNet/tree/56cb666ce516cce9acbcfce78fb4e95d81e11e54
ConvChain
import torch import torch.utils.data import torch.nn as nn def _get_activation(activation): valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid'] assert activation in valid, 'activation should be one of {}'.format(valid) if activation == 'relu': return nn.ReLU(inplace=True) if activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
IlyaBizyaev/ttools
ConvChain
false
8,317
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
Conv1d
import torch import torch.nn as nn class Conv1d(nn.Conv1d): """ Convolution 1d Args: x: (N, T, C_in) Returns: y: (N, T, C_out) """ def __init__(self, in_channels, out_channels, kernel_size, activation_fn=None, drop_rate=0.0, stride=1, padding='same', dilation=1, groups=1, bias=Tr...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Jackson-Kang/VQVC-Pytorch
Conv1d
false
8,318
[ "MIT" ]
13
d2267b5c52253b6ae11a5767963a65320ae335c2
https://github.com/Jackson-Kang/VQVC-Pytorch/tree/d2267b5c52253b6ae11a5767963a65320ae335c2
KLLoss
import torch from torch import nn import torch.nn.functional as F from math import sqrt as sqrt from itertools import product as product class KLLoss(nn.Module): """ Kl-loss function for bounding box regression from CVPR 2019 paper: Bounding Box Regression with Uncertainty for Accurate Object Detection ...
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...
JappaB/Active_Learning_Object_Detection
KLLoss
false
8,319
[ "MIT" ]
21
3d9ad367aa872cbf3e9d71c566042c78fe2d0e76
https://github.com/JappaB/Active_Learning_Object_Detection/tree/3d9ad367aa872cbf3e9d71c566042c78fe2d0e76
ResidualBlock
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size: 'int', stride: 'int'): super().__init__() self._conv = nn.Conv2d(in_channels=in_channels, out_channels= out_channels, kernel_size=kernel_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Inkln/StyleTransferWithCatalyst
ResidualBlock
false
8,320
[ "Apache-2.0" ]
11
c3181ecdfd32160907efc2d9d917a55925c25c11
https://github.com/Inkln/StyleTransferWithCatalyst/tree/c3181ecdfd32160907efc2d9d917a55925c25c11
FixupBasicBlock
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class FixupBasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, plane...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
IlanPrice/DCTpS
FixupBasicBlock
false
8,321
[ "MIT" ]
12
e3219ac132959f484724e0d0bd48a0cb8af3d0fa
https://github.com/IlanPrice/DCTpS/tree/e3219ac132959f484724e0d0bd48a0cb8af3d0fa
TrainablePositionalEncoding
import torch import torch.nn as nn class TrainablePositionalEncoding(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, max_position_embeddings, hidden_size, dropout=0.1): super(TrainablePositionalEncoding, self).__init__() self.positi...
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_...
IsaacChanghau/ReLoCLNet
TrainablePositionalEncoding
false
8,322
[ "MIT" ]
31
56cb666ce516cce9acbcfce78fb4e95d81e11e54
https://github.com/IsaacChanghau/ReLoCLNet/tree/56cb666ce516cce9acbcfce78fb4e95d81e11e54
FixupResidualChain
import torch import numpy as np import torch as th import torch.utils.data import torch.nn as nn from collections import OrderedDict def _get_activation(activation): valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid'] assert activation in valid, 'activation should be one of {}'.format(valid) if act...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
IlyaBizyaev/ttools
FixupResidualChain
false
8,323
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
WeightedSmoothL1Loss
import torch import numpy as np import torch.nn as nn class WeightedSmoothL1Loss(nn.Module): """ Code-wise Weighted Smooth L1 Loss modified based on fvcore.nn.smooth_l1_loss https://github.com/facebookresearch/fvcore/blob/master/fvcore/nn/smooth_l1_loss.py | 0.5 * x ** 2 / beta if abs(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn assert_size_stride = ...
Jasonkks/mlcnet
WeightedSmoothL1Loss
false
8,324
[ "Apache-2.0" ]
18
8f89c860c709733c8baa663607004fc48d76291d
https://github.com/Jasonkks/mlcnet/tree/8f89c860c709733c8baa663607004fc48d76291d
h_swish
import torch import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 class h_swish(nn.Module): def __init__(self, inplace=True)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
JaminFong/dali-pytorch
h_swish
false
8,325
[ "Apache-2.0" ]
41
7bd5d2380d210a32d24c7309da69c8d2c5db8759
https://github.com/JaminFong/dali-pytorch/tree/7bd5d2380d210a32d24c7309da69c8d2c5db8759
injective_pad
import torch import torch.nn as nn class injective_pad(nn.Module): def __init__(self, pad_size): super(injective_pad, self).__init__() self.pad_size = pad_size self.pad = nn.ZeroPad2d((0, 0, 0, pad_size)) def forward(self, x): x = x.permute(0, 2, 1, 3) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
JessieYuW/CrevNet-Traffic4cast
injective_pad
false
8,326
[ "Apache-2.0" ]
13
810b2a951de1f99a07bf8cfcbd93e1fc016cce48
https://github.com/JessieYuW/CrevNet-Traffic4cast/tree/810b2a951de1f99a07bf8cfcbd93e1fc016cce48
GridMixupLoss
import math import random import torch import numpy as np import typing as t from torch import nn class GridMixupLoss(nn.Module): """ Implementation of GridMixup loss :param alpha: Percent of the first image on the crop. Can be float or Tuple[float, float] - if float: lambda parameter get...
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 math import ran...
IlyaDobrynin/GridMixup
GridMixupLoss
false
8,327
[ "MIT" ]
42
11b741f234832c9a15b4e650e1e4fad0e79dc63b
https://github.com/IlyaDobrynin/GridMixup/tree/11b741f234832c9a15b4e650e1e4fad0e79dc63b
DiagonalQuantizer
import torch import numpy as np import torch.cuda import torch.fft def diagonal_quantize_function(x, bit, phase_noise_std=0, random_state=None, gradient_clip=False): class DiagonalQuantizeFunction(torch.autograd.Function): @staticmethod def forward(ctx, x): S_scale = x.abs().max...
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 nump...
JeremieMelo/pytorch-onn
DiagonalQuantizer
false
8,328
[ "MIT" ]
16
670996112277a6c19c7da400afbe0a4ce45ad5de
https://github.com/JeremieMelo/pytorch-onn/tree/670996112277a6c19c7da400afbe0a4ce45ad5de
AffineConstantFlow
import torch from torch import nn class AffineConstantFlow(nn.Module): """ Scales + Shifts the flow by (learned) constants per dimension. In NICE paper there is a Scaling layer which is a special case of this where t is None """ def __init__(self, dim, scale=True, shift=True): super().__...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
JannerM/gamma-models
AffineConstantFlow
false
8,329
[ "MIT" ]
32
4b40d828bf228385c3081d359cdc3494d70de4a1
https://github.com/JannerM/gamma-models/tree/4b40d828bf228385c3081d359cdc3494d70de4a1
SqueezeExcite
import torch from torchvision.transforms import functional as F import torch.nn as nn import torch.nn.functional as F def _make_divisible(v, divisor, min_value=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 torchvision.transforms i...
JaminFong/dali-pytorch
SqueezeExcite
false
8,330
[ "Apache-2.0" ]
41
7bd5d2380d210a32d24c7309da69c8d2c5db8759
https://github.com/JaminFong/dali-pytorch/tree/7bd5d2380d210a32d24c7309da69c8d2c5db8759
Upsample
import torch import torch.nn as nn class Upsample(nn.Upsample): """ Upsampling via interporlation Args: x: (N, T, C) Returns: y: (N, S * T, C) (S: scale_factor) """ def __init__(self, scale_factor=2, mode='nearest'): super(Upsample, self).__init__(scale_factor=scale_factor, mode=mo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Jackson-Kang/VQVC-Pytorch
Upsample
false
8,331
[ "MIT" ]
13
d2267b5c52253b6ae11a5767963a65320ae335c2
https://github.com/Jackson-Kang/VQVC-Pytorch/tree/d2267b5c52253b6ae11a5767963a65320ae335c2
GraphConvolution
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn import Parameter 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, drop_prob, shared_axes=[], training=False): """ App...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 i...
IBM/graph4nlp
GraphConvolution
false
8,332
[ "Apache-2.0" ]
18
a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
https://github.com/IBM/graph4nlp/tree/a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
Context2AnswerAttention
import torch from torch import nn 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.Linear(dim, hidden_size, bias=False) def forward(self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IBM/graph4nlp
Context2AnswerAttention
false
8,333
[ "Apache-2.0" ]
18
a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
https://github.com/IBM/graph4nlp/tree/a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
decoder5
import torch from torch import nn class decoder5(nn.Module): def __init__(self): super(decoder5, self).__init__() self.reflecPad15 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv15 = nn.Conv2d(512, 512, 3, 1, 0) self.relu15 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingN...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Holmes-Alan/RefVAE
decoder5
false
8,334
[ "MIT" ]
13
836b8f1168f1b0f923b609a48e202ace7806f79c
https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c
LxmertAttentionOutput
import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel class LxmertAttentionOutput(nn.Module): def __init__(self, hidden_size, hidden_dropout_prob): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.LayerNorm = nn.LayerNorm(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
IsmaelElsharkawi/new_pororo_repo
LxmertAttentionOutput
false
8,335
[ "MIT" ]
19
4617083b420615b8a3eb0f44d02e4e91a8f407f7
https://github.com/IsmaelElsharkawi/new_pororo_repo/tree/4617083b420615b8a3eb0f44d02e4e91a8f407f7
MixActiv
import torch import torch as th from torch import nn def gauss(x, mean=0, std=1): return th.exp(-(x - mean) ** 2 / (2 * std ** 2)) class MixActiv(nn.Module): def __init__(self): super().__init__() self.activations = th.sin, th.tanh, gauss, th.relu self.n_activs = len(self.activation...
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...
JiangZehua/control-pcgrl
MixActiv
false
8,336
[ "MIT" ]
15
e4fd1bf9670e5855f04941ebca34170517c451b4
https://github.com/JiangZehua/control-pcgrl/tree/e4fd1bf9670e5855f04941ebca34170517c451b4
ClassPredictor
import torch from torch import nn class ClassPredictor(nn.Module): def __init__(self, nz_feat, max_object_classes): super(ClassPredictor, self).__init__() self.predictor = nn.Linear(nz_feat, max_object_classes) def forward(self, feats): class_logits = self.predictor(feats) re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JasonQSY/Associative3D
ClassPredictor
false
8,337
[ "MIT" ]
25
c50818b593ec48c38ed7ee3e109c23531089da32
https://github.com/JasonQSY/Associative3D/tree/c50818b593ec48c38ed7ee3e109c23531089da32
InnerProductDecoder
import torch from torch import nn import torch.nn.functional as F import torch.nn.modules.loss from scipy.sparse import * def dropout(x, drop_prob, shared_axes=[], training=False): """ Apply dropout to input tensor. Parameters ---------- input_tensor: ``torch.FloatTensor`` A tensor of shap...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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.modules.loss from scipy.sparse import * ass...
IBM/graph4nlp
InnerProductDecoder
false
8,338
[ "Apache-2.0" ]
18
a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
https://github.com/IBM/graph4nlp/tree/a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
GRUStep
import torch from torch import nn 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(hidden_size + input_size, hidden_size, bi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
IBM/graph4nlp
GRUStep
false
8,339
[ "Apache-2.0" ]
18
a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
https://github.com/IBM/graph4nlp/tree/a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
ScalePredictor
import torch from torch import nn class ScalePredictor(nn.Module): def __init__(self, nz): super(ScalePredictor, self).__init__() self.pred_layer = nn.Linear(nz, 3) def forward(self, feat): scale = self.pred_layer.forward(feat) + 1 scale = torch.nn.functional.relu(scale) + 1e...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
JasonQSY/Associative3D
ScalePredictor
false
8,340
[ "MIT" ]
25
c50818b593ec48c38ed7ee3e109c23531089da32
https://github.com/JasonQSY/Associative3D/tree/c50818b593ec48c38ed7ee3e109c23531089da32
CombinedTargetMSELoss
import torch import torch.nn as nn class CombinedTargetMSELoss(nn.Module): """MSE loss for combined target. CombinedTarget: The combination of classification target (response map) and regression target (offset map). Paper ref: Huang et al. The Devil is in the Details: Delving into ...
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...
Jackqu/mmpose
CombinedTargetMSELoss
false
8,341
[ "Apache-2.0" ]
38
ad8acc5ff5da7993c6befdc4b1ced2c2ecb64533
https://github.com/Jackqu/mmpose/tree/ad8acc5ff5da7993c6befdc4b1ced2c2ecb64533
RelativeScalePredictor
import torch from torch import nn class RelativeScalePredictor(nn.Module): def __init__(self, in_size, out_size): super(RelativeScalePredictor, self).__init__() self.predictor = nn.Linear(in_size, out_size) def forward(self, feat): predictions = self.predictor.forward(feat) + 1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JasonQSY/Associative3D
RelativeScalePredictor
false
8,342
[ "MIT" ]
25
c50818b593ec48c38ed7ee3e109c23531089da32
https://github.com/JasonQSY/Associative3D/tree/c50818b593ec48c38ed7ee3e109c23531089da32
UpSample
import torch import torch.nn as nn import torch.nn.functional as F class UpSample(nn.Sequential): def __init__(self, skip_input, output_features): super(UpSample, self).__init__() self.convA = nn.Conv2d(skip_input, output_features, kernel_size=3, stride=1, padding=1) self.leak...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
JanRocketMan/regression-prior-networks
UpSample
false
8,343
[ "MIT" ]
24
3c8ffa758ee6eaa15b8afe31ac1c03f87bbf6a14
https://github.com/JanRocketMan/regression-prior-networks/tree/3c8ffa758ee6eaa15b8afe31ac1c03f87bbf6a14
BasicConv2d
import torch import torch.nn as nn import torch.nn.functional as F class BasicConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, **kwargs): super(BasicConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, bias= False, **kwarg...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
JinkaiZheng/TraND
BasicConv2d
false
8,344
[ "MIT" ]
33
a8babc34073ee126789969bd97e149bae4015953
https://github.com/JinkaiZheng/TraND/tree/a8babc34073ee126789969bd97e149bae4015953
TransNonlinear
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class TransNonlinear(nn.Module): def __init__(self, d_model, dim_feedforward, dropout=0.1): super().__init__() self.linear1 = nn.Linear(d_model, dim_feedforward) self.dropout = nn.Dropout(dropout) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Jasonkks/PTTR
TransNonlinear
false
8,345
[ "Apache-2.0" ]
14
11f664a7f1b2281293d82a5450fdd3d4bfa5883e
https://github.com/Jasonkks/PTTR/tree/11f664a7f1b2281293d82a5450fdd3d4bfa5883e
LxmertAttention
import math import torch import torch.utils.data import torch.nn as nn import torch import torch.nn.parallel class LxmertAttention(nn.Module): def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, ctx_dim=None): super().__init__() if hidden_size % num_attentio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IsmaelElsharkawi/new_pororo_repo
LxmertAttention
false
8,346
[ "MIT" ]
19
4617083b420615b8a3eb0f44d02e4e91a8f407f7
https://github.com/IsmaelElsharkawi/new_pororo_repo/tree/4617083b420615b8a3eb0f44d02e4e91a8f407f7
Downsample
import torch class Downsample(torch.nn.Module): def __init__(self, s, use_max=False, batch_mode=False): super(Downsample, self).__init__() self.batch_mode = batch_mode if use_max: layer = torch.nn.MaxPool3d(s, stride=s) else: layer = torch.nn.Conv3d(1, 1, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride reinterpret_tens...
JasonQSY/Associative3D
Downsample
false
8,347
[ "MIT" ]
25
c50818b593ec48c38ed7ee3e109c23531089da32
https://github.com/JasonQSY/Associative3D/tree/c50818b593ec48c38ed7ee3e109c23531089da32
MeanEmbedding
import torch from torch import nn 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_): """Compute average embeddings. Param...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.nn.modules.loss from scipy.sparse import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride...
IBM/graph4nlp
MeanEmbedding
false
8,348
[ "Apache-2.0" ]
18
a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
https://github.com/IBM/graph4nlp/tree/a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
GatedFusion
import torch from torch import nn import torch.nn.modules.loss from scipy.sparse import * class GatedFusion(nn.Module): def __init__(self, hidden_size): super(GatedFusion, self).__init__() """GatedFusion module""" self.fc_z = nn.Linear(4 * hidden_size, hidden_size, bias=True) def for...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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.modules.loss from scipy.sparse import * ass...
IBM/graph4nlp
GatedFusion
false
8,349
[ "Apache-2.0" ]
18
a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
https://github.com/IBM/graph4nlp/tree/a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
IDPredictor
import torch import torch.nn.functional as F from torch import nn class IDPredictor(nn.Module): def __init__(self, nz_feat, n_dim=5): super(IDPredictor, self).__init__() self.pred_layer = nn.Linear(nz_feat, 256) self.sc_layer = nn.Linear(256, 128) self.sc_layer2 = nn.Linear(128, 6...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
JasonQSY/Associative3D
IDPredictor
false
8,350
[ "MIT" ]
25
c50818b593ec48c38ed7ee3e109c23531089da32
https://github.com/JasonQSY/Associative3D/tree/c50818b593ec48c38ed7ee3e109c23531089da32
ConvModule
import torch import torch.utils.data import torch.nn as nn def _get_activation(activation): valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid'] assert activation in valid, 'activation should be one of {}'.format(valid) if activation == 'relu': return nn.ReLU(inplace=True) if activation ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dyn...
IlyaBizyaev/ttools
ConvModule
false
8,351
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
Normalize
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class Normalize(nn.Module): def __init__(self, p=2): super(Normalize, self).__init__() self.p = p def forward(self, x): return F.normalize(x, p=self.p, dim=1) def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
JindongGu/SimDis
Normalize
false
8,352
[ "MIT" ]
12
0871a217a756acc268f35f802e35b01b12817f0d
https://github.com/JindongGu/SimDis/tree/0871a217a756acc268f35f802e35b01b12817f0d
MultiHeadAttn
import torch import torch.nn.functional as F from torch import nn class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_model = d_model self.d_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JasonBenn/duet
MultiHeadAttn
false
8,353
[ "Apache-2.0" ]
11
0d6f1f66fad097023b022f2a361a1587d0f740ba
https://github.com/JasonBenn/duet/tree/0d6f1f66fad097023b022f2a361a1587d0f740ba
PositionalWiseFeedForward
import math import torch import torch.nn as nn class GELU(nn.Module): """ This is a smoother version of the RELU. Original paper: https://arxiv.org/abs/1606.08415 """ def forward(self, x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(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....
JiaweiSheng/FAAN
PositionalWiseFeedForward
false
8,354
[ "MIT" ]
41
b439b829506c4e2e9044a6b2ab7f3d844f445a95
https://github.com/JiaweiSheng/FAAN/tree/b439b829506c4e2e9044a6b2ab7f3d844f445a95
SelfAttention
import torch from torch import nn import torch.nn.modules.loss from scipy.sparse import * class SelfAttention(nn.Module): def __init__(self, input_size, hidden_size): super(SelfAttention, self).__init__() self.W1 = torch.Tensor(input_size, hidden_size) self.W1 = nn.Parameter(nn.init.xavie...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
IBM/graph4nlp
SelfAttention
false
8,355
[ "Apache-2.0" ]
18
a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
https://github.com/IBM/graph4nlp/tree/a9bf20b23fa1ec368d9bd40cc8c557f86a9f8297
ScaledDotProductAttention
import torch import numpy as np import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, attn_dropout=0.0): super(ScaledDotProductAttention, self).__init__() self.dropout = nn.Dropout(attn_dropout) self.softmax = 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....
JiaweiSheng/FAAN
ScaledDotProductAttention
false
8,356
[ "MIT" ]
41
b439b829506c4e2e9044a6b2ab7f3d844f445a95
https://github.com/JiaweiSheng/FAAN/tree/b439b829506c4e2e9044a6b2ab7f3d844f445a95
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, input_dim, output_dim, hidden_dim=128): """ 初始化q网络,为全连接网络 input_dim: 输入的特征数即环境的状态维度 output_dim: 输出的动作维度 """ super(MLP, 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 assert_...
JohnJim0816/rl-tutorials
MLP
false
8,357
[ "MIT" ]
16
e99daea815da85f9f25dff2d01b030249a203d22
https://github.com/JohnJim0816/rl-tutorials/tree/e99daea815da85f9f25dff2d01b030249a203d22
FixupBasicBlock
import torch import torch as th import torch.utils.data import torch.nn as nn def _get_activation(activation): valid = ['relu', 'leaky_relu', 'lrelu', 'tanh', 'sigmoid'] assert activation in valid, 'activation should be one of {}'.format(valid) if activation == 'relu': return nn.ReLU(inplace=True)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch as th import tor...
IlyaBizyaev/ttools
FixupBasicBlock
false
8,358
[ "MIT" ]
11
b1435b19f397ce1baff9daed3cb287e52a029fdb
https://github.com/IlyaBizyaev/ttools/tree/b1435b19f397ce1baff9daed3cb287e52a029fdb
LabelPredictor
import torch from torch import nn class LabelPredictor(nn.Module): def __init__(self, nz_feat, classify_rot=True): super(LabelPredictor, self).__init__() self.pred_layer = nn.Linear(nz_feat, 1) def forward(self, feat): pred = self.pred_layer.forward(feat) pred = torch.sigmoid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
JasonQSY/Associative3D
LabelPredictor
false
8,359
[ "MIT" ]
25
c50818b593ec48c38ed7ee3e109c23531089da32
https://github.com/JasonQSY/Associative3D/tree/c50818b593ec48c38ed7ee3e109c23531089da32
MultimodalHead
import torch from torch import nn class MultimodalHead(nn.Module): """ Multimodal head for the conv net outputs. This layer concatenate the outputs of audio and visual convoluational nets and performs a fully-connected projection """ def __init__(self, dim_in, num_classes, dropout_rate=0.0, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JiwanChung/acav100m
MultimodalHead
false
8,360
[ "MIT" ]
27
51cb948d5682da69334a8d05d2df631971b60215
https://github.com/JiwanChung/acav100m/tree/51cb948d5682da69334a8d05d2df631971b60215
CNN_small
import torch import torch.nn as nn from torch.nn import functional as F import torch.utils.data class CNN_small(nn.Module): def __init__(self, num_classes=10): super(CNN_small, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
JiarunLiu/Co-correcting
CNN_small
false
8,361
[ "Apache-2.0" ]
19
4e3ca4951de5d73ca812bbbcfe666273082ff2fd
https://github.com/JiarunLiu/Co-correcting/tree/4e3ca4951de5d73ca812bbbcfe666273082ff2fd
CRFLoss
import torch import torch.nn as nn class CRFLoss(nn.Module): def __init__(self, L, init): super(CRFLoss, self).__init__() self.start = nn.Parameter(torch.Tensor(L).uniform_(-init, init)) self.T = nn.Parameter(torch.Tensor(L, L).uniform_(-init, init)) self.end = nn.Parameter(torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Johannes0Horn/mtl-dts
CRFLoss
false
8,362
[ "MIT" ]
19
ae50253c808bbb77af3b1117f69f08d2268099e9
https://github.com/Johannes0Horn/mtl-dts/tree/ae50253c808bbb77af3b1117f69f08d2268099e9
NonLocalBlock
import torch import torch.nn as nn from time import * class NonLocalBlock(nn.Module): def __init__(self, channel): super(NonLocalBlock, self).__init__() self.inter_channel = channel // 2 self.conv_phi = nn.Conv2d(in_channels=channel, out_channels=self. inter_channel, 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 from torch._inductor.runtime....
Jinming-Su/SGNet
NonLocalBlock
false
8,363
[ "MIT" ]
13
fcf35edaf332c1a4e2713acad5a0fc0e21509c3e
https://github.com/Jinming-Su/SGNet/tree/fcf35edaf332c1a4e2713acad5a0fc0e21509c3e
SoftCrossEntropyLoss
import torch def soft_cross_entropy(logit, label, weight=None, reduce=None, reduction='mean' ): if weight is not None and weight.requires_grad: raise RuntimeError('gradient for weight is not supported') losses = SoftCrossEntropyFunction.apply(logit, label, weight) reduction = {(True): 'mean', ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
Jingkang50/ICCV21_SCOOD
SoftCrossEntropyLoss
false
8,364
[ "MIT" ]
34
51204e3788a9e81aa334611072bef106fd9d13ad
https://github.com/Jingkang50/ICCV21_SCOOD/tree/51204e3788a9e81aa334611072bef106fd9d13ad
MaxPool2dSamePadding
import math import torch import torch.nn as nn import torch.nn.functional as F def get_same_padding(in_size, kernel_size, stride): """'Same 'same' operation with tensorflow notice:padding=(0, 1, 0, 1) and padding=(1, 1, 1, 1) are different padding=(1, 1, 1, 1): out(H, W) = (in + [2 * padding] − k...
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 math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_siz...
Jintao-Huang/EfficientDet_PyTorch
MaxPool2dSamePadding
false
8,365
[ "Apache-2.0" ]
18
79616be397b7f57992cd43b772f65b58b5e25a8b
https://github.com/Jintao-Huang/EfficientDet_PyTorch/tree/79616be397b7f57992cd43b772f65b58b5e25a8b
SoftSelectPrototype
import torch import torch.nn as nn class SoftSelectAttention(nn.Module): def __init__(self, hidden_size): super(SoftSelectAttention, self).__init__() def forward(self, support, query): """ :param support: [few, dim] :param query: [batch, dim] :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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JiaweiSheng/FAAN
SoftSelectPrototype
false
8,366
[ "MIT" ]
41
b439b829506c4e2e9044a6b2ab7f3d844f445a95
https://github.com/JiaweiSheng/FAAN/tree/b439b829506c4e2e9044a6b2ab7f3d844f445a95
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, n_obs, action_dim, hidden_size, init_w=0.003): super(Critic, self).__init__() self.linear1 = nn.Linear(n_obs + action_dim, hidden_size) self.linear2 = nn.Linear(hidden_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 import torch.nn as nn assert_...
JohnJim0816/rl-tutorials
Critic
false
8,367
[ "MIT" ]
16
e99daea815da85f9f25dff2d01b030249a203d22
https://github.com/JohnJim0816/rl-tutorials/tree/e99daea815da85f9f25dff2d01b030249a203d22
GlobalAveragePooling
import torch import torch.nn as nn class GlobalAveragePooling(nn.Module): """Global Average Pooling neck. Note that we use `view` to remove extra channel after pooling. We do not use `squeeze` as it will also remove the batch dimension when the tensor has a batch dimension of size 1, which can lead t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Jackqu/mmpose
GlobalAveragePooling
false
8,368
[ "Apache-2.0" ]
38
ad8acc5ff5da7993c6befdc4b1ced2c2ecb64533
https://github.com/Jackqu/mmpose/tree/ad8acc5ff5da7993c6befdc4b1ced2c2ecb64533
GlobalAttentionGeneral
import torch import torch.nn as nn import torch.nn.parallel class GlobalAttentionGeneral(nn.Module): def __init__(self, idf, cdf): super(GlobalAttentionGeneral, self).__init__() self.sm = nn.Softmax() self.mask = None def applyMask(self, mask): self.mask = mask def forwa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JoonHong-Kim/T2I_CL
GlobalAttentionGeneral
false
8,369
[ "MIT" ]
35
c52aa73da903d6e4174eeef2663e5bc1163785b1
https://github.com/JoonHong-Kim/T2I_CL/tree/c52aa73da903d6e4174eeef2663e5bc1163785b1
PolicyNet
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal class PolicyNet(nn.Module): def __init__(self, state_dim, action_dim, hidden_dim, init_w=0.003, log_std_min=-20, log_std_max=2): super(PolicyNet, self).__init__() self.log_std_min = l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
JohnJim0816/rl-tutorials
PolicyNet
false
8,370
[ "MIT" ]
16
e99daea815da85f9f25dff2d01b030249a203d22
https://github.com/JohnJim0816/rl-tutorials/tree/e99daea815da85f9f25dff2d01b030249a203d22
SE
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class SwishEfficient(torch.autograd.Function): """Swish activation function: x * sigmoid(x).""" @staticmethod def forward(ctx, x): result = x * torch.sigmoid(x) ctx.save_for_backward(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 itertools import chain a...
JaywongWang/SlowFast
SE
false
8,371
[ "Apache-2.0" ]
43
366467aafc856712fdc3e9c4cce8e90969047ee6
https://github.com/JaywongWang/SlowFast/tree/366467aafc856712fdc3e9c4cce8e90969047ee6
WasLoss
import torch import torch.nn as nn class WasLoss(nn.Module): def __init__(self): super(WasLoss, self).__init__() self.MSEls = torch.nn.BCEWithLogitsLoss() def forward(self, true_data, fake_data): SLX, _ = torch.sort(true_data, 0) SLG, _ = torch.sort(fake_data, 0) retu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Johnson-yue/RS-GAN
WasLoss
false
8,372
[ "MIT" ]
26
8e8723045d63d8f9a4b510800cd909e7a6e3d195
https://github.com/Johnson-yue/RS-GAN/tree/8e8723045d63d8f9a4b510800cd909e7a6e3d195
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, n_obs, action_dim, hidden_size, init_w=0.003): super(Actor, self).__init__() self.linear1 = nn.Linear(n_obs, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JohnJim0816/rl-tutorials
Actor
false
8,373
[ "MIT" ]
16
e99daea815da85f9f25dff2d01b030249a203d22
https://github.com/JohnJim0816/rl-tutorials/tree/e99daea815da85f9f25dff2d01b030249a203d22
Mish
import torch import torch.utils.data from torchvision.transforms import functional as F import torch.nn as nn import torch.nn.functional as F from math import sqrt as sqrt from itertools import product as product class Mish(nn.Module): def forward(self, x): return x.mul_(F.softplus(x).tanh()) def get_i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.utils.data import torch.nn as nn from math import...
Het-Shah/Monk_Object_Detection
Mish
false
8,374
[ "Apache-2.0" ]
15
1d7a07193ea3455221caa41d07c33c81d50c6b3f
https://github.com/Het-Shah/Monk_Object_Detection/tree/1d7a07193ea3455221caa41d07c33c81d50c6b3f
AttentionPool2d
import math import torch from torch import nn import torch as th def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: retu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Jack000/glid-3
AttentionPool2d
false
8,375
[ "MIT" ]
31
4a18efc2785339ebc743e149a7955e34fff436fb
https://github.com/Jack000/glid-3/tree/4a18efc2785339ebc743e149a7955e34fff436fb
GaussianKernel
import math import torch import torch.nn as nn import torch.utils.data class GaussianKernel(nn.Module): def __init__(self, delta_var, pmaps_threshold): super().__init__() self.delta_var = delta_var self.two_sigma = delta_var * delta_var / -math.log(pmaps_threshold) def forward(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math import torch.nn as nn import torch.utils.data assert_size_str...
JonasHell/torch-em
GaussianKernel
false
8,376
[ "MIT" ]
13
2e008e0cd2f0ea6681581374fce4f9f47b986d55
https://github.com/JonasHell/torch-em/tree/2e008e0cd2f0ea6681581374fce4f9f47b986d55
Attention
import torch from torch import nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. """ def __init__(self, dim): super(Attention, self).__init__() self.dim = dim self.linear1 = nn.Linear(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....
JiwanChung/tapm
Attention
false
8,377
[ "MIT" ]
14
ec42b139d1c012daccc55f85e67744488d526476
https://github.com/JiwanChung/tapm/tree/ec42b139d1c012daccc55f85e67744488d526476
Net
import torch import torch.nn as nn class Swish(nn.Module): def __init__(self, inplace=True): super(Swish, self).__init__() self.inplace = inplace def forward(self, x): if self.inplace: x.mul_(torch.sigmoid(x)) return x else: return x * torc...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Jianxun-Wang/Physics-constrained-Bayesian-deep-learning
Net
false
8,378
[ "MIT" ]
24
cde0287f848f83c6def1fe409c67d7d4e14174da
https://github.com/Jianxun-Wang/Physics-constrained-Bayesian-deep-learning/tree/cde0287f848f83c6def1fe409c67d7d4e14174da
Block
import torch from torch import nn import torch.nn.functional as F class Block(nn.Module): def __init__(self, dim): super(Block, self).__init__() self.dim = dim self.layer_norm = nn.LayerNorm(self.dim) self.conv = nn.Conv1d(self.dim, self.dim, kernel_size=3, padding=1) def for...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JiwanChung/tapm
Block
false
8,379
[ "MIT" ]
14
ec42b139d1c012daccc55f85e67744488d526476
https://github.com/JiwanChung/tapm/tree/ec42b139d1c012daccc55f85e67744488d526476
RLFeatPreprocessNet
import torch import torch.nn as nn import torch.utils.data class RLFeatPreprocessNet(nn.Module): """ Preprocess Features 1. visual feature 2. label prediction embed feature 3. box embed 4. overlap embed """ def __init__(self, feat_size, embed_size, bbox_size, overlap_size, out...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
KaihuaTang/VCTree-Visual-Question-Answering
RLFeatPreprocessNet
false
8,380
[ "MIT" ]
31
b6b0a8bdb01d45d36de3bded91db42544ad6a593
https://github.com/KaihuaTang/VCTree-Visual-Question-Answering/tree/b6b0a8bdb01d45d36de3bded91db42544ad6a593
ELUPlus
import torch from torch import nn import torch.nn class ELUPlus(nn.Module): def __init__(self): super().__init__() self.elu = nn.ELU() def forward(self, x): return self.elu(x) + 1.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.nn assert_size_stride = torch._C._dynamo.guar...
KailinLi/nflows
ELUPlus
false
8,381
[ "MIT" ]
13
7c07a1d5e510beb681d1b11d6ffda95a086a8153
https://github.com/KailinLi/nflows/tree/7c07a1d5e510beb681d1b11d6ffda95a086a8153
Memory
import torch import torch.nn as nn import torch.nn.parallel class Memory(nn.Module): def __init__(self): super(Memory, self).__init__() self.sm = nn.Softmax() self.mask = None def applyMask(self, mask): self.mask = mask def forward(self, input, context_key, content_value...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JoonHong-Kim/T2I_CL
Memory
false
8,382
[ "MIT" ]
35
c52aa73da903d6e4174eeef2663e5bc1163785b1
https://github.com/JoonHong-Kim/T2I_CL/tree/c52aa73da903d6e4174eeef2663e5bc1163785b1
DiceLossWithLogits
import torch import torch.nn as nn import torch.utils.data def flatten_samples(input_): """ Flattens a tensor or a variable such that the channel axis is first and the sample axis is second. The shapes are transformed as follows: (N, C, H, W) --> (C, N * H * W) (N, C, D, H, W) --> (C, 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
JonasHell/torch-em
DiceLossWithLogits
false
8,383
[ "MIT" ]
13
2e008e0cd2f0ea6681581374fce4f9f47b986d55
https://github.com/JonasHell/torch-em/tree/2e008e0cd2f0ea6681581374fce4f9f47b986d55
ActorNet
import torch import torch.nn as nn class ActorNet(nn.Module): """ Actor Network """ def __init__(self, state_num, action_num, hidden1=256, hidden2=256, hidden3=256): """ :param state_num: number of states :param action_num: number of actions :param hidden1: hidden lay...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Kanaderu/spiking-ddpg-mapless-navigation
ActorNet
false
8,384
[ "MIT" ]
29
2b5e7e67385dee4428b8036bc4ffe95e812b34e0
https://github.com/Kanaderu/spiking-ddpg-mapless-navigation/tree/2b5e7e67385dee4428b8036bc4ffe95e812b34e0
StochasticClassifier
import torch import torch.nn as nn from torch.nn import functional as F class StochasticClassifier(nn.Module): def __init__(self, num_features, num_classes, temp=0.05): super().__init__() self.mu = nn.Parameter(0.01 * torch.randn(num_classes, num_features)) self.sigma = nn.Parameter(torch...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
KaiyangZhou/ssdg-benchmark
StochasticClassifier
false
8,385
[ "MIT" ]
43
aaa48be4f93b77347fbadff649be6b3e0f7a8779
https://github.com/KaiyangZhou/ssdg-benchmark/tree/aaa48be4f93b77347fbadff649be6b3e0f7a8779
Highway
import torch import torch.nn as nn import torch.nn.functional as F class Highway(nn.Module): """Highway network""" def __init__(self, input_size): super(Highway, self).__init__() self.fc1 = nn.Linear(input_size, input_size, bias=True) self.fc2 = nn.Linear(input_size, input_size, bias=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Kailianghu/Character-Aware-Neural-Language-Model
Highway
false
8,386
[ "MIT" ]
35
6bd72ce00a3ac9eb152ba006bdae8a6922e0ad35
https://github.com/Kailianghu/Character-Aware-Neural-Language-Model/tree/6bd72ce00a3ac9eb152ba006bdae8a6922e0ad35
BCEDiceLossWithLogits
import torch import torch.nn as nn import torch.utils.data def flatten_samples(input_): """ Flattens a tensor or a variable such that the channel axis is first and the sample axis is second. The shapes are transformed as follows: (N, C, H, W) --> (C, N * H * W) (N, C, D, H, W) --> (C, 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 libdevice, math as tl_math import torc...
JonasHell/torch-em
BCEDiceLossWithLogits
false
8,387
[ "MIT" ]
13
2e008e0cd2f0ea6681581374fce4f9f47b986d55
https://github.com/JonasHell/torch-em/tree/2e008e0cd2f0ea6681581374fce4f9f47b986d55