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
Baseline_FF_Network
import torch from torch import nn import torch.nn.functional as F class Baseline_FF_Network(nn.Module): def __init__(self): super().__init__() h1_dim = 500 h2_dim = 500 self.fc1 = nn.Linear(4, h1_dim) self.fc2 = nn.Linear(h1_dim, h2_dim) self.fc3 = nn.Linear(h1_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, math as tl_math fr...
saulsantos1997/Code
Baseline_FF_Network
false
10,737
[ "MIT" ]
0
fb824e3127c19a66bc9e03a56f9a8766a691bbb9
https://github.com/saulsantos1997/Code/tree/fb824e3127c19a66bc9e03a56f9a8766a691bbb9
FullyConnectedNetwork
import torch import torch.nn.functional as F class FullyConnectedNetwork(torch.nn.Module): def __init__(self, input_size, h1, h2, output_size): super().__init__() self.layer_1 = torch.nn.Linear(input_size, h1) self.layer_2 = torch.nn.Linear(h1, h2) self.layer_3 = torch.nn.Linear(h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
saurabhkakade21/AIS_spring2021
FullyConnectedNetwork
false
10,738
[ "MIT" ]
0
784d20670794c405505b09c1feea36e0a504ae5d
https://github.com/saurabhkakade21/AIS_spring2021/tree/784d20670794c405505b09c1feea36e0a504ae5d
adaILN
import torch import torch.onnx from torch import nn import torch from torch.nn.parameter import Parameter class adaILN(nn.Module): def __init__(self, num_features, eps=1e-05): super(adaILN, self).__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.onnx from torch import nn import torch from torch.nn.parameter imp...
rtolps/Cats2dogs_ONNX
adaILN
false
10,739
[ "MIT" ]
0
9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc
https://github.com/rtolps/Cats2dogs_ONNX/tree/9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc
discriminator
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super(avgpool, self).__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
nathalia-kim/nu_gan
discriminator
false
10,740
[ "MIT" ]
0
c1d0891945bd7ac3d95869db91f490f57f203110
https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110
SmallMnist
import torch import torch.nn as nn import torch.nn import torch.utils.data import torch.utils.tensorboard._pytorch_graph class SmallMnist(nn.Module): def __init__(self): super(SmallMnist, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.relu1 = nn.ReLU() self.con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
quic-akhobare/aimet
SmallMnist
false
10,741
[ "BSD-3-Clause" ]
0
1811a0ef58a75d103e173731b436876ee5dc4c49
https://github.com/quic-akhobare/aimet/tree/1811a0ef58a75d103e173731b436876ee5dc4c49
MemoryWriter
import torch import torch.nn as nn class MemoryWriter(nn.Module): def __init__(self, state_size, memory_size, device): super(MemoryWriter, self).__init__() self.device = device self.state_size = state_size self.memory_size = memory_size self.fc_r = nn.Linear(state_size + m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning
MemoryWriter
false
10,742
[ "MIT" ]
0
3663a1c7a89fe18974d13c9dc78ac7a99dac2300
https://github.com/rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning/tree/3663a1c7a89fe18974d13c9dc78ac7a99dac2300
BCELoss
import torch import torch.nn as nn import torch.nn.functional as F def binary_cross_entropy(inputs, target, weight=None, reduction='mean', smooth_eps=None, from_logits=False): """cross entropy loss, with support for label smoothing https://arxiv.org/abs/1512.00567""" smooth_eps = smooth_eps or 0 if sm...
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...
schokoro/torchutils
BCELoss
false
10,743
[ "MIT" ]
0
bcab35e8c943a1fcd4550fbb023188fa5d688663
https://github.com/schokoro/torchutils/tree/bcab35e8c943a1fcd4550fbb023188fa5d688663
BertOutput
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class BertOutput(nn.Module): def __init__(self, config): super(BertOutput, self).__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
minjoong507/TVRetrieval
BertOutput
false
10,744
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
MaxMarginRankingLoss
import torch import torch.nn as nn import torch.nn.functional as F class MaxMarginRankingLoss(nn.Module): def __init__(self, margin=1): super(MaxMarginRankingLoss, self).__init__() self.margin = margin def forward(self, x): n = x.size()[0] x1 = torch.diag(x) x1 = x1.u...
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...
minjoong507/TVRetrieval
MaxMarginRankingLoss
false
10,745
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
DepthwiseSeparableConv
import torch import torch.nn as nn import torch.nn.functional as F 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_...
minjoong507/TVRetrieval
DepthwiseSeparableConv
false
10,746
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
StableLayerNorm
import torch from torch import nn class StableLayerNorm(nn.Module): def __init__(self, dim): super().__init__() self.norm = nn.LayerNorm(dim) def forward(self, x): x = x / x.amax(dim=-1, keepdim=True).detach() return self.norm(x) def get_inputs(): return [torch.rand([4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
ryok/nuwa-pytorch
StableLayerNorm
false
10,747
[ "MIT" ]
0
6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
https://github.com/ryok/nuwa-pytorch/tree/6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
LayerNormChan
import torch from torch import nn class LayerNormChan(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.eps = eps self.g = nn.Parameter(torch.ones(1, dim, 1, 1)) self.b = nn.Parameter(torch.zeros(1, dim, 1, 1)) def forward(self, x): var = torch.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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ryok/nuwa-pytorch
LayerNormChan
false
10,748
[ "MIT" ]
0
6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
https://github.com/ryok/nuwa-pytorch/tree/6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
DeltaGFit
import torch from scipy import constants import torch.nn as nn import torch as t class DeltaGFit(nn.Module): def __init__(self, deltaG): super(DeltaGFit, self).__init__() self.deltaG = deltaG def forward(self, temperature, X, k_int, timepoints): """ # inputs, list of: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
sebaztiano/PyHDX
DeltaGFit
false
10,749
[ "MIT" ]
0
12fc2b5f67200885706226823bd8e1f46e3b5db1
https://github.com/sebaztiano/PyHDX/tree/12fc2b5f67200885706226823bd8e1f46e3b5db1
MemoryReader
import torch import torch.nn as nn class MemoryReader(nn.Module): def __init__(self, state_size, memory_size, h_size, device): super(MemoryReader, self).__init__() self.device = device self.state_size = state_size self.memory_size = memory_size self.h_size = h_size ...
import torch from torch._inductor.select_algorithm import extern_kernels from torch._C import _cuda_getCurrentRawStream as get_raw_stream import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning
MemoryReader
false
10,750
[ "MIT" ]
0
3663a1c7a89fe18974d13c9dc78ac7a99dac2300
https://github.com/rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning/tree/3663a1c7a89fe18974d13c9dc78ac7a99dac2300
Prenet
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
poria-cat/Transformer-TTS-Pytorch
Prenet
false
10,751
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
GCN
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.functional as F class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __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 import triton_helpers from torch._inductor.runtime....
seanli3/pygcn
GCN
false
10,753
[ "MIT" ]
0
134a17f1dbd7737f8a8b7efca5f20f882ee97144
https://github.com/seanli3/pygcn/tree/134a17f1dbd7737f8a8b7efca5f20f882ee97144
BertAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
minjoong507/TVRetrieval
BertAttention
false
10,754
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
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.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
minjoong507/TVRetrieval
TrainablePositionalEncoding
false
10,755
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
FeedForward
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
poria-cat/Transformer-TTS-Pytorch
FeedForward
false
10,756
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
StandardizedConv2d
import torch import torch.nn as nn import torch.nn.functional as F class StandardizedConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(StandardizedConv2d, self).__init__(in_channels, out_channels, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
omry/vissl
StandardizedConv2d
false
10,757
[ "MIT" ]
0
7d724869a9aeef8acd8b43f60d8bb4b39199aa3d
https://github.com/omry/vissl/tree/7d724869a9aeef8acd8b43f60d8bb4b39199aa3d
Actor
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class Actor(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=400, hidden2=300): super(Actor, self).__init__() self.fc1 = nn.Linear(nb_states, hidden1) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
sergiogcharles/LNAS
Actor
false
10,759
[ "MIT" ]
0
f72eb7d49f139caee54f6a6a9b7c21c1bc230e85
https://github.com/sergiogcharles/LNAS/tree/f72eb7d49f139caee54f6a6a9b7c21c1bc230e85
EncoderLayer
import torch import torch.nn.functional as F import torch.nn as nn def padding_mask(inputs, padding_idx=0): mask = (inputs == padding_idx).bool() return mask class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
poria-cat/Transformer-TTS-Pytorch
EncoderLayer
false
10,760
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
DecoderLayer
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
poria-cat/Transformer-TTS-Pytorch
DecoderLayer
false
10,761
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(DiceLoss, self).__init__() def forward(self, inputs, targets, smooth=1): inputs = torch.sigmoid(inputs) inputs = inputs.view(-1) targets = targets.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 from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
salem-devloper/Lung-Segmentation-Non-Covid
DiceLoss
false
10,762
[ "MIT" ]
0
11eb87e46014aefaf034239bf68b65c5eb55711d
https://github.com/salem-devloper/Lung-Segmentation-Non-Covid/tree/11eb87e46014aefaf034239bf68b65c5eb55711d
NCELoss
import torch import torch.nn as nn class NCELoss(nn.Module): """ Eq. (12): L_{NCE} """ def __init__(self, temperature, device): super(NCELoss, self).__init__() self.device = device self.criterion = nn.CrossEntropyLoss() self.temperature = temperature self.cossi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
salesforce/CoSeRec
NCELoss
false
10,763
[ "BSD-3-Clause" ]
0
c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
https://github.com/salesforce/CoSeRec/tree/c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
QGCNLastLayer
from torch.nn import Module import torch from torch.nn import Linear class QGCNLastLayer(Module): def __init__(self, left_in_dim, right_in_dim, out_dim): super(QGCNLastLayer, self).__init__() self._left_linear = Linear(left_in_dim, 1) self._right_linear = Linear(right_in_dim, out_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.nn import Module from torch.nn import Linear assert_size_stride = tor...
shovalf/QGCN-better
QGCNLastLayer
false
10,764
[ "MIT" ]
0
9d4f0bc3b08b08ebd7915ba31dda862e42727214
https://github.com/shovalf/QGCN-better/tree/9d4f0bc3b08b08ebd7915ba31dda862e42727214
NTXent
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class NTXent(nn.Module): """ Contrastive loss with distributed data parallel support code: https://github.com/AndrewAtanov/simclr-pytorch/blob/master/models/losses.py """ LARGE_NUMBER = 1000000000.0 def __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 import triton_helpers from torch._inductor.runtime....
salesforce/CoSeRec
NTXent
false
10,765
[ "BSD-3-Clause" ]
0
c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
https://github.com/salesforce/CoSeRec/tree/c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
Patch2Image
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data class Patch2Image(nn.Module): """ take in patch and copy n_up times to form the full image""" def __init__(self, patch_sz, n_up): super(Patch2Image, self).__init__() self.patch_sz = patch_sz ...
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.parallel import torch.optim import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert...
nudro/counterfactual_generative_networks
Patch2Image
false
10,766
[ "MIT" ]
0
0d000903ad9da4eab0f4d397395a769c9c7bff5d
https://github.com/nudro/counterfactual_generative_networks/tree/0d000903ad9da4eab0f4d397395a769c9c7bff5d
FCN_Net
import torch import numpy as np from torch import nn import torch._utils class FCN_Net(nn.Module): def __init__(self, in_channels=1, n_class=1): super().__init__() self.conv1_1 = nn.Conv3d(in_channels, 8, 3, padding=60) self.relu1_1 = nn.ReLU(inplace=True) self.conv1_2 = nn.Conv3d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np from torch...
ilcessadecalcular/segmentation
FCN_Net
false
10,767
[ "MIT" ]
0
24ba499a399efdba212ec5e2235b72ed8270cc24
https://github.com/ilcessadecalcular/segmentation/tree/24ba499a399efdba212ec5e2235b72ed8270cc24
MyElementwiseModule
import torch import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed class MyElementwiseModule(torch.nn.Module): def forward(self, x, y): return x * y + y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed as...
siaimes/examples
MyElementwiseModule
false
10,768
[ "BSD-3-Clause" ]
0
340d6fac5c4fce827c08b92b8f2aa7152b1a63b3
https://github.com/siaimes/examples/tree/340d6fac5c4fce827c08b92b8f2aa7152b1a63b3
HingeLoss
import torch import torch.nn as nn import torch.nn.functional as F class HingeLoss(nn.Module): """criterion for loss function y: 0/1 ground truth matrix of size: batch_size x output_size f: real number pred matrix of size: batch_size x output_size """ def __init__(self, margin=1.0, squared=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...
slevineg/X-Transformer
HingeLoss
false
10,769
[ "BSD-3-Clause" ]
0
c7a4341e1a1835960b1c724cbfbff4b3e669e130
https://github.com/slevineg/X-Transformer/tree/c7a4341e1a1835960b1c724cbfbff4b3e669e130
ClampExp
import torch import torch.utils.data class ClampExp(torch.nn.Module): """ Nonlinearity min(exp(lam * x), 1) """ def __init__(self): """ Constructor :param lam: Lambda parameter """ super(ClampExp, self).__init__() def forward(self, x): one = 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.utils.dat...
mbaddar1/normalizing-flows
ClampExp
false
10,770
[ "MIT" ]
0
d1409464a65234354b29ed9ea0ede2d12100440c
https://github.com/mbaddar1/normalizing-flows/tree/d1409464a65234354b29ed9ea0ede2d12100440c
RandomCrop
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data def choose_rand_patches(x, patch_sz, dim): assert dim == 2 or dim == 3 batch_sz = x.shape[0] patches = x.unfold(dim, patch_sz, 1) n_patches = patches.shape[2] idx = torch.randint(0, n_patches, (ba...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data assert_size_stride = torch...
nudro/counterfactual_generative_networks
RandomCrop
false
10,771
[ "MIT" ]
0
0d000903ad9da4eab0f4d397395a769c9c7bff5d
https://github.com/nudro/counterfactual_generative_networks/tree/0d000903ad9da4eab0f4d397395a769c9c7bff5d
AffineConstFlow
import torch import numpy as np import torch.nn as nn import torch.utils.data class Flow(nn.Module): """ Generic class for flow functions """ def __init__(self): super().__init__() def forward(self, z): """ :param z: input variable, first dimension is batch dim :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.triton_helpers import math as tl_math import numpy as np import torch.nn as nn import torch.utils.data assert_s...
mbaddar1/normalizing-flows
AffineConstFlow
false
10,772
[ "MIT" ]
0
d1409464a65234354b29ed9ea0ede2d12100440c
https://github.com/mbaddar1/normalizing-flows/tree/d1409464a65234354b29ed9ea0ede2d12100440c
Invertible1x1Conv
import torch import torch.nn as nn import torch.utils.data class Flow(nn.Module): """ Generic class for flow functions """ def __init__(self): super().__init__() def forward(self, z): """ :param z: input variable, first dimension is batch dim :return: transformed ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
mbaddar1/normalizing-flows
Invertible1x1Conv
false
10,773
[ "MIT" ]
0
d1409464a65234354b29ed9ea0ede2d12100440c
https://github.com/mbaddar1/normalizing-flows/tree/d1409464a65234354b29ed9ea0ede2d12100440c
Linear
import math import torch from torch import Tensor from torch.nn import Linear from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform(tensor, fan, a): if tensor ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import Tensor from torch.nn import Parameter import torch...
pwycl/pytorch_geometric
Linear
false
10,774
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
WeightedBCE
import torch from torch import nn class WeightedBCE(nn.Module): def __init__(self, weights=None): super().__init__() self.weights = weights def forward(self, inputs, targets): inputs = inputs.view(-1).float() targets = targets.view(-1).float() if self.weights is not 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.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
sophmrtn/RectAngle
WeightedBCE
false
10,775
[ "MIT" ]
0
941138fb63bdc3f3cb297a94fa057a16b88b00be
https://github.com/sophmrtn/RectAngle/tree/941138fb63bdc3f3cb297a94fa057a16b88b00be
Attention
import math import torch import torch.nn.functional as F import torch.utils.data def restricted_softmax(src, dim=-1, margin=0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp()) return 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
pwycl/pytorch_geometric
Attention
false
10,776
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, ft_dim, rnn_dim, attn_dim): super().__init__() self.enc_attn = nn.Linear(ft_dim, attn_dim) self.dec_attn = nn.Linear(rnn_dim, attn_dim) self.attn = nn.Linear(attn_dim, 1) self.relu = nn.ReLU(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
skasai5296/image_captioning
Attention
false
10,777
[ "MIT" ]
0
b4bb2c015a2bdce2040ab14fe2a53e9b79aa3c30
https://github.com/skasai5296/image_captioning/tree/b4bb2c015a2bdce2040ab14fe2a53e9b79aa3c30
DenseSAGEConv
import math import torch import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class DenseSAGEConv(torch.nn.Module): """See :class:`torch_geometric...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 from torch.nn imp...
pwycl/pytorch_geometric
DenseSAGEConv
false
10,778
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
Stalin3000_anal_probe
import torch from math import * import torch.nn as nn import torch.nn.functional as F class Stalin3000_anal_probe(nn.Module): def __init__(self, n): super(Stalin3000_anal_probe, self).__init__() self.n = n self.insider = nn.Linear(n, n + 2) self.hl1 = nn.Linear(n + 2, n + 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from math import * import tor...
skabrits/-
Stalin3000_anal_probe
false
10,779
[ "MIT" ]
0
396ccb457f1f1048377be6a8b8f5e5cf060f9b0d
https://github.com/skabrits/-/tree/396ccb457f1f1048377be6a8b8f5e5cf060f9b0d
Self_Attn
import torch import torch.nn as nn import torch.nn.parallel class Self_Attn(nn.Module): """ Self attention Layer""" def __init__(self, in_dim, activation): super(Self_Attn, self).__init__() self.chanel_in = in_dim self.activation = activation self.query_conv = nn.Conv2d(in_cha...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
qiyuqianxai/debvc
Self_Attn
false
10,780
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
SingleStream
from _paritybench_helpers import _mock_config import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.init as torch_init def calculate_l1_norm(f): f_norm = torch.norm(f, p=2, dim=-1, keepdim=True) f = torch.div(f, f_norm) return f class SingleStream(nn.Module): def __init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
LeonHLJ/MMSD
SingleStream
false
10,781
[ "MIT" ]
0
e39838e4e38524a670c08cc696a65da8ae01f648
https://github.com/LeonHLJ/MMSD/tree/e39838e4e38524a670c08cc696a65da8ae01f648
DenseGCNConv
import math import torch from torch.nn import Parameter import torch.utils.data def glorot(tensor): if tensor is not None: stdv = math.sqrt(6.0 / (tensor.size(-2) + tensor.size(-1))) tensor.data.uniform_(-stdv, stdv) def zeros(tensor): if tensor is not None: tensor.data.fill_(0) cl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
pwycl/pytorch_geometric
DenseGCNConv
false
10,782
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
MultiHead
import math import torch from torch import Tensor from torch.nn import Linear import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
pwycl/pytorch_geometric
MultiHead
false
10,783
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
ResidualBlock
import torch import torch.nn as nn import torch.nn.parallel class ResidualBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, padding=1, stride=1): super(ResidualBlock, self).__init__() self.padding1 = nn.ReflectionPad2d(padding) self.conv1 = nn.Conv2d(i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
qiyuqianxai/debvc
ResidualBlock
false
10,784
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
LearnablePositionalEncoding
import torch import torch.nn as nn class LearnablePositionalEncoding(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=1024): super(LearnablePositionalEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) self.pe = nn.Parameter(torch.empty(max_len, 1, d_model)) ...
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...
saverymax/mvts_transformer
LearnablePositionalEncoding
false
10,785
[ "MIT" ]
0
22796d6977b78d5636f6aad3f7efeb49f2991808
https://github.com/saverymax/mvts_transformer/tree/22796d6977b78d5636f6aad3f7efeb49f2991808
FeatureCorrelation
import torch import torch.nn as nn import torch.nn def featureL2Norm(feature): epsilon = 1e-06 norm = torch.pow(torch.sum(torch.pow(feature, 2), 1) + epsilon, 0.5 ).unsqueeze(1).expand_as(feature) return torch.div(feature, norm) class FeatureCorrelation(torch.nn.Module): def __init__(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sebastian-echeverria/ncnet
FeatureCorrelation
false
10,786
[ "MIT" ]
0
c7249fe8f908813bab6443ebfa4590bd362a0dc2
https://github.com/sebastian-echeverria/ncnet/tree/c7249fe8f908813bab6443ebfa4590bd362a0dc2
NonlocalWeightedAverage
import torch import torch.nn as nn import torch.nn.parallel import torch.nn.functional as F def find_local_patch(x, patch_size): N, _C, H, W = x.shape x_unfold = F.unfold(x, kernel_size=(patch_size, patch_size), padding=( patch_size // 2, patch_size // 2), stride=(1, 1)) return x_unfold.view(N, 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....
qiyuqianxai/debvc
NonlocalWeightedAverage
false
10,787
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
Xigmoid
import torch import torch.nn as nn def xigmoid(x, alpha=1.0): cond = x > 0 ax = alpha * x if_x = torch.exp(ax) else_x = 1.0 / if_x if_x = if_x - 1.0 else_x = 1.0 - else_x cond_x = torch.where(cond, if_x, else_x) return torch.sigmoid(alpha * cond_x) class Xigmoid(nn.Module): def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
privateos/xigmoid
Xigmoid
false
10,788
[ "MIT" ]
0
3d01c65a7f82ce0d851a42d7e38f084eae2b1622
https://github.com/privateos/xigmoid/tree/3d01c65a7f82ce0d851a42d7e38f084eae2b1622
Net
import torch import torch.nn import torch.nn.functional as F import torch.nn as nn class Net(nn.Module): def __init__(self, n_feature, n_hidden1, n_hidden2, n_hidden3, n_hidden4, n_hidden5, n_output): super(Net, self).__init__() self.hidden1 = torch.nn.Linear(n_feature, n_hidden1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 import torch....
smit25/Code-Clone-Detection-Using-Intermediate-Merge-Siamese-Network
Net
false
10,789
[ "MIT" ]
0
73298836b565febf67c2144a4cacdd2a039d8677
https://github.com/smit25/Code-Clone-Detection-Using-Intermediate-Merge-Siamese-Network/tree/73298836b565febf67c2144a4cacdd2a039d8677
LayerNorm
import torch from torch import nn from torch.nn import functional as F import torch.utils.data class LayerNorm(nn.Module): def __init__(self, channels, eps=1e-05): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channels)) se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.utils.data assert_size_stride = torch._C._dyn...
roedoejet/vits
LayerNorm
false
10,790
[ "MIT" ]
0
982e3632c876562563bc74c37d485eaf53715ecc
https://github.com/roedoejet/vits/tree/982e3632c876562563bc74c37d485eaf53715ecc
AddNorm
import torch from torch import nn class AddNorm(nn.Module): def __init__(self, features, dropout=0.0, **kwargs): super(AddNorm, self).__init__(**kwargs) self.dropout = nn.Dropout(dropout) self.ln = nn.LayerNorm(features) def forward(self, x, y): return self.ln(self.dropout(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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
sudarshan85/transformer_tutorial
AddNorm
false
10,791
[ "MIT" ]
0
a7fc327f0d952d38b3f711fe21ba416616ba8d7e
https://github.com/sudarshan85/transformer_tutorial/tree/a7fc327f0d952d38b3f711fe21ba416616ba8d7e
ContextLoss
import torch import torch.nn.functional as F import torch.nn as nn class ContextLoss(nn.Module): def __init__(self): super(ContextLoss, self).__init__() def forward(self, generated, corrupted, weight_mask): c_loss = weight_mask * F.l1_loss(generated, corrupted) c_loss = c_loss.mean(d...
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 ...
suhongkim/Image-Inpainting
ContextLoss
false
10,792
[ "MIT" ]
0
6a3f43b95de2c39aaaf60050211ff03856f24456
https://github.com/suhongkim/Image-Inpainting/tree/6a3f43b95de2c39aaaf60050211ff03856f24456
PredictionConvolutions
import torch from torch import nn from itertools import product as product import torch.optim import torch.utils.data class PredictionConvolutions(nn.Module): """ Convolutions to predict class scores and bounding boxes using lower and higher-level feature maps. The bounding boxes (locations) are predicte...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from itertools import product as product import torch.optim...
mosevg/ssd
PredictionConvolutions
false
10,793
[ "MIT" ]
0
8fd9f6cc376c027427531bcf475188ae43c4b2d6
https://github.com/mosevg/ssd/tree/8fd9f6cc376c027427531bcf475188ae43c4b2d6
Resize
import torch import torch.nn.functional as F class Resize(torch.nn.Module): def __init__(self, size, mode='bilinear'): super().__init__() self.size = size self.mode = mode def forward(self, img): return F.interpolate(img, size=self.size, mode=self.mode, align_corn...
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...
rlmwang/torch-tools
Resize
false
10,794
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
ChannelNorm
import torch import torch.nn as nn def channel_norm(image): img = image.flatten(2) avg = img.mean(-1)[:, :, None, None] var = img.var(-1)[:, :, None, None] return (image - avg) / torch.sqrt(var + 1e-06) class ChannelNorm(nn.Module): def forward(self, image): return channel_norm(image) ...
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_...
rlmwang/torch-tools
ChannelNorm
false
10,795
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
ChannelScale
import torch import torch.nn as nn def channel_scale(image): img = image.flatten(2) vmin = img.min(-1)[0][:, :, None, None] vmax = img.max(-1)[0][:, :, None, None] return (image - vmin) / (vmax - vmin + 1e-06) class ChannelScale(nn.Module): def forward(self, image): return channel_scale...
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...
rlmwang/torch-tools
ChannelScale
false
10,796
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
SelfAttention
import torch import torch.nn as nn class SelfAttention(nn.Module): def __init__(self, embed_size, heads): super(SelfAttention, self).__init__() self.embed_size = embed_size self.heads = heads self.head_dimension = embed_size // heads assert self.head_dimension * self.heads...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
shahrukhx01/transformers-bisected
SelfAttention
false
10,797
[ "Apache-2.0" ]
0
a97647aca7963e6f9d4fce5a067ba68d393072d6
https://github.com/shahrukhx01/transformers-bisected/tree/a97647aca7963e6f9d4fce5a067ba68d393072d6
Self_Attention
import torch import torch.nn as nn import torch.nn.parallel from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.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 from torch._inductor.runtime....
qiyuqianxai/debvc
Self_Attention
false
10,798
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
GlobalMaxPool2d
import torch import torch.nn as nn class GlobalMaxPool2d(nn.Module): def forward(self, inputs): return nn.functional.adaptive_max_pool2d(inputs, 1).view(inputs. size(0), -1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
rlmwang/torch-tools
GlobalMaxPool2d
false
10,799
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
Block
import torch import torch.nn as nn class Block(nn.Module): """ A ResNet module. """ def __init__(self, iDim, hDim): super().__init__() self.W0 = nn.Linear(iDim, hDim) self.W1 = nn.Linear(hDim, iDim) def LS(w): return w.weight.numel() + w.bias.numel() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
sparseinference/argmaxnet
Block
false
10,800
[ "MIT" ]
0
ff1e090a662d384f2ba4349494c9630079d2545b
https://github.com/sparseinference/argmaxnet/tree/ff1e090a662d384f2ba4349494c9630079d2545b
GlobalMaxPool1d
import torch import torch.nn as nn class GlobalMaxPool1d(nn.Module): def forward(self, inputs): return nn.functional.adaptive_max_pool1d(inputs, 1).view(inputs. size(0), -1) def get_inputs(): return [torch.rand([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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
rlmwang/torch-tools
GlobalMaxPool1d
false
10,801
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
GDeconv1DBlock
import torch import torch.nn as nn from torch.nn.utils.spectral_norm import spectral_norm def build_norm_layer(norm_type, param=None, num_feats=None): if norm_type == 'bnorm': return nn.BatchNorm1d(num_feats) elif norm_type == 'snorm': spectral_norm(param) return None elif norm_typ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.utils.spectral_norm import spectral_norm ass...
silvadirceu/segan_pytorch
GDeconv1DBlock
false
10,802
[ "MIT" ]
0
2215e711f7223b144e0c4d4fb4ed1d4842b18c5f
https://github.com/silvadirceu/segan_pytorch/tree/2215e711f7223b144e0c4d4fb4ed1d4842b18c5f
WeightedAverage
import torch import torch.nn as nn import torch.nn.parallel import torch.nn.functional as F def find_local_patch(x, patch_size): N, _C, H, W = x.shape x_unfold = F.unfold(x, kernel_size=(patch_size, patch_size), padding=( patch_size // 2, patch_size // 2), stride=(1, 1)) return x_unfold.view(N, x_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
qiyuqianxai/debvc
WeightedAverage
false
10,803
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
MultiHeadAttention
import math import torch from torch import nn from torch.nn import functional as F import torch.utils.data class MultiHeadAttention(nn.Module): def __init__(self, channels, out_channels, n_heads, p_dropout=0.0, window_size=None, heads_share=True, block_length=None, proximal_bias=False, proximal_i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
roedoejet/vits
MultiHeadAttention
false
10,804
[ "MIT" ]
0
982e3632c876562563bc74c37d485eaf53715ecc
https://github.com/roedoejet/vits/tree/982e3632c876562563bc74c37d485eaf53715ecc
GRU122
import torch import torch.nn as nn class GRU122(nn.Module): def __init__(self, input_size, hidden_size): super(GRU122, self).__init__() self.hidden_size = hidden_size self.wir = nn.Linear(in_features=input_size, out_features=2 * hidden_size) self.whr = nn.Linear(in_fea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
smeznar/ProGED
GRU122
false
10,805
[ "BSD-3-Clause" ]
0
191cfd2b7b1fece819109a4b61e3f7533332fd74
https://github.com/smeznar/ProGED/tree/191cfd2b7b1fece819109a4b61e3f7533332fd74
NeuralModel
import torch import torch.nn as nn class NeuralModel(nn.Module): def __init__(self, input): super(NeuralModel, self).__init__() self.dense1 = nn.Linear(in_features=input, out_features=128) self.dense2 = nn.Linear(in_features=128, out_features=16) self.dense3 = nn.Linear(in_feature...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sumitsharmamanit/Facial-emotion-recognition
NeuralModel
false
10,806
[ "Apache-2.0" ]
0
f95770c0cfabd46a8f9589eb415ce69eaeaea4c6
https://github.com/sumitsharmamanit/Facial-emotion-recognition/tree/f95770c0cfabd46a8f9589eb415ce69eaeaea4c6
Envelope
import torch import torch.utils.data class Envelope(torch.nn.Module): def __init__(self, exponent): super(Envelope, self).__init__() self.p = exponent self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + 1) / 2 def forw...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
shnhrtkyk/pytorch_geometric
Envelope
false
10,807
[ "MIT" ]
0
b971fd2ebba10736e6398d6305757be2d81ca681
https://github.com/shnhrtkyk/pytorch_geometric/tree/b971fd2ebba10736e6398d6305757be2d81ca681
GRU221
import torch import torch.nn as nn class GRU221(nn.Module): def __init__(self, input_size, hidden_size): super(GRU221, self).__init__() self.wir = nn.Linear(in_features=input_size, out_features=hidden_size) self.whr = nn.Linear(in_features=2 * hidden_size, out_features= hidden...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
smeznar/ProGED
GRU221
false
10,808
[ "BSD-3-Clause" ]
0
191cfd2b7b1fece819109a4b61e3f7533332fd74
https://github.com/smeznar/ProGED/tree/191cfd2b7b1fece819109a4b61e3f7533332fd74
ContrastiveLoss
import torch import torch.nn as nn class ContrastiveLoss(nn.Module): def __init__(self, margin=1.0): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, x0, x1, y): diff = x0 - x1 dist_sq = torch.sum(torch.pow(diff, 2), 1) dist = torch.sqrt(...
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...
smit25/Siamese-Network-For-Minutiae-Point-Detection
ContrastiveLoss
false
10,809
[ "Apache-2.0" ]
0
453e2f91aed7e3d3e5ddb75a53cdfb164d2493d4
https://github.com/smit25/Siamese-Network-For-Minutiae-Point-Detection/tree/453e2f91aed7e3d3e5ddb75a53cdfb164d2493d4
DenseGraphConv
import math import torch from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class DenseGraphConv(torch.nn.Module): """See :class:`torch_geometric.nn.conv.GraphConv`. """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch.nn import Parameter import torch.utils.data assert_size_s...
shnhrtkyk/pytorch_geometric
DenseGraphConv
false
10,810
[ "MIT" ]
0
b971fd2ebba10736e6398d6305757be2d81ca681
https://github.com/shnhrtkyk/pytorch_geometric/tree/b971fd2ebba10736e6398d6305757be2d81ca681
ResidualLayer
import math import torch from torch import Tensor from torch.nn import Linear from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform(tensor, fan, a): if tensor ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import Tensor from torch.nn import Linear from torch.nn i...
shnhrtkyk/pytorch_geometric
ResidualLayer
false
10,811
[ "MIT" ]
0
b971fd2ebba10736e6398d6305757be2d81ca681
https://github.com/shnhrtkyk/pytorch_geometric/tree/b971fd2ebba10736e6398d6305757be2d81ca681
FullyCNN
import torch from torch import nn class FullyCNN(nn.Module): """UNET Without concatenation during decoding""" def __init__(self): super(FullyCNN, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=6, kernel_size=3, stride=1, padding=1, padding_mode='reflect') ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
quenting44/semantic_segmentation
FullyCNN
false
10,812
[ "MIT" ]
0
bd197ddda3c6891d69ff7e552a0c224c7ec1269a
https://github.com/quenting44/semantic_segmentation/tree/bd197ddda3c6891d69ff7e552a0c224c7ec1269a
_DynamicGates
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class _DynamicGates(nn.Module): """Internal class to wrap the dynamic gate parameters into a dedicated PyTorch Module""" def __init__(self, cfg: 'Config', input_size: 'int'): super(_DynamicGates, self).__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...
rro2q2/transfer-learning-aaai21
_DynamicGates
false
10,813
[ "BSD-3-Clause" ]
0
f1960540d0608ce1e4d1d64bb4abd29d953f250f
https://github.com/rro2q2/transfer-learning-aaai21/tree/f1960540d0608ce1e4d1d64bb4abd29d953f250f
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(64, 64, 3, stride=1, padding=1) self.fc1 = nn.Linear(65536, 10) self.maxpool = nn.AdaptiveMaxPool2d(32) def forward(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
surya00060/tvm
Net
false
10,814
[ "Zlib", "Unlicense", "Apache-2.0", "BSD-2-Clause", "MIT", "ECL-2.0" ]
0
fd4601514aee1ecf080b74578849c60438f55b0c
https://github.com/surya00060/tvm/tree/fd4601514aee1ecf080b74578849c60438f55b0c
Model
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self): super().__init__() self.conv1 = torch.nn.Conv2d(3, 32, kernel_size=6, stride=1, padding=1) self.conv2 = torch.nn.Conv2d(32, 32, kernel_size=6, stride=1, padding=1 ) self.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 assert_size_stride = torch._C...
stepan-krivanek/image-recognition
Model
false
10,815
[ "MIT" ]
0
6c421e768e83db489e4caa22989f7dad95519578
https://github.com/stepan-krivanek/image-recognition/tree/6c421e768e83db489e4caa22989f7dad95519578
NoiseBlock
import torch import torch.nn as nn import torch.jit class NoiseBlock(nn.Module): def __init__(self, sigma): super(NoiseBlock, self).__init__() self.sigma = sigma def forward(self, x): out = x + self.sigma * torch.randn_like(x) return out def set_sigma(self, x): s...
import torch from torch import device import 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.jit assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.ji...
shuj1234/Hopfield-ODE
NoiseBlock
false
10,816
[ "MIT" ]
0
2b770c0141082174f394b189df725088308d8bdd
https://github.com/shuj1234/Hopfield-ODE/tree/2b770c0141082174f394b189df725088308d8bdd
Attention
import torch from torch import nn class Attention(nn.Module): def __init__(self, feature_dim, max_seq_len=70): super().__init__() self.attention_fc = nn.Linear(feature_dim, 1) self.bias = nn.Parameter(torch.zeros(1, max_seq_len, 1, requires_grad=True)) def forward(self, r...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 fr...
tanreinama/jigsaw_unintendedbiasclassification_validation_model
Attention
false
10,817
[ "Apache-2.0" ]
0
af1644488e0d0f7d54ce5d8186ae38a8b079b2db
https://github.com/tanreinama/jigsaw_unintendedbiasclassification_validation_model/tree/af1644488e0d0f7d54ce5d8186ae38a8b079b2db
GateLayer
import torch from torch import nn class GateLayer(nn.Module): def __init__(self, input_dim): super(GateLayer, self).__init__() self._norm_layer1 = nn.Linear(input_dim * 2, input_dim) self._norm_layer2 = nn.Linear(input_dim, 1) def forward(self, input1, input2): norm_input = s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
shubaoyu/CRSLab
GateLayer
false
10,818
[ "MIT" ]
0
a05730e8b2c03df278587be34923fa818945d4c4
https://github.com/shubaoyu/CRSLab/tree/a05730e8b2c03df278587be34923fa818945d4c4
SelfAttentionBatch
import torch from torch import nn import torch.nn.functional as F class SelfAttentionBatch(nn.Module): def __init__(self, dim, da, alpha=0.2, dropout=0.5): super(SelfAttentionBatch, self).__init__() self.dim = dim self.da = da self.alpha = alpha self.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....
shubaoyu/CRSLab
SelfAttentionBatch
false
10,819
[ "MIT" ]
0
a05730e8b2c03df278587be34923fa818945d4c4
https://github.com/shubaoyu/CRSLab/tree/a05730e8b2c03df278587be34923fa818945d4c4
EncoderImageWeightNormPrecomp
import torch from collections import OrderedDict import torch.nn as nn import torch.nn.init from torch.nn.utils.weight_norm import weight_norm def l2norm(X, dim, eps=1e-08): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) retur...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 collections im...
sungjune-p/SCAN
EncoderImageWeightNormPrecomp
false
10,820
[ "Apache-2.0" ]
0
a3013944a05b48e952141fa295a8132d25da2e97
https://github.com/sungjune-p/SCAN/tree/a3013944a05b48e952141fa295a8132d25da2e97
MaskedWordPredictions
from _paritybench_helpers import _mock_config import math import torch from torch import nn def gelu(x): """Gaussian Error Linear Unitという活性化関数です。 LeLUが0でカクっと不連続なので、そこを連続になるように滑らかにした形のLeLUです。 """ return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class BertLayerNorm(nn.Module): def __init__(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
Cyndi-Tokyotech/Fin_Text_Analysis_ML
MaskedWordPredictions
false
10,821
[ "MIT" ]
0
7f9b6c1ea78f8e6f32c003b2de32809722df88d4
https://github.com/Cyndi-Tokyotech/Fin_Text_Analysis_ML/tree/7f9b6c1ea78f8e6f32c003b2de32809722df88d4
BinaryClassificationHead
from _paritybench_helpers import _mock_config import torch class BinaryClassificationHead(torch.nn.Module): def __init__(self, config): super().__init__() self.config = config self.dense = torch.nn.Linear(config.hidden_size, config.hidden_size) self.dropout = torch.nn.Dropout(conf...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
IgnatovFedor/DeepPavlov
BinaryClassificationHead
false
10,822
[ "Apache-2.0" ]
0
02ba9c4b2919384c142c170c7f89c65cf05dd426
https://github.com/IgnatovFedor/DeepPavlov/tree/02ba9c4b2919384c142c170c7f89c65cf05dd426
ODEfunc_single_conv
import torch import torch.nn as nn import torch.jit def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
shuj1234/Hopfield-ODE
ODEfunc_single_conv
false
10,823
[ "MIT" ]
0
2b770c0141082174f394b189df725088308d8bdd
https://github.com/shuj1234/Hopfield-ODE/tree/2b770c0141082174f394b189df725088308d8bdd
UNETWithoutPooling
import torch from torch import nn class UNETWithoutPooling(nn.Module): """UNET without pooling""" def __init__(self): super(UNETWithoutPooling, self).__init__() self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.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...
quenting44/semantic_segmentation
UNETWithoutPooling
false
10,824
[ "MIT" ]
0
bd197ddda3c6891d69ff7e552a0c224c7ec1269a
https://github.com/quenting44/semantic_segmentation/tree/bd197ddda3c6891d69ff7e552a0c224c7ec1269a
LocalEstimator
import torch import torch.nn as nn import torch.nn.functional as F class LocalEstimator(nn.Module): def __init__(self, input_size): super(LocalEstimator, self).__init__() self.input2hid = nn.Linear(input_size, 64) self.hid2hid = nn.Linear(64, 32) self.hid2out = nn.Linear(32, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
sunqcc/test
LocalEstimator
false
10,825
[ "MIT" ]
0
f913d2f33a4b85eed571ccf0b9a2d65dca594441
https://github.com/sunqcc/test/tree/f913d2f33a4b85eed571ccf0b9a2d65dca594441
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 128, 3, padding=1) self.conv2 = nn.Conv2d(128, 64, 3, padding=1) self.conv3 = nn.Conv2d(64, 3, 3, padding=1) def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
suttergustavo/SCC0251_Final_Project
Net
false
10,826
[ "MIT" ]
0
81b91ff6ee7675c8bfaedc6ada6bd09baa65d630
https://github.com/suttergustavo/SCC0251_Final_Project/tree/81b91ff6ee7675c8bfaedc6ada6bd09baa65d630
EncoderImagePrecomp
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(X, dim, eps=1e-08): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class EncoderImagePrecomp(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
sungjune-p/SCAN
EncoderImagePrecomp
false
10,827
[ "Apache-2.0" ]
0
a3013944a05b48e952141fa295a8132d25da2e97
https://github.com/sungjune-p/SCAN/tree/a3013944a05b48e952141fa295a8132d25da2e97
MLP
import torch def choose_nonlinearity(name): nl = None if name == 'tanh': nl = torch.tanh elif name == 'relu': nl = torch.relu elif name == 'sigmoid': nl = torch.sigmoid elif name == 'softplus': nl = torch.nn.functional.softplus elif name == 'selu': nl = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride ...
somu15/hamiltonian-nn
MLP
false
10,828
[ "Apache-2.0" ]
0
0c62e92cd50d4bda4b1d0345a4676a6c003aee5e
https://github.com/somu15/hamiltonian-nn/tree/0c62e92cd50d4bda4b1d0345a4676a6c003aee5e
UNETMin
import torch from torch import nn class UNETMin(nn.Module): """UNET Without concatenation during decoding""" def __init__(self): super(UNETMin, self).__init__() self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.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...
quenting44/semantic_segmentation
UNETMin
false
10,829
[ "MIT" ]
0
bd197ddda3c6891d69ff7e552a0c224c7ec1269a
https://github.com/quenting44/semantic_segmentation/tree/bd197ddda3c6891d69ff7e552a0c224c7ec1269a
Concat
import torch import torch.cuda import torch.nn import torch.utils.data import torch.fx import torch.utils.tensorboard._pytorch_graph class Concat(torch.nn.Module): """ Concat module for a functional concat""" def __init__(self, axis: 'int'=0): super(Concat, self).__init__() self.axis = axis ...
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.cuda import torch.nn import torch.utils.data import torch.fx import torch.utils.tensorboard._pytorch_graph assert_size_stride =...
mikeseven/aimet
Concat
false
10,830
[ "BSD-3-Clause" ]
0
63211a4f259b6457c58dfae1097c70acb93319fe
https://github.com/mikeseven/aimet/tree/63211a4f259b6457c58dfae1097c70acb93319fe
UNETWithoutConcat
import torch from torch import nn class UNETWithoutConcat(nn.Module): """UNET Without concatenation during decoding""" def __init__(self): super(UNETWithoutConcat, self).__init__() self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
quenting44/semantic_segmentation
UNETWithoutConcat
false
10,831
[ "MIT" ]
0
bd197ddda3c6891d69ff7e552a0c224c7ec1269a
https://github.com/quenting44/semantic_segmentation/tree/bd197ddda3c6891d69ff7e552a0c224c7ec1269a
UNET
import torch from torch import nn class UNET(nn.Module): def __init__(self): super(UNET, self).__init__() self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.Conv2d(in_channels=16, out_channels=16, kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
quenting44/semantic_segmentation
UNET
false
10,832
[ "MIT" ]
0
bd197ddda3c6891d69ff7e552a0c224c7ec1269a
https://github.com/quenting44/semantic_segmentation/tree/bd197ddda3c6891d69ff7e552a0c224c7ec1269a
BasicBlock
import torch import torch.utils.data import torch.nn as nn from collections import OrderedDict from torch.nn.functional import relu def conv3x3(in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
suulkyy/GPM
BasicBlock
false
10,833
[ "MIT" ]
0
f094012a6ea6ea145bd100d1481a984783ae14dd
https://github.com/suulkyy/GPM/tree/f094012a6ea6ea145bd100d1481a984783ae14dd
ODEfunc_double_conv
import torch import torch.nn as nn import torch.jit def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
shuj1234/Hopfield-ODE
ODEfunc_double_conv
false
10,834
[ "MIT" ]
0
2b770c0141082174f394b189df725088308d8bdd
https://github.com/shuj1234/Hopfield-ODE/tree/2b770c0141082174f394b189df725088308d8bdd
LocalConv2d
import torch import torch.nn as nn import torch.nn.functional as F class LocalConv2d(nn.Module): def __init__(self, num_rows, num_feats_in, num_feats_out, kernel=1, padding=0): super(LocalConv2d, self).__init__() self.num_rows = num_rows self.out_channels = num_feats_out 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
syKevinPeng/M3D-RPN
LocalConv2d
false
10,835
[ "MIT" ]
0
ae43248f0d64a83d7deef63308dd5ade25e7b751
https://github.com/syKevinPeng/M3D-RPN/tree/ae43248f0d64a83d7deef63308dd5ade25e7b751
GatedMaskedConv2d
import torch from torch import nn import torch.utils.data import torch.nn.functional as F class GatedMaskedConv2d(nn.Module): def __init__(self, in_dim, out_dim=None, kernel_size=3, mask='B'): super(GatedMaskedConv2d, self).__init__() if out_dim is None: out_dim = in_dim self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
sbarham/lv-nlm-he-2019
GatedMaskedConv2d
false
10,836
[ "MIT" ]
0
6fd1ce680675759d0a58878ac1fde31122712752
https://github.com/sbarham/lv-nlm-he-2019/tree/6fd1ce680675759d0a58878ac1fde31122712752
ChannelNorm
import torch import torch.nn as nn class ChannelNorm(nn.Module): def __init__(self, numFeatures, epsilon=1e-05, affine=True): super(ChannelNorm, self).__init__() if affine: self.weight = nn.parameter.Parameter(torch.Tensor(1, numFeatures, 1)) self.bias = nn...
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_...
raphaelreme/CPC_audio
ChannelNorm
false
10,837
[ "MIT" ]
0
a2b045d5f03f4a73beaab9b481244e454edacbaa
https://github.com/raphaelreme/CPC_audio/tree/a2b045d5f03f4a73beaab9b481244e454edacbaa
Highway
import torch import torch.nn as nn class Highway(nn.Module): def __init__(self, in_size, out_size): super(Highway, self).__init__() self.H = nn.Linear(in_size, out_size) self.H.bias.data.zero_() self.T = nn.Linear(in_size, out_size) self.T.bias.data.fill_(-1) self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
seo3650/Tacotron-pytorch
Highway
false
10,838
[ "MIT" ]
0
223e4f39a3624c409484a1ad55edab1563cf8c87
https://github.com/seo3650/Tacotron-pytorch/tree/223e4f39a3624c409484a1ad55edab1563cf8c87