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
GHMC
import torch import torch.nn as nn import torch.nn.functional as F def _expand_binary_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero(labels >= 1).squeeze() if inds.numel() > 0: bin_labels[inds, labels[inds] - 1]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
AlphaLFC/mmdetection
GHMC
false
4,849
[ "Apache-2.0" ]
1
45619c5b8aca0ca3e6ddc211210a8946c94694d8
https://github.com/AlphaLFC/mmdetection/tree/45619c5b8aca0ca3e6ddc211210a8946c94694d8
Critic
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
AnKra/deep-reinforcement-learning
Critic
false
4,850
[ "MIT" ]
1
fa906b0a3a21102b5085ce0c934185d2e50c3324
https://github.com/AnKra/deep-reinforcement-learning/tree/fa906b0a3a21102b5085ce0c934185d2e50c3324
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AnKra/deep-reinforcement-learning
Actor
false
4,851
[ "MIT" ]
1
fa906b0a3a21102b5085ce0c934185d2e50c3324
https://github.com/AnKra/deep-reinforcement-learning/tree/fa906b0a3a21102b5085ce0c934185d2e50c3324
Network
import torch import torch.nn as nn class Network(nn.Module): def __init__(self, input_shape, output_shape, n_features, **kwargs): super(Network, self).__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h1 = nn.Linear(n_input, n_features) self._h2 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AmmarFahmy/mushroom-rl
Network
false
4,852
[ "MIT" ]
1
2625ee7f64d5613b3b9fba00f0b7a39fece88ca5
https://github.com/AmmarFahmy/mushroom-rl/tree/2625ee7f64d5613b3b9fba00f0b7a39fece88ca5
SmoothL1Loss
import functools import torch import torch.nn as nn import torch.nn.functional as F 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...
AlphaLFC/mmdetection
SmoothL1Loss
false
4,853
[ "Apache-2.0" ]
1
45619c5b8aca0ca3e6ddc211210a8946c94694d8
https://github.com/AlphaLFC/mmdetection/tree/45619c5b8aca0ca3e6ddc211210a8946c94694d8
outconv
import torch import torch.nn as nn class outconv(nn.Module): def __init__(self, in_ch, out_ch): super(outconv, self).__init__() self.conv = nn.Conv2d(in_ch, out_ch, 1) def forward(self, x): x = self.conv(x) return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AntarSidgi/LiverTumorSegmentation
outconv
false
4,854
[ "MIT" ]
1
9e8b1182541e011dc9f14218276ee9cb736ce479
https://github.com/AntarSidgi/LiverTumorSegmentation/tree/9e8b1182541e011dc9f14218276ee9cb736ce479
CriticNetwork
import torch import torch.nn as nn import torch.nn.functional as F class CriticNetwork(nn.Module): def __init__(self, input_shape, output_shape, **kwargs): super().__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h = nn.Linear(n_input, n_output) nn.ini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
AmmarFahmy/mushroom-rl
CriticNetwork
false
4,855
[ "MIT" ]
1
2625ee7f64d5613b3b9fba00f0b7a39fece88ca5
https://github.com/AmmarFahmy/mushroom-rl/tree/2625ee7f64d5613b3b9fba00f0b7a39fece88ca5
DiceLoss
import collections import torch import warnings from typing import Optional from typing import Union from typing import Any from typing import Callable from typing import Tuple import torch.nn from torch.nn.modules.loss import _Loss from enum import Enum import collections.abc def issequenceiterable(obj: 'Any') ->boo...
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 collections from typing import Optional from typing import Union from typing import Any from typing import Callable from typing impor...
Alxaline/MONAI
DiceLoss
false
4,856
[ "Apache-2.0" ]
1
6b8fdf9db7f13ed7d88d605155a0463840abcbf2
https://github.com/Alxaline/MONAI/tree/6b8fdf9db7f13ed7d88d605155a0463840abcbf2
Sum
import torch import numpy as np import torch.nn.functional as F from torch import nn from torch.autograd import Variable as Variable class Sum(nn.Module): def __init__(self, in_channels, in_features, out_channels, dropout=0.0): """ Create a Sum layer. Args: in_channels (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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn f...
AmurG/SPFlow
Sum
false
4,857
[ "Apache-2.0" ]
1
ab28dd4af9ed722ace69c6b290cf0a279bbda39e
https://github.com/AmurG/SPFlow/tree/ab28dd4af9ed722ace69c6b290cf0a279bbda39e
QNetwork
import torch import torch.nn.functional as F import torch.nn as nn class QNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): """Initialize parameters and build model. Params ====== state_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
AmineKheldouni/Graphs-in-Machine-Learning
QNetwork
false
4,858
[ "MIT" ]
1
003217495c624eaa33d44d679a0bc2164ca1f3d2
https://github.com/AmineKheldouni/Graphs-in-Machine-Learning/tree/003217495c624eaa33d44d679a0bc2164ca1f3d2
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. bins ...
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...
AlphaLFC/mmdetection
GHMR
false
4,859
[ "Apache-2.0" ]
1
45619c5b8aca0ca3e6ddc211210a8946c94694d8
https://github.com/AlphaLFC/mmdetection/tree/45619c5b8aca0ca3e6ddc211210a8946c94694d8
ActorNetwork
import torch import torch.nn as nn import torch.nn.functional as F class ActorNetwork(nn.Module): def __init__(self, input_shape, output_shape, **kwargs): super(ActorNetwork, self).__init__() n_input = input_shape[-1] n_output = output_shape[0] self._h = nn.Linear(n_input, n_outpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
AmmarFahmy/mushroom-rl
ActorNetwork
false
4,860
[ "MIT" ]
1
2625ee7f64d5613b3b9fba00f0b7a39fece88ca5
https://github.com/AmmarFahmy/mushroom-rl/tree/2625ee7f64d5613b3b9fba00f0b7a39fece88ca5
LayerNorm
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_s...
AnonymousGFR/wbgan.pytorch
LayerNorm
false
4,861
[ "MIT" ]
1
d75cb6599852e901df0136db87520e3314f8ca71
https://github.com/AnonymousGFR/wbgan.pytorch/tree/d75cb6599852e901df0136db87520e3314f8ca71
AdaIN
import math import torch import torch.nn as nn from numpy import prod def getLayerNormalizationFactor(x): """ Get He's constant for the given layer https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf """ size = x.weight.size() fan_in = pro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Andribi/pytorch_GAN_zoo
AdaIN
false
4,862
[ "BSD-3-Clause" ]
1
b37c7268cbd4ec7dc61ba65a3ccf11af71247597
https://github.com/Andribi/pytorch_GAN_zoo/tree/b37c7268cbd4ec7dc61ba65a3ccf11af71247597
CmapPafHead
import torch import torch.utils.data import torch.nn import torch.optim class UpsampleCBR(torch.nn.Sequential): def __init__(self, input_channels, output_channels, count=1, num_flat=0): layers = [] for i in range(count): if i == 0: inch = input_channels els...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.optim assert_size_stride = ...
Anqi-nus/trtpose
CmapPafHead
false
4,863
[ "MIT" ]
1
723ec95df8b8414b9289af90fbfbc98756792a21
https://github.com/Anqi-nus/trtpose/tree/723ec95df8b8414b9289af90fbfbc98756792a21
QNetwork
import torch import torch.nn.functional as F from torch import nn import torch.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, num_inputs, num_actions, hidd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
AmmarFayad/Influence-based-Reinforcement-Learning-in-Intrinsically-motivated-Agents
QNetwork
false
4,864
[ "MIT" ]
1
e7cfa4121542312de641792288f7487f86971c1e
https://github.com/AmmarFayad/Influence-based-Reinforcement-Learning-in-Intrinsically-motivated-Agents/tree/e7cfa4121542312de641792288f7487f86971c1e
GeLU
import math import torch import torch.nn as nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) ...
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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards....
AsmitaBhat30/lxmert
GeLU
false
4,865
[ "MIT" ]
1
90292dc36a25c04c4f76fe9119e3141d5dc05874
https://github.com/AsmitaBhat30/lxmert/tree/90292dc36a25c04c4f76fe9119e3141d5dc05874
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: self.gamma = nn.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._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
AntiAegis/PyTorch-GAN
LayerNorm
false
4,866
[ "MIT" ]
1
1cb951b3ad3a58b749c1802f84947b85f72c8367
https://github.com/AntiAegis/PyTorch-GAN/tree/1cb951b3ad3a58b749c1802f84947b85f72c8367
SimpleCNN
import torch import torch.nn as nn from torch.nn import functional as F class SimpleCNN(nn.Module): def __init__(self): super(SimpleCNN, self).__init__() self.fc1 = nn.Linear(28 * 28, 500) self.fc2 = nn.Linear(500, 256) self.fc3 = nn.Linear(256, 10) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
AnweshCR7/autonomous_greenhouse
SimpleCNN
false
4,867
[ "MIT" ]
1
a29cfe37d0152001d2544216ed65c3472f572b4e
https://github.com/AnweshCR7/autonomous_greenhouse/tree/a29cfe37d0152001d2544216ed65c3472f572b4e
Pairer
import torch import numpy as np from torch import Tensor from torch.functional import Tensor from typing import Union class Pairer(torch.nn.Module): """ To predict links between segments we will find all possible pairs and estimate the probability that they are linked. We do this by creating a matrix whe...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
AxlAlm/SegNLP
Pairer
false
4,868
[ "Apache-2.0" ]
1
89b8d077952397dfcea089376b373b117bcf6a65
https://github.com/AxlAlm/SegNLP/tree/89b8d077952397dfcea089376b373b117bcf6a65
SourceContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """Implement up to the computation of the gate""" def __init__(self, embeddings_size, decoder_size, attention_size, output_size): super(ContextGate, self).__init__() input_size = embeddings_size + decod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AngusGLChen/qg
SourceContextGate
false
4,869
[ "MIT" ]
1
3ebc5b94348a4c313829a6c71705fbc9dadd8181
https://github.com/AngusGLChen/qg/tree/3ebc5b94348a4c313829a6c71705fbc9dadd8181
BothContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """Implement up to the computation of the gate""" def __init__(self, embeddings_size, decoder_size, attention_size, output_size): super(ContextGate, self).__init__() input_size = embeddings_size + decod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AngusGLChen/qg
BothContextGate
false
4,870
[ "MIT" ]
1
3ebc5b94348a4c313829a6c71705fbc9dadd8181
https://github.com/AngusGLChen/qg/tree/3ebc5b94348a4c313829a6c71705fbc9dadd8181
TargetContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """Implement up to the computation of the gate""" def __init__(self, embeddings_size, decoder_size, attention_size, output_size): super(ContextGate, self).__init__() input_size = embeddings_size + decod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AngusGLChen/qg
TargetContextGate
false
4,871
[ "MIT" ]
1
3ebc5b94348a4c313829a6c71705fbc9dadd8181
https://github.com/AngusGLChen/qg/tree/3ebc5b94348a4c313829a6c71705fbc9dadd8181
ContextGate
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """Implement up to the computation of the gate""" def __init__(self, embeddings_size, decoder_size, attention_size, output_size): super(ContextGate, self).__init__() input_size = embeddings_size + decod...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.cuda assert_size_stride = torch._C._dynamo.gu...
AngusGLChen/qg
ContextGate
false
4,872
[ "MIT" ]
1
3ebc5b94348a4c313829a6c71705fbc9dadd8181
https://github.com/AngusGLChen/qg/tree/3ebc5b94348a4c313829a6c71705fbc9dadd8181
SimpleCNN
import torch import torch.nn.functional as F class SimpleCNN(torch.nn.Module): def __init__(self, in_ch=1, out_ch=3): super(SimpleCNN, self).__init__() self.conv1 = torch.nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=1, padding=1) self.conv2 = torch.nn.Conv2d(out_ch, out_ch, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Arjun-Arora/CS348B_project
SimpleCNN
false
4,873
[ "BSD-2-Clause" ]
1
000ced8edbc3554db74db36ebcd76042d17398ee
https://github.com/Arjun-Arora/CS348B_project/tree/000ced8edbc3554db74db36ebcd76042d17398ee
LayerNorm
import torch import torch.nn as nn import torch.optim class LayerNorm(nn.Module): """Construct a layernorm module in the OpenAI style (epsilon inside the square root).""" def __init__(self, n_state, e=1e-05): super(LayerNorm, self).__init__() self.g = nn.Parameter(torch.ones(n_state)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo....
Arvindkrishna1997/comet-dataset
LayerNorm
false
4,874
[ "Apache-2.0" ]
1
2cb42a4aefdea6d0e81f544f94830d44730e9853
https://github.com/Arvindkrishna1997/comet-dataset/tree/2cb42a4aefdea6d0e81f544f94830d44730e9853
ScaledDotProductAttention
import torch import numpy as np from torch import nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AutuanLiu/LeetCode2019
ScaledDotProductAttention
false
4,875
[ "MIT" ]
1
8efc7c5475fd888f7d86c3b08a3c1c9e55c1ac30
https://github.com/AutuanLiu/LeetCode2019/tree/8efc7c5475fd888f7d86c3b08a3c1c9e55c1ac30
MyLayerNorm
import torch import torch.nn as nn class MyLayerNorm(nn.Module): def __init__(self, input_dim): super(MyLayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(input_dim)) if True or use_bias: self.beta = nn.Parameter(torch.ones(input_dim)) def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Ar-Kareem/Sketch-RNN
MyLayerNorm
false
4,876
[ "MIT" ]
1
350824040715ea281182de01bca467130f326566
https://github.com/Ar-Kareem/Sketch-RNN/tree/350824040715ea281182de01bca467130f326566
ConvNet
import torch import torch.nn as nn class ConvNet(nn.Module): """Standard convolutional net for baseline Architecture: 2 convolutional layers, 3 fully connected layers. """ def __init__(self): super(ConvNet, self).__init__() args = {'stride': 1, 'padding': 1} self.conv1 = nn.Co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Allen-Z-4230/MoCo-CIFAR10
ConvNet
false
4,877
[ "MIT" ]
1
b2ade575b8ed1e05e32e4ec629acdfee55c8ff41
https://github.com/Allen-Z-4230/MoCo-CIFAR10/tree/b2ade575b8ed1e05e32e4ec629acdfee55c8ff41
HS
import torch import torch.nn as nn class HS(nn.Module): def __init__(self): super(HS, self).__init__() def forward(self, inputs): clip = torch.clamp(inputs + 3, 0, 6) / 6 return inputs * clip def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
BXuan694/basemodel-pytorch
HS
false
4,878
[ "MIT" ]
1
a36c96904580be902e323db17eebbe2ea1f54176
https://github.com/BXuan694/basemodel-pytorch/tree/a36c96904580be902e323db17eebbe2ea1f54176
ConditionalBatchNorm2d
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from torch.nn import Parameter def l2normalize(v, eps=0.0001): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
AnonymousGFR/wbgan.pytorch
ConditionalBatchNorm2d
false
4,879
[ "MIT" ]
1
d75cb6599852e901df0136db87520e3314f8ca71
https://github.com/AnonymousGFR/wbgan.pytorch/tree/d75cb6599852e901df0136db87520e3314f8ca71
GlobalAttention
import torch import torch.nn as nn import torch.cuda def aeq(base, *rest): """ Assert the first arg equals to each of the rest.""" for a in rest[:]: assert a == base, 'base(' + str(base ) + ") doesn't equals to each of " + str(rest) class Bottle(nn.Module): def forward(self, input):...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
AngusGLChen/qg
GlobalAttention
false
4,880
[ "MIT" ]
1
3ebc5b94348a4c313829a6c71705fbc9dadd8181
https://github.com/AngusGLChen/qg/tree/3ebc5b94348a4c313829a6c71705fbc9dadd8181
AdditiveAttention
import torch from torch import Tensor from torch.functional import Tensor import torch.nn as nn class AdditiveAttention(nn.Module): """ Originally from: https://arxiv.org/pdf/1409.0473v5.pdf Also referenced to as Content Based Attention: https://arxiv.org/pdf/1506.03134v1.pdf Attenti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AxlAlm/SegNLP
AdditiveAttention
false
4,881
[ "Apache-2.0" ]
1
89b8d077952397dfcea089376b373b117bcf6a65
https://github.com/AxlAlm/SegNLP/tree/89b8d077952397dfcea089376b373b117bcf6a65
LayerNorm
import torch class LayerNorm(torch.nn.Module): def __init__(self, dimensions, eps: 'float'=1e-06) ->None: super().__init__() self.gamma = torch.nn.Parameter(torch.ones(dimensions)) self.beta = torch.nn.Parameter(torch.zeros(dimensions)) self.eps = eps def forward(self, tensor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
AutuanLiu/LeetCode2019
LayerNorm
false
4,882
[ "MIT" ]
1
8efc7c5475fd888f7d86c3b08a3c1c9e55c1ac30
https://github.com/AutuanLiu/LeetCode2019/tree/8efc7c5475fd888f7d86c3b08a3c1c9e55c1ac30
Dnn_net_Loss
import torch import torch.utils.data class Dnn_net_Loss(torch.nn.Module): def __init__(self): super(Dnn_net_Loss, self).__init__() def forward(self, model_output, targ_input): criterion = torch.nn.MSELoss(reduction='none') criterion targ_input = torch.cat((targ_input[:, :, 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...
BaiYunLiu/newPLC
Dnn_net_Loss
false
4,883
[ "BSD-3-Clause" ]
1
18245a14648bc28b7269ea1d6e444ca6021ac8d2
https://github.com/BaiYunLiu/newPLC/tree/18245a14648bc28b7269ea1d6e444ca6021ac8d2
Similarity
import torch import torch.nn as nn class Similarity(nn.Module): """ Dot product or cosine similarity """ def __init__(self, temp): super().__init__() self.temp = temp self.cos = nn.CosineSimilarity(dim=-1) def forward(self, x, y): return self.cos(x, y) / self.temp...
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...
BDBC-KG-NLP/MixCSE_AAAI2022
Similarity
false
4,884
[ "MIT" ]
1
884145e24a5258c044fedb658df9999f012df875
https://github.com/BDBC-KG-NLP/MixCSE_AAAI2022/tree/884145e24a5258c044fedb658df9999f012df875
VAE
import torch import torch.nn as nn import torch.utils.data from torch.nn import functional as F class VAE(nn.Module): def __init__(self, n_features=24, z_dim=15): super(VAE, self).__init__() self.en1 = nn.Linear(n_features, 200) self.en2 = nn.Linear(200, 100) self.en3 = nn.Linear(...
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.triton_helpers import math...
Autoencoders-compression-anomaly/Various-AEs-Compression-Tensorflow
VAE
false
4,885
[ "Apache-2.0" ]
1
772ba547c2b7d5d90e79382bf4d8a50e4d733210
https://github.com/Autoencoders-compression-anomaly/Various-AEs-Compression-Tensorflow/tree/772ba547c2b7d5d90e79382bf4d8a50e4d733210
Attention
import math import torch from torch import nn class Attention(nn.Module): """A generic attention module for a decoder in seq2seq""" def __init__(self, dim, use_tanh=False, C=10): super(Attention, self).__init__() self.use_tanh = use_tanh self.project_query = nn.Linear(dim, 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.triton_helpers import libdevice import math from to...
BCHoagland/attention-learn-to-route
Attention
false
4,886
[ "MIT" ]
1
c411289c3b42be5b9c89240f665a029dfc51e034
https://github.com/BCHoagland/attention-learn-to-route/tree/c411289c3b42be5b9c89240f665a029dfc51e034
ConvLayer
import torch class ConvLayer(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() reflection_padding = kernel_size // 2 self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding) self.conv2d = torch.nn.Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_s...
Bartolo1024/ignite
ConvLayer
false
4,887
[ "BSD-3-Clause" ]
1
b087fef0bc5f97cda415c1c56f1cd589383c54be
https://github.com/Bartolo1024/ignite/tree/b087fef0bc5f97cda415c1c56f1cd589383c54be
AE_4D
import torch import torch.nn as nn import torch.utils.data class AE_4D(nn.Module): def __init__(self, n_features=4): super(AE_4D, self).__init__() self.en1 = nn.Linear(n_features, 200) self.en2 = nn.Linear(200, 100) self.en3 = nn.Linear(100, 50) self.en4 = nn.Linear(50, 3)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Autoencoders-compression-anomaly/Various-AEs-Compression-Tensorflow
AE_4D
false
4,888
[ "Apache-2.0" ]
1
772ba547c2b7d5d90e79382bf4d8a50e4d733210
https://github.com/Autoencoders-compression-anomaly/Various-AEs-Compression-Tensorflow/tree/772ba547c2b7d5d90e79382bf4d8a50e4d733210
ActorMARL
import torch import torch.nn as nn import torch.nn.functional as F class ActorMARL(nn.Module): def __init__(self, dim_observation, dim_action): super(ActorMARL, self).__init__() self.FC1 = nn.Linear(dim_observation, 500) self.FC2 = nn.Linear(500, 128) self.FC3 = nn.Linear(128, 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....
BIT-UAV-JJJ/ElegantRL
ActorMARL
false
4,889
[ "Apache-2.0" ]
1
5ce5c1030949bb862d0d56b0e78a9a1f47efe63a
https://github.com/BIT-UAV-JJJ/ElegantRL/tree/5ce5c1030949bb862d0d56b0e78a9a1f47efe63a
eSEModule
import torch import torch.nn as nn import torch.nn.functional as F class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(x + 3.0, inplace=self.inplace) / 6.0 class eSEModule(nn.Modul...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
BXuan694/basemodel-pytorch
eSEModule
false
4,890
[ "MIT" ]
1
a36c96904580be902e323db17eebbe2ea1f54176
https://github.com/BXuan694/basemodel-pytorch/tree/a36c96904580be902e323db17eebbe2ea1f54176
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, n_classes): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 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 import torch.nn as nn assert_...
ArWeHei/edflow
Net
false
4,891
[ "MIT" ]
1
3383cfbc42a43e906bc7781ad05714fd4fc9616e
https://github.com/ArWeHei/edflow/tree/3383cfbc42a43e906bc7781ad05714fd4fc9616e
SE
import torch import torch.nn as nn import torch.nn.functional as F class SE(nn.Module): """Squeeze-and-Excitation block.""" def __init__(self, in_planes, se_planes): super(SE, self).__init__() self.se1 = nn.Conv2d(in_planes, se_planes, kernel_size=1, bias=True) self.se2 = nn.Conv2d(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
BXuan694/basemodel-pytorch
SE
false
4,892
[ "MIT" ]
1
a36c96904580be902e323db17eebbe2ea1f54176
https://github.com/BXuan694/basemodel-pytorch/tree/a36c96904580be902e323db17eebbe2ea1f54176
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, state_dim, action_dim, max_action): super(Actor, self).__init__() self.l1 = nn.Linear(state_dim, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, action_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....
Barisimre/TD3-Generative
Actor
false
4,893
[ "MIT" ]
1
434419b020b88010f09f194c40feac1d420b2086
https://github.com/Barisimre/TD3-Generative/tree/434419b020b88010f09f194c40feac1d420b2086
GeneralizedDiceLoss
import collections import torch import warnings from typing import Optional from typing import Union from typing import Any from typing import Callable from typing import Tuple import torch.nn from torch.nn.modules.loss import _Loss from enum import Enum import collections.abc def issequenceiterable(obj: 'Any') ->boo...
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 collections from typi...
Alxaline/MONAI
GeneralizedDiceLoss
false
4,894
[ "Apache-2.0" ]
1
6b8fdf9db7f13ed7d88d605155a0463840abcbf2
https://github.com/Alxaline/MONAI/tree/6b8fdf9db7f13ed7d88d605155a0463840abcbf2
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_dim, action_dim): super(Critic, self).__init__() self.l1 = nn.Linear(state_dim + action_dim, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Barisimre/TD3-Generative
Critic
false
4,895
[ "MIT" ]
1
434419b020b88010f09f194c40feac1d420b2086
https://github.com/Barisimre/TD3-Generative/tree/434419b020b88010f09f194c40feac1d420b2086
DNNnet
import torch import torch.utils.data class DNNnet(torch.nn.Module): def __init__(self, n_layer, n_in_channel, n_out_channel): super(DNNnet, self).__init__() self.n_layer = n_layer self.fc_layers = torch.nn.ModuleList() self.act_func = torch.nn.Sigmoid() start_layer = torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
BaiYunLiu/newPLC
DNNnet
false
4,896
[ "BSD-3-Clause" ]
1
18245a14648bc28b7269ea1d6e444ca6021ac8d2
https://github.com/BaiYunLiu/newPLC/tree/18245a14648bc28b7269ea1d6e444ca6021ac8d2
SkipLastTargetChannelWrapper
import torch import torch.nn as nn from torch.nn import MSELoss class SkipLastTargetChannelWrapper(nn.Module): """ Loss wrapper which removes additional target channel """ def __init__(self, loss, squeeze_channel=False): super(SkipLastTargetChannelWrapper, self).__init__() self.loss =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
BioTrillion/pytorch-3dunet
SkipLastTargetChannelWrapper
false
4,897
[ "MIT" ]
1
217781197dd94211ee7fe5d53a8b404f0b8391a6
https://github.com/BioTrillion/pytorch-3dunet/tree/217781197dd94211ee7fe5d53a8b404f0b8391a6
WeightBCE
import torch from torch import Tensor from torch import nn class WeightBCE(nn.Module): def __init__(self, epsilon: 'float'=1e-08) ->None: super(WeightBCE, self).__init__() self.epsilon = epsilon def forward(self, x: 'Tensor', label: 'Tensor', weight: 'Tensor') ->Tensor: """ :...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
BetterRaven/Transfer-Learning_vscode
WeightBCE
false
4,898
[ "MIT" ]
1
90c9bce630f54fd2322cce8fab5fe1d074ff141c
https://github.com/BetterRaven/Transfer-Learning_vscode/tree/90c9bce630f54fd2322cce8fab5fe1d074ff141c
CNN
import torch from torch import nn import torch.nn.functional as F class CNN(torch.nn.Module): """Basic CNN architecture.""" def __init__(self, in_channels=1): super(CNN, self).__init__() self.conv1 = nn.Conv2d(in_channels, 64, 8, 1) self.conv2 = nn.Conv2d(64, 128, 6, 2) self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
AxelBohm/cleverhans
CNN
false
4,899
[ "MIT" ]
1
35f44d686fa24a8d3a30218dc9ad2617859afbf0
https://github.com/AxelBohm/cleverhans/tree/35f44d686fa24a8d3a30218dc9ad2617859afbf0
Policy
import torch import torch.nn as nn import torch.nn.functional as F class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.affine1 = nn.Linear(4, 128) self.affine2 = nn.Linear(128, 2) self.saved_log_probs = [] self.rewards = [] def forward(sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Bartolo1024/ignite
Policy
false
4,900
[ "BSD-3-Clause" ]
1
b087fef0bc5f97cda415c1c56f1cd589383c54be
https://github.com/Bartolo1024/ignite/tree/b087fef0bc5f97cda415c1c56f1cd589383c54be
MAB
import math import torch import torch.nn as nn import torch.nn.functional as F class MAB(nn.Module): def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False): super(MAB, self).__init__() self.dim_V = dim_V self.num_heads = num_heads self.fc_q = nn.Linear(dim_Q, dim_V) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Behrouz-Babaki/NCG4CVRP
MAB
false
4,901
[ "MIT" ]
1
87d63366c0b461f44ce8e982159a1e207af77b44
https://github.com/Behrouz-Babaki/NCG4CVRP/tree/87d63366c0b461f44ce8e982159a1e207af77b44
SAB
import math import torch import torch.nn as nn import torch.nn.functional as F class MAB(nn.Module): def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False): super(MAB, self).__init__() self.dim_V = dim_V self.num_heads = num_heads self.fc_q = nn.Linear(dim_Q, dim_V) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Behrouz-Babaki/NCG4CVRP
SAB
false
4,902
[ "MIT" ]
1
87d63366c0b461f44ce8e982159a1e207af77b44
https://github.com/Behrouz-Babaki/NCG4CVRP/tree/87d63366c0b461f44ce8e982159a1e207af77b44
PointLoss
import torch import torch.nn.parallel import torch.utils.data import torch.nn as nn def array2samples_distance(array1, array2): """ arguments: array1: the array, size: (num_point, num_feature) array2: the samples, size: (num_point, num_feature) returns: distances: each entry is th...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.parallel import torch.utils.data import torch.nn as nn assert_size_stride...
AndyYuanC/VegPN
PointLoss
false
4,903
[ "MIT" ]
1
eb981d62ad854d3ca607240cc431a0870c1e95ba
https://github.com/AndyYuanC/VegPN/tree/eb981d62ad854d3ca607240cc431a0870c1e95ba
ContrastiveLoss
import torch import torch.nn as nn class ContrastiveLoss(nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf Loss is proportional to square distance when inputs are of the same type, and proportional to the square of margin - dista...
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...
BrunoKM/rhoana_graph_tools
ContrastiveLoss
false
4,904
[ "MIT" ]
1
7150f4bc6337ecf51dd9123cf03561a57d655160
https://github.com/BrunoKM/rhoana_graph_tools/tree/7150f4bc6337ecf51dd9123cf03561a57d655160
ResidualBlock
import torch class ConvLayer(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() reflection_padding = kernel_size // 2 self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding) self.conv2d = torch.nn.Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Bartolo1024/ignite
ResidualBlock
false
4,905
[ "BSD-3-Clause" ]
1
b087fef0bc5f97cda415c1c56f1cd589383c54be
https://github.com/Bartolo1024/ignite/tree/b087fef0bc5f97cda415c1c56f1cd589383c54be
WeightedSmoothL1Loss
import torch import torch.nn as nn class WeightedSmoothL1Loss(nn.SmoothL1Loss): def __init__(self, threshold, initial_weight, apply_below_threshold=True): super().__init__(reduction='none') self.threshold = threshold self.apply_below_threshold = apply_below_threshold self.weight =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
BioTrillion/pytorch-3dunet
WeightedSmoothL1Loss
false
4,906
[ "MIT" ]
1
217781197dd94211ee7fe5d53a8b404f0b8391a6
https://github.com/BioTrillion/pytorch-3dunet/tree/217781197dd94211ee7fe5d53a8b404f0b8391a6
BCEDiceLoss
import torch import torch.nn as nn def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) axis_order = (1, 0) + tuple(range(2, tensor.dim())) transposed = te...
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...
BioTrillion/pytorch-3dunet
BCEDiceLoss
false
4,907
[ "MIT" ]
1
217781197dd94211ee7fe5d53a8b404f0b8391a6
https://github.com/BioTrillion/pytorch-3dunet/tree/217781197dd94211ee7fe5d53a8b404f0b8391a6
BatchLinear
import torch import torch.nn as nn from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ----- Objects inherited from `MetaModule` are fully compa...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Bunnycakes62/SIREN
BatchLinear
false
4,908
[ "MIT" ]
1
87c2c9e28411fd6a83d1d0d1bc5141cce30e646b
https://github.com/Bunnycakes62/SIREN/tree/87c2c9e28411fd6a83d1d0d1bc5141cce30e646b
PMA
import math import torch import torch.nn as nn import torch.nn.functional as F class MAB(nn.Module): def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False): super(MAB, self).__init__() self.dim_V = dim_V self.num_heads = num_heads self.fc_q = nn.Linear(dim_Q, dim_V) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Behrouz-Babaki/NCG4CVRP
PMA
false
4,909
[ "MIT" ]
1
87d63366c0b461f44ce8e982159a1e207af77b44
https://github.com/Behrouz-Babaki/NCG4CVRP/tree/87d63366c0b461f44ce8e982159a1e207af77b44
ISAB
import math import torch import torch.nn as nn import torch.nn.functional as F class MAB(nn.Module): def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False): super(MAB, self).__init__() self.dim_V = dim_V self.num_heads = num_heads self.fc_q = nn.Linear(dim_Q, dim_V) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Behrouz-Babaki/NCG4CVRP
ISAB
false
4,910
[ "MIT" ]
1
87d63366c0b461f44ce8e982159a1e207af77b44
https://github.com/Behrouz-Babaki/NCG4CVRP/tree/87d63366c0b461f44ce8e982159a1e207af77b44
TimeEncode
import torch import numpy as np class TimeEncode(torch.nn.Module): def __init__(self, dimension): super(TimeEncode, self).__init__() self.dimension = dimension self.w = torch.nn.Linear(1, dimension) self.w.weight = torch.nn.Parameter(torch.from_numpy(1 / 10 ** np. lins...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
Blidge/tgn-caw-main
TimeEncode
false
4,911
[ "Apache-2.0" ]
1
7a58f22bc7d9f1e2f6e9cbb1a60a18aed81071ee
https://github.com/Blidge/tgn-caw-main/tree/7a58f22bc7d9f1e2f6e9cbb1a60a18aed81071ee
CmapPafHeadAttention
import torch import torch.utils.data import torch.nn import torch.optim class UpsampleCBR(torch.nn.Sequential): def __init__(self, input_channels, output_channels, count=1, num_flat=0): layers = [] for i in range(count): if i == 0: inch = input_channels els...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
Anqi-nus/trtpose
CmapPafHeadAttention
false
4,912
[ "MIT" ]
1
723ec95df8b8414b9289af90fbfbc98756792a21
https://github.com/Anqi-nus/trtpose/tree/723ec95df8b8414b9289af90fbfbc98756792a21
MMD
import torch from torch import nn class MMD(nn.Module): def __init__(self): super().__init__() def _guassian_kernel(self, 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...
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_...
BetterRaven/Transfer-Learning_vscode
MMD
false
4,913
[ "MIT" ]
1
90c9bce630f54fd2322cce8fab5fe1d074ff141c
https://github.com/BetterRaven/Transfer-Learning_vscode/tree/90c9bce630f54fd2322cce8fab5fe1d074ff141c
MergeLayer
import torch class MergeLayer(torch.nn.Module): def __init__(self, dim1, dim2, dim3, dim4): super().__init__() self.fc1 = torch.nn.Linear(dim1 + dim2, dim3) self.fc2 = torch.nn.Linear(dim3, dim4) self.act = torch.nn.ReLU() torch.nn.init.xavier_normal_(self.fc1.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 import triton_helpers assert_size_stride = torch._C...
Blidge/tgn-caw-main
MergeLayer
false
4,914
[ "Apache-2.0" ]
1
7a58f22bc7d9f1e2f6e9cbb1a60a18aed81071ee
https://github.com/Blidge/tgn-caw-main/tree/7a58f22bc7d9f1e2f6e9cbb1a60a18aed81071ee
IrisNet
import torch import torch.nn.functional as F import torch.nn as nn class IrisNet(nn.Module): def __init__(self): super(IrisNet, self).__init__() self.fc1 = nn.Linear(4, 100) self.fc2 = nn.Linear(100, 100) self.fc3 = nn.Linear(100, 3) self.softmax = nn.Softmax(dim=1) d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Bhaskarkvvsr/cortex
IrisNet
false
4,915
[ "Apache-2.0" ]
1
f569791613ea8b8cff226c3585839d37b9b6a5b5
https://github.com/Bhaskarkvvsr/cortex/tree/f569791613ea8b8cff226c3585839d37b9b6a5b5
Sine
import torch import torch.nn as nn class Sine(nn.Module): def __init(self): super().__init__() def forward(self, input): return torch.sin(5 * 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.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
Bunnycakes62/SIREN
Sine
false
4,916
[ "MIT" ]
1
87c2c9e28411fd6a83d1d0d1bc5141cce30e646b
https://github.com/Bunnycakes62/SIREN/tree/87c2c9e28411fd6a83d1d0d1bc5141cce30e646b
MetaBilinear
import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MetaModule(nn.Module): """ Base class for PyTorch meta-learning modules. These modules accept an additional argument `params` in their `forward` method. Notes ----- Objects inherited f...
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 reinterpret_tensor = torch._C._dynamo.guards._reinterp...
Bunnycakes62/SIREN
MetaBilinear
false
4,917
[ "MIT" ]
1
87c2c9e28411fd6a83d1d0d1bc5141cce30e646b
https://github.com/Bunnycakes62/SIREN/tree/87c2c9e28411fd6a83d1d0d1bc5141cce30e646b
GlobalAvgPool2d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim 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): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asser...
CFengFeng/face-nn
GlobalAvgPool2d
false
4,918
[ "MIT" ]
1
a76a689774b5101959d3c5b8a04898ae82c7bfc2
https://github.com/CFengFeng/face-nn/tree/a76a689774b5101959d3c5b8a04898ae82c7bfc2
LinearPool
import torch import torch.nn as nn class LinearPool(nn.Module): def __init__(self): super(LinearPool, self).__init__() def forward(self, feat_map): """ Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) return(Tensor): tensor with shape (N, C, 1, 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...
C3-ASV-Team/torchxrayvision
LinearPool
false
4,919
[ "Apache-2.0" ]
1
7e53f0606986562f17a1ffd9f31d006756eff78d
https://github.com/C3-ASV-Team/torchxrayvision/tree/7e53f0606986562f17a1ffd9f31d006756eff78d
MLP
import torch class MLP(torch.nn.Module): def __init__(self, dim, drop=0.3): super().__init__() self.fc_1 = torch.nn.Linear(dim, 80) self.fc_2 = torch.nn.Linear(80, 10) self.fc_3 = torch.nn.Linear(10, 1) self.act = torch.nn.ReLU() self.dropout = torch.nn.Dropout(p=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 assert_size_stride = torch._C...
Blidge/tgn-caw-main
MLP
false
4,920
[ "Apache-2.0" ]
1
7a58f22bc7d9f1e2f6e9cbb1a60a18aed81071ee
https://github.com/Blidge/tgn-caw-main/tree/7a58f22bc7d9f1e2f6e9cbb1a60a18aed81071ee
ExpPool
import torch import torch.nn as nn class ExpPool(nn.Module): def __init__(self): super(ExpPool, self).__init__() def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
C3-ASV-Team/torchxrayvision
ExpPool
false
4,921
[ "Apache-2.0" ]
1
7e53f0606986562f17a1ffd9f31d006756eff78d
https://github.com/C3-ASV-Team/torchxrayvision/tree/7e53f0606986562f17a1ffd9f31d006756eff78d
FrameMaxPool
import torch import torch.nn as nn class FrameMaxPool(nn.Module): def __init__(self, input_size, hidden_size, stride): super(FrameMaxPool, self).__init__() self.vis_conv = nn.Conv1d(input_size, hidden_size, 1, 1) self.max_pool = nn.MaxPool1d(stride) def forward(self, visual_input): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
CFM-MSG/Code_LEORN
FrameMaxPool
false
4,922
[ "MIT" ]
1
fabea1e1ded973a4db692e51e2df442bde55f626
https://github.com/CFM-MSG/Code_LEORN/tree/fabea1e1ded973a4db692e51e2df442bde55f626
GCN
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, bias=True): super(Grap...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.nn a...
BrunoKM/rhoana_graph_tools
GCN
false
4,923
[ "MIT" ]
1
7150f4bc6337ecf51dd9123cf03561a57d655160
https://github.com/BrunoKM/rhoana_graph_tools/tree/7150f4bc6337ecf51dd9123cf03561a57d655160
SSRLayer
import torch import torch.nn as nn class SSRLayer(nn.Module): def __init__(self): super(SSRLayer, self).__init__() def forward(self, x): a = x[0][:, :, 0] * 0 b = x[0][:, :, 0] * 0 c = x[0][:, :, 0] * 0 s1 = 3 s2 = 3 s3 = 3 lambda_d = 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...
C3Imaging/SyntheticHeadPose
SSRLayer
false
4,924
[ "MIT" ]
1
b139aeda41ace2a07138705a4997d2ea65cb11a6
https://github.com/C3Imaging/SyntheticHeadPose/tree/b139aeda41ace2a07138705a4997d2ea65cb11a6
mfm
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, mode=1): """ mfm :param in_channels: in channel :param out_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
CFengFeng/face-nn
mfm
false
4,925
[ "MIT" ]
1
a76a689774b5101959d3c5b8a04898ae82c7bfc2
https://github.com/CFengFeng/face-nn/tree/a76a689774b5101959d3c5b8a04898ae82c7bfc2
LogSumExpPool
import torch import torch.nn as nn class LogSumExpPool(nn.Module): def __init__(self, gamma): super(LogSumExpPool, self).__init__() self.gamma = gamma def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
C3-ASV-Team/torchxrayvision
LogSumExpPool
false
4,926
[ "Apache-2.0" ]
1
7e53f0606986562f17a1ffd9f31d006756eff78d
https://github.com/C3-ASV-Team/torchxrayvision/tree/7e53f0606986562f17a1ffd9f31d006756eff78d
Log_Cosh_Loss
import torch class Log_Cosh_Loss(torch.nn.Module): def forward(self, logits, labels): return torch.mean(torch.log(torch.cosh(labels - logits))) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
CODEJIN/RHRNet
Log_Cosh_Loss
false
4,927
[ "MIT" ]
1
71bd9d40a9951a7beabe9c3e802e74af22dd405d
https://github.com/CODEJIN/RHRNet/tree/71bd9d40a9951a7beabe9c3e802e74af22dd405d
ExtResNetBlock
import torch import torch.nn as nn def conv3d(in_channels, out_channels, kernel_size, bias, padding): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding): """ Create a list o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
BioTrillion/pytorch-3dunet
ExtResNetBlock
false
4,928
[ "MIT" ]
1
217781197dd94211ee7fe5d53a8b404f0b8391a6
https://github.com/BioTrillion/pytorch-3dunet/tree/217781197dd94211ee7fe5d53a8b404f0b8391a6
CAModule
import torch import torch.nn as nn class CAModule(nn.Module): """ Re-implementation of Squeeze-and-Excitation (SE) block described in: *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507* code reference: https://github.com/kobiso/CBAM-keras/blob/master/models/attention_module.py """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
C3-ASV-Team/torchxrayvision
CAModule
false
4,929
[ "Apache-2.0" ]
1
7e53f0606986562f17a1ffd9f31d006756eff78d
https://github.com/C3-ASV-Team/torchxrayvision/tree/7e53f0606986562f17a1ffd9f31d006756eff78d
PcamPool
import torch import torch.nn as nn class PcamPool(nn.Module): def __init__(self): super(PcamPool, self).__init__() def forward(self, feat_map, logit_map): assert logit_map is not None prob_map = torch.sigmoid(logit_map) weight_map = prob_map / prob_map.sum(dim=2, keepdim=True...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
C3-ASV-Team/torchxrayvision
PcamPool
false
4,930
[ "Apache-2.0" ]
1
7e53f0606986562f17a1ffd9f31d006756eff78d
https://github.com/C3-ASV-Team/torchxrayvision/tree/7e53f0606986562f17a1ffd9f31d006756eff78d
TrajectoryPredictor
import torch import torch.nn as nn class TrajectoryPredictor(nn.Module): def __init__(self, pose_size, trajectory_size, hidden_size): super(TrajectoryPredictor, self).__init__() self.lp = nn.Linear(hidden_size, pose_size) self.fc = nn.Linear(pose_size + hidden_size, trajectory_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...
CMU-MultiComp-Lab/language2pose
TrajectoryPredictor
false
4,931
[ "MIT" ]
1
b32199ae5b2b80087411504afef384e0fa689d04
https://github.com/CMU-MultiComp-Lab/language2pose/tree/b32199ae5b2b80087411504afef384e0fa689d04
ResidualBlock
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, mode=1): """ mfm :param in_channels: in channel :param out_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
CFengFeng/face-nn
ResidualBlock
false
4,932
[ "MIT" ]
1
a76a689774b5101959d3c5b8a04898ae82c7bfc2
https://github.com/CFengFeng/face-nn/tree/a76a689774b5101959d3c5b8a04898ae82c7bfc2
CoralLayer
import torch class CoralLayer(torch.nn.Module): """ Implements CORAL layer described in Cao, Mirjalili, and Raschka (2020) *Rank Consistent Ordinal Regression for Neural Networks with Application to Age Estimation* Pattern Recognition Letters, https://doi.org/10.1016/j.patrec.2020.11.008 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
CHNxindong/corn-ordinal-neuralnet
CoralLayer
false
4,933
[ "MIT" ]
1
7f8a45614cb6488e9c019c5e9d3a5aee0d714e94
https://github.com/CHNxindong/corn-ordinal-neuralnet/tree/7f8a45614cb6488e9c019c5e9d3a5aee0d714e94
ConvNorm
import torch import torch.utils.data class ConvNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=None, dilation=1, bias=True, w_init_gain='linear'): super(ConvNorm, self).__init__() if padding is None: assert kernel_size % 2 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size...
CODEJIN/TacoSinger
ConvNorm
false
4,934
[ "MIT" ]
1
af58a8f4e8b20e8817990f28a3ba22168c853655
https://github.com/CODEJIN/TacoSinger/tree/af58a8f4e8b20e8817990f28a3ba22168c853655
group
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, mode=1): """ mfm :param in_channels: in channel :param out_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
CFengFeng/face-nn
group
false
4,935
[ "MIT" ]
1
a76a689774b5101959d3c5b8a04898ae82c7bfc2
https://github.com/CFengFeng/face-nn/tree/a76a689774b5101959d3c5b8a04898ae82c7bfc2
Metaloss
import torch import torch.nn as nn import torch.utils import torch.utils.data.distributed class Metaloss(nn.Module): def __init__(self): super(Metaloss, self).__init__() def forward(self, x): return x.mean(0).sum() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inpu...
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 import torch.utils.data.distributed assert_size_stride = torch._C._dynamo.guards.assert_size_stride...
CQUlearningsystemgroup/LearningToBinarize
Metaloss
false
4,936
[ "MIT" ]
1
1ecad897145af65ff52323bf2ec64a2154dc87d6
https://github.com/CQUlearningsystemgroup/LearningToBinarize/tree/1ecad897145af65ff52323bf2ec64a2154dc87d6
BinaryActivation
import torch import torch.nn as nn import torch.utils import torch.utils.data.distributed class BinaryActivation(nn.Module): def __init__(self): super(BinaryActivation, self).__init__() def forward(self, x): out_forward = torch.sign(x) mask1 = x < -1 mask2 = x < 0 mas...
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 import torch.utils.data.distributed assert_size_stride = torch._C._dynamo.guards.assert_size_stride...
CQUlearningsystemgroup/LearningToBinarize
BinaryActivation
false
4,937
[ "MIT" ]
1
1ecad897145af65ff52323bf2ec64a2154dc87d6
https://github.com/CQUlearningsystemgroup/LearningToBinarize/tree/1ecad897145af65ff52323bf2ec64a2154dc87d6
LocationLayer
import torch import torch.nn as nn import torch.utils.data class ConvNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=None, dilation=1, bias=True, w_init_gain='linear'): super(ConvNorm, self).__init__() if padding is None: 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
CODEJIN/TacoSinger
LocationLayer
false
4,938
[ "MIT" ]
1
af58a8f4e8b20e8817990f28a3ba22168c853655
https://github.com/CODEJIN/TacoSinger/tree/af58a8f4e8b20e8817990f28a3ba22168c853655
PostSynthesisProcessing
import torch class PostSynthesisProcessing(torch.nn.Module): def __init__(self): super().__init__() self.min_value = -1 self.max_value = 1 def forward(self, synthesized_image): synthesized_image = (synthesized_image - self.min_value ) * torch.tensor(255).float() /...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
CSID-DGU/-2020-1-OSSP1-ninetynine-2
PostSynthesisProcessing
false
4,939
[ "MIT" ]
1
b1824254882eeea0ee44e4e60896b72c51ef1d2c
https://github.com/CSID-DGU/-2020-1-OSSP1-ninetynine-2/tree/b1824254882eeea0ee44e4e60896b72c51ef1d2c
LogCoshLoss
import torch class LogCoshLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, true, pred): loss = true - pred return torch.mean(torch.log(torch.cosh(loss + 1e-12))) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def g...
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 assert_size...
CSID-DGU/-2020-1-OSSP1-ninetynine-2
LogCoshLoss
false
4,940
[ "MIT" ]
1
b1824254882eeea0ee44e4e60896b72c51ef1d2c
https://github.com/CSID-DGU/-2020-1-OSSP1-ninetynine-2/tree/b1824254882eeea0ee44e4e60896b72c51ef1d2c
LatentLoss
import torch class L1Loss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, true, pred): return torch.mean(torch.abs(true - pred)) class LogCoshLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, true, pred): lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
CSID-DGU/-2020-1-OSSP1-ninetynine-2
LatentLoss
false
4,941
[ "MIT" ]
1
b1824254882eeea0ee44e4e60896b72c51ef1d2c
https://github.com/CSID-DGU/-2020-1-OSSP1-ninetynine-2/tree/b1824254882eeea0ee44e4e60896b72c51ef1d2c
MaxBlock
import torch import torch.utils.data import torch.nn as nn class MaxBlock(nn.Module): def __init__(self, in_dim, out_dim): super().__init__() self.proj = nn.Linear(in_dim, out_dim) def forward(self, x): xm, _ = x.max(dim=1, keepdim=True) x = self.proj(x - xm) return x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
CS236G/pcgan
MaxBlock
false
4,942
[ "MIT" ]
1
e1ac013a087617f93c14347428a0d234d6d2a012
https://github.com/CS236G/pcgan/tree/e1ac013a087617f93c14347428a0d234d6d2a012
AttendedTextEncoding
import torch import torch.nn as nn class AttendedTextEncoding(nn.Module): def __init__(self, hidden_size): super(AttendedTextEncoding, self).__init__() self.sentence_linear = nn.Linear(hidden_size, hidden_size) self.att_linear1 = nn.Linear(hidden_size * 2, hidden_size // 2) self.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....
CFM-MSG/Code_LEORN
AttendedTextEncoding
false
4,943
[ "MIT" ]
1
fabea1e1ded973a4db692e51e2df442bde55f626
https://github.com/CFM-MSG/Code_LEORN/tree/fabea1e1ded973a4db692e51e2df442bde55f626
Flatten
import torch from torch import nn class Flatten(nn.Module): def __init__(self): super(Flatten, self).__init__() def forward(self, x): """ Arguments: x: a float tensor with shape [batch_size, c, h, w]. Returns: a float tensor with shape [batch_size, c*h...
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...
CTPLab/IID_representation_learning
Flatten
false
4,944
[ "MIT" ]
1
b9dc13536963f9af332b039f7cc772e2f1090c62
https://github.com/CTPLab/IID_representation_learning/tree/b9dc13536963f9af332b039f7cc772e2f1090c62
ResConvGLU
import math import torch class Conv1d(torch.nn.Conv1d): def __init__(self, *args, **kwargs): super(Conv1d, self).__init__(*args, **kwargs) def reset_parameters(self): torch.nn.init.kaiming_normal_(self.weight, nonlinearity='relu') if self.bias is not None: torch.nn.init.z...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride ...
CODEJIN/PWGAN_Torch
ResConvGLU
false
4,945
[ "MIT" ]
1
9bef273a55d1fa24575633d6473b304418e93374
https://github.com/CODEJIN/PWGAN_Torch/tree/9bef273a55d1fa24575633d6473b304418e93374
Discriminator
import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader as DataLoader class Discriminator(nn.Module): def __init__(self, in_size, hidden_size): super(Discriminator, self).__init__() self.L1 = nn.Linear(in_size, hidden_size) self.L2 = nn.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 import torch.nn as nn from torch.utils.data import DataLoader as DataLoader asse...
COMP6248-Reproducability-Challenge/Reproducible-Or-Not-Reproducible-That-Is-The-Question
Discriminator
false
4,946
[ "MIT" ]
1
7e2e632189a3669397f67efa99c8de4924967968
https://github.com/COMP6248-Reproducability-Challenge/Reproducible-Or-Not-Reproducible-That-Is-The-Question/tree/7e2e632189a3669397f67efa99c8de4924967968
Scale
import torch import torch.utils.data from torch import nn class Scale(nn.Module): def __init__(self, init_value=1.0): super(Scale, self).__init__() self.scale = nn.Parameter(torch.FloatTensor([init_value])) def forward(self, input): return input * self.scale 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 import torch.utils.data from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
CV-Rookie/EmbedMask
Scale
false
4,947
[ "MIT" ]
1
3b4d9fb4e0b6112dc501708184ff684dfb45f3f0
https://github.com/CV-Rookie/EmbedMask/tree/3b4d9fb4e0b6112dc501708184ff684dfb45f3f0
DenseCrossEntropy
import torch from torch import nn class DenseCrossEntropy(nn.Module): """ The CrossEntropy loss that takes the one-hot vector of the gt label as the input, should be equivalent to the standard CrossEntropy implementation. The one-hot vector is meant for the ArcFaceLoss and CutMix augmentation Ar...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
CTPLab/IID_representation_learning
DenseCrossEntropy
false
4,948
[ "MIT" ]
1
b9dc13536963f9af332b039f7cc772e2f1090c62
https://github.com/CTPLab/IID_representation_learning/tree/b9dc13536963f9af332b039f7cc772e2f1090c62