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
VitMlpHead
import torch def get_args(): parser = argparse.ArgumentParser() group = parser.add_argument_group(title='input data') group.add_argument('--input', type=str, required=True, help= 'Path to input JSON') group.add_argument('--json-keys', nargs='+', default=['text'], help= 'space separate ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
deepakn94/Megatron-DeepSpeed
VitMlpHead
false
10,028
[ "MIT" ]
0
541b967fbf9fd97ce090ca464ccd205b55aae59c
https://github.com/deepakn94/Megatron-DeepSpeed/tree/541b967fbf9fd97ce090ca464ccd205b55aae59c
ScaledDotProductAttention
import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, temperature, dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.temperature = temperature self.dropout = nn.Dropout(p=dropout) def forward(self, q, k, v, mask=None): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
connoisseures/vedastr
ScaledDotProductAttention
false
10,029
[ "Apache-2.0" ]
0
5dc64f3f6f810f615414aec3508e5dfba1239216
https://github.com/connoisseures/vedastr/tree/5dc64f3f6f810f615414aec3508e5dfba1239216
CORblock_Z
import torch from torch import nn class CORblock_Z(nn.Module): """ CORblock_Z is a computational area of CORnet-Z """ def __init__(self, in_channels, out_channels, kernel_size=3, stride=1): super().__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size= ke...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
emaliemcmahon/dl-final-proj-spring21-group2
CORblock_Z
false
10,030
[ "MIT" ]
0
51abed6633c4b326e62d26c1600256a959b39510
https://github.com/emaliemcmahon/dl-final-proj-spring21-group2/tree/51abed6633c4b326e62d26c1600256a959b39510
BasicLinearReLULinear
import torch import torch.nn as nn class BasicLinearReLULinear(nn.Module): def __init__(self, in_features, out_features=5, bias=False): super().__init__() self.fc1 = nn.Linear(in_features, out_features, bias=bias) self.relu1 = nn.ReLU() self.fc2 = nn.Linear(out_features, 1, bias=b...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
dkrako/captum
BasicLinearReLULinear
false
10,031
[ "BSD-3-Clause" ]
0
b5297bacbaec4e37f353a27de5e728bc2cbc1694
https://github.com/dkrako/captum/tree/b5297bacbaec4e37f353a27de5e728bc2cbc1694
BasicLinearNet
import torch import torch.nn as nn class BasicLinearNet(nn.Module): def __init__(self, in_features, hidden_nodes, out_features): super().__init__() self.linear1 = nn.Linear(in_features, hidden_nodes) self.linear2 = nn.Linear(hidden_nodes, out_features) 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.triton_helpers import libdevice import torch.nn as ...
dkrako/captum
BasicLinearNet
false
10,032
[ "BSD-3-Clause" ]
0
b5297bacbaec4e37f353a27de5e728bc2cbc1694
https://github.com/dkrako/captum/tree/b5297bacbaec4e37f353a27de5e728bc2cbc1694
HighwayLayer
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.utils.checkpoint import torch.utils.tensorboard def my_xavier_init(m, gain=1): """Xavier initialization: weights initialization that tries to make variance of outputs of a layer equal to variance of its ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
ali-senguel/fairo-explore
HighwayLayer
false
10,033
[ "MIT" ]
0
893481da270eed1e6d504c71e483d685ca9218d1
https://github.com/ali-senguel/fairo-explore/tree/893481da270eed1e6d504c71e483d685ca9218d1
BertMultiPooler
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class BertMultiPooler(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
doduo-anonymous/doduo-submission
BertMultiPooler
false
10,034
[ "Apache-2.0" ]
0
34d397c14174d64e6a3026d51cc25560a4f1e29f
https://github.com/doduo-anonymous/doduo-submission/tree/34d397c14174d64e6a3026d51cc25560a4f1e29f
make_style
import torch from torch import nn import torch.nn.functional as F class make_style(nn.Module): def __init__(self): super().__init__() self.flatten = nn.Flatten() def forward(self, x0): style = F.avg_pool2d(x0, kernel_size=(x0.shape[-2], x0.shape[-1])) style = self.flatten(sty...
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...
dkurt/cellpose
make_style
false
10,035
[ "BSD-3-Clause" ]
0
975821a5d75ce5f1b40b7a95ed0bd45cf99a0acb
https://github.com/dkurt/cellpose/tree/975821a5d75ce5f1b40b7a95ed0bd45cf99a0acb
BehaviorAggregator
import torch from torch import nn class BehaviorAggregator(nn.Module): def __init__(self, embedding_dim, gamma=0.5, aggregator='mean', dropout_rate=0.0): super(BehaviorAggregator, self).__init__() self.aggregator = aggregator self.gamma = gamma self.W_v = nn.Linear(embeddi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
byzhang/OpenMatch
BehaviorAggregator
false
10,036
[ "Apache-2.0" ]
0
28b2d49a5eec2e1dc3934767c747ff0ca6c93d96
https://github.com/byzhang/OpenMatch/tree/28b2d49a5eec2e1dc3934767c747ff0ca6c93d96
AddSubNet
import torch from torch import nn class AddSubNet(nn.Module): """ Simple AddSub network in PyTorch. This network outputs the sum and subtraction of the inputs. """ def __init__(self): super(AddSubNet, self).__init__() def forward(self, input0, input1): return torch.sub(input0...
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...
fivetran-VitaliyMalkin/server
AddSubNet
false
10,037
[ "BSD-3-Clause" ]
0
643840a61038aa090c37e1544826264925d0b483
https://github.com/fivetran-VitaliyMalkin/server/tree/643840a61038aa090c37e1544826264925d0b483
FeatureWiseAffine
import torch class BaseModule(torch.nn.Module): def __init__(self): super(BaseModule, self).__init__() @property def nparams(self): return sum(p.numel() for p in self.parameters() if p.requires_grad) class FeatureWiseAffine(BaseModule): def __init__(self): super(FeatureWis...
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...
dodoproptit99/WaveGrad
FeatureWiseAffine
false
10,038
[ "BSD-3-Clause" ]
0
d5e3cb5d8c1c3d115eeb5f1673b87bdbb36f79e0
https://github.com/dodoproptit99/WaveGrad/tree/d5e3cb5d8c1c3d115eeb5f1673b87bdbb36f79e0
BasicModulationBlock
import torch class BaseModule(torch.nn.Module): def __init__(self): super(BaseModule, self).__init__() @property def nparams(self): return sum(p.numel() for p in self.parameters() if p.requires_grad) class Conv1dWithInitialization(BaseModule): def __init__(self, **kwargs): ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
dodoproptit99/WaveGrad
BasicModulationBlock
false
10,039
[ "BSD-3-Clause" ]
0
d5e3cb5d8c1c3d115eeb5f1673b87bdbb36f79e0
https://github.com/dodoproptit99/WaveGrad/tree/d5e3cb5d8c1c3d115eeb5f1673b87bdbb36f79e0
PVABlock
import torch import torch.nn as nn def constant_init(module, val, bias=0): nn.init.constant_(module.weight, val) if hasattr(module, 'bias') and module.bias is not None: nn.init.constant_(module.bias, bias) def kaiming_init(module, a=0, is_rnn=False, mode='fan_in', nonlinearity= 'leaky_relu', bia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
connoisseures/vedastr
PVABlock
false
10,040
[ "Apache-2.0" ]
0
5dc64f3f6f810f615414aec3508e5dfba1239216
https://github.com/connoisseures/vedastr/tree/5dc64f3f6f810f615414aec3508e5dfba1239216
Invertible1x1Conv
import torch import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data class Invertible1x1Conv(torch.nn.Module): """ The layer outputs both the convolution, and the log determinant of its weight matrix. If reverse=True it does convolution with inverse """ de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.functional as F from torch.autograd import Variable import torch...
eba472/fastPitchPyTorch
Invertible1x1Conv
false
10,041
[ "BSD-3-Clause" ]
0
0f946c05539102e6868f72f5bf2c461d9711e7d7
https://github.com/eba472/fastPitchPyTorch/tree/0f946c05539102e6868f72f5bf2c461d9711e7d7
GumbelSoftmaxLayer
import torch import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch.distributions def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0, training: 'bool'=True, straight_through: 'bool'=False): size = log...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch...
cjlovering/EGG
GumbelSoftmaxLayer
false
10,042
[ "MIT" ]
0
cce146e035decbc410e981f8bc7ada32979f3b6d
https://github.com/cjlovering/EGG/tree/cce146e035decbc410e981f8bc7ada32979f3b6d
SparseDecoder
import torch import numpy as np from torch import Tensor import torch.nn as nn from scipy.special import erfinv class SparseDecoder(nn.Module): def __init__(self, seq_len, alphabet_size, latent_dim, h1_dim=100, h2_dim=500, n_tiles=4, conv_size=40, scale_mu=0.01, scale_sigma=4.0): """ ...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
charlesxu90/DeepSequence-torch
SparseDecoder
false
10,043
[ "MIT" ]
0
640db39769a93ef3d5bc11d6ad05aa7f5d761972
https://github.com/charlesxu90/DeepSequence-torch/tree/640db39769a93ef3d5bc11d6ad05aa7f5d761972
StackTime
import torch import torch.nn as nn import torch.utils.data import torch.jit import torch.optim import torch.utils.collect_env import torch.nn.parallel import torch.utils.data.distributed class StackTime(nn.Module): def __init__(self, factor): super().__init__() self.factor = int(factor) 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 import torch.nn as nn import torch.utils.data import torch.jit import torch.optim import torch.utils.collect_env import torch.nn.parallel im...
cometta/training
StackTime
false
10,044
[ "Apache-2.0" ]
0
2f33c36d5aa2e1c2770fb3bab35afc8c665e01ce
https://github.com/cometta/training/tree/2f33c36d5aa2e1c2770fb3bab35afc8c665e01ce
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...
firefighter-eric/SentEmbedding
Similarity
false
10,045
[ "MIT" ]
0
c1ad140c42ef946ac7d155a85581c0cf35871133
https://github.com/firefighter-eric/SentEmbedding/tree/c1ad140c42ef946ac7d155a85581c0cf35871133
ConvolutionBlock
import torch class BaseModule(torch.nn.Module): def __init__(self): super(BaseModule, self).__init__() @property def nparams(self): return sum(p.numel() for p in self.parameters() if p.requires_grad) class Conv1dWithInitialization(BaseModule): def __init__(self, **kwargs): ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
dodoproptit99/WaveGrad
ConvolutionBlock
false
10,046
[ "BSD-3-Clause" ]
0
d5e3cb5d8c1c3d115eeb5f1673b87bdbb36f79e0
https://github.com/dodoproptit99/WaveGrad/tree/d5e3cb5d8c1c3d115eeb5f1673b87bdbb36f79e0
BahdanauAttention
import math import torch import torch.nn.functional as F import torch.nn as nn from torch.nn import Parameter import torch.optim.lr_scheduler import torch.utils.data import torch.onnx.operators import torch.optim class BaseAttention(nn.Module): """Base class for attention layers.""" def __init__(self, query_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
entn-at/espresso
BahdanauAttention
false
10,047
[ "MIT" ]
0
754b69a316429446a5602e13e644142310b7980b
https://github.com/entn-at/espresso/tree/754b69a316429446a5602e13e644142310b7980b
NeuralNetwork
import torch import torch.nn.functional as F import torch.nn as nn class NeuralNetwork(nn.Module): def __init__(self, state_size, action_size, fc1_units=128, fc2_units=64): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
escribano89/bananas-dqn
NeuralNetwork
false
10,048
[ "MIT" ]
0
53497ab99bd7d78a1d8b9b387b4fd056be3a4564
https://github.com/escribano89/bananas-dqn/tree/53497ab99bd7d78a1d8b9b387b4fd056be3a4564
MultiHeadAttention
import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, temperature, dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.temperature = temperature self.dropout = nn.Dropout(p=dropout) def forward(self, q, k, v, mask=None): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
connoisseures/vedastr
MultiHeadAttention
false
10,049
[ "Apache-2.0" ]
0
5dc64f3f6f810f615414aec3508e5dfba1239216
https://github.com/connoisseures/vedastr/tree/5dc64f3f6f810f615414aec3508e5dfba1239216
SigmaL1SmoothLoss
import torch import torch.nn as nn from typing import * class SigmaL1SmoothLoss(nn.Module): def forward(self, output, target): reg_diff = torch.abs(target - output) reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow( reg_diff, 2), reg_diff - 1 / 18) return reg_l...
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 ...
davidpfahler/fastai_dev
SigmaL1SmoothLoss
false
10,050
[ "Apache-2.0" ]
0
a86b15f86138a9902e8649e3f745e76a19139ab3
https://github.com/davidpfahler/fastai_dev/tree/a86b15f86138a9902e8649e3f745e76a19139ab3
Accuracy
from torch.nn import Module import torch from torch import Tensor class Accuracy(Module): """ Class for calculating the accuracy for a given prediction and the labels for comparison. Expects the inputs to be from a range of 0 to 1 and sets a crossing threshold at 0.5 the labels are similarly round...
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.nn import Module from torch import Tensor assert_size_stride = torch._C._dynam...
eldarkurtic/sparseml
Accuracy
false
10,051
[ "Apache-2.0" ]
0
9535ce1a576cd672fead58826376eef22baaebf7
https://github.com/eldarkurtic/sparseml/tree/9535ce1a576cd672fead58826376eef22baaebf7
SimpleTwoLayer
import torch from torch import nn class SimpleTwoLayer(nn.Module): """Some Information about SimpleTwoLayer""" def __init__(self, input_size, hidden_size, output_size): super(SimpleTwoLayer, self).__init__() self.l1 = nn.Linear(input_size, hidden_size) self.l2 = nn.Linear(hidden_size,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
euidong/ML
SimpleTwoLayer
false
10,052
[ "Apache-2.0" ]
0
7e28b6e52c4c145aa6f8342714f16f7fd8880d9b
https://github.com/euidong/ML/tree/7e28b6e52c4c145aa6f8342714f16f7fd8880d9b
SigmoidRange
from torch.nn import Module import functools import torch import torch.nn as nn from typing import * def sigmoid_range(x, low, high): """Sigmoid function with range `(low, high)`""" return torch.sigmoid(x) * (high - low) + low class PrePostInitMeta(type): """A metaclass that calls optional `__pre_init__...
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.nn import Module import functools import torch.nn as nn from typing import * assert_size_stride = torch._C._dynamo.guards.assert_...
davidpfahler/fastai_dev
SigmoidRange
false
10,053
[ "Apache-2.0" ]
0
a86b15f86138a9902e8649e3f745e76a19139ab3
https://github.com/davidpfahler/fastai_dev/tree/a86b15f86138a9902e8649e3f745e76a19139ab3
RegModel
from torch.nn import Module import functools import torch import torch.nn as nn from typing import * class PrePostInitMeta(type): """A metaclass that calls optional `__pre_init__` and `__post_init__` methods""" def __new__(cls, name, bases, dct): x = super().__new__(cls, name, bases, dct) de...
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.nn import Module import functools import torch.nn as nn from typing import * assert_size_stride = torch._C._dynamo.guards.assert_...
davidpfahler/fastai_dev
RegModel
false
10,054
[ "Apache-2.0" ]
0
a86b15f86138a9902e8649e3f745e76a19139ab3
https://github.com/davidpfahler/fastai_dev/tree/a86b15f86138a9902e8649e3f745e76a19139ab3
Critic
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.distributions class Critic(nn.Module): def __init__(self, num_inputs, num_outputs): super(Critic, self).__init__() self.linear = nn.Linear(num_inputs, num_outputs) def forward(self, x): 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 import ...
cjlovering/EGG
Critic
false
10,055
[ "MIT" ]
0
cce146e035decbc410e981f8bc7ada32979f3b6d
https://github.com/cjlovering/EGG/tree/cce146e035decbc410e981f8bc7ada32979f3b6d
CNN_decoder_attention
import torch import torch.nn as nn import torch.nn.init as init class CNN_decoder_attention(nn.Module): def __init__(self, input_size, output_size, stride=2): super(CNN_decoder_attention, self).__init__() self.input_size = input_size self.output_size = output_size self.relu = nn.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 import triton_helpers from torch._inductor.runtime....
bwalker1/graph-generation
CNN_decoder_attention
false
10,056
[ "MIT" ]
0
e068769cb021760eb2549ced382b1a217609db86
https://github.com/bwalker1/graph-generation/tree/e068769cb021760eb2549ced382b1a217609db86
InformedSender
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class InformedSender(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super(InformedSender, 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....
cjlovering/EGG
InformedSender
false
10,057
[ "MIT" ]
0
cce146e035decbc410e981f8bc7ada32979f3b6d
https://github.com/cjlovering/EGG/tree/cce146e035decbc410e981f8bc7ada32979f3b6d
RandomShiftsAug
import torch import torch.nn as nn import torch.nn.functional as F class RandomShiftsAug(nn.Module): def __init__(self, pad): super().__init__() self.pad = pad def forward(self, x): n, _c, h, w = x.size() assert h == w padding = tuple([self.pad] * 4) x = F.pad...
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._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._d...
emigmo/drqv2
RandomShiftsAug
false
10,058
[ "MIT" ]
0
76ca8a613f5c1ed3f07f0ddf8d7aa09469a1ce21
https://github.com/emigmo/drqv2/tree/76ca8a613f5c1ed3f07f0ddf8d7aa09469a1ce21
DenseParallel
import torch import numpy as np import torch.nn as nn class DenseParallel(nn.Module): def __init__(self, in_features: 'int', out_features: 'int', n_parallel: 'int', bias: 'bool'=True, device=None, dtype=None) ->None: factory_kwargs = {'device': device, 'dtype': dtype} super(DenseParallel,...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
emigmo/drqv2
DenseParallel
false
10,059
[ "MIT" ]
0
76ca8a613f5c1ed3f07f0ddf8d7aa09469a1ce21
https://github.com/emigmo/drqv2/tree/76ca8a613f5c1ed3f07f0ddf8d7aa09469a1ce21
SCLN
import torch import torch.nn as nn class LinearNorm(nn.Module): """ LinearNorm Projection """ def __init__(self, in_features, out_features, bias=False): super(LinearNorm, self).__init__() self.linear = nn.Linear(in_features, out_features, bias) nn.init.xavier_uniform_(self.linear.weig...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
dtx525942103/Cross-Speaker-Emotion-Transfer
SCLN
false
10,060
[ "MIT" ]
0
195c3bf227f4de98942e17327ff26e728366022b
https://github.com/dtx525942103/Cross-Speaker-Emotion-Transfer/tree/195c3bf227f4de98942e17327ff26e728366022b
ReinforcedReceiver
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data from torch.distributions import Bernoulli import torch.distributions class ReinforcedReceiver(nn.Module): def __init__(self, n_bits, n_hidden): super(ReinforcedReceiver, 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 import torch.nn.parallel import torch.utils.data import to...
cjlovering/EGG
ReinforcedReceiver
false
10,061
[ "MIT" ]
0
cce146e035decbc410e981f8bc7ada32979f3b6d
https://github.com/cjlovering/EGG/tree/cce146e035decbc410e981f8bc7ada32979f3b6d
ELUPlus
import torch from torch import nn import torch.nn class ELUPlus(nn.Module): def __init__(self): super().__init__() self.elu = nn.ELU() def forward(self, x): return self.elu(x) + 1.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.nn assert_size_stride = torch._C._dynamo.guar...
dennisprangle/nflows
ELUPlus
false
10,062
[ "MIT" ]
0
d3160c60845a4f22f3bf505dc11210d55848e69f
https://github.com/dennisprangle/nflows/tree/d3160c60845a4f22f3bf505dc11210d55848e69f
TensorRepeat
import torch class TensorRepeat(torch.nn.Module): """ duolicate a 1D tensor into N channels (grayscale to rgb for instance) code derived from https://github.com/pytorch/vision/blob/main/torchvision/transforms/transforms.py """ def __init__(self, num_output_channels=1): super().__init__() ...
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...
georand/distributedpytorch
TensorRepeat
false
10,063
[ "MIT" ]
0
69341b364830ad62968ea5646e485dff6b0b24f2
https://github.com/georand/distributedpytorch/tree/69341b364830ad62968ea5646e485dff6b0b24f2
TransformerEncoderLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class TransformerEncoderLayer(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cjlovering/EGG
TransformerEncoderLayer
false
10,064
[ "MIT" ]
0
cce146e035decbc410e981f8bc7ada32979f3b6d
https://github.com/cjlovering/EGG/tree/cce146e035decbc410e981f8bc7ada32979f3b6d
BahdanauAttention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torchvision.transforms import functional as F from torch.nn import functional as F import torch.jit from torch.nn import Parameter from torch.nn.parameter import Parameter import torch.optim import torch.utils.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 from torch._inductor.runtime....
cometta/training
BahdanauAttention
false
10,066
[ "Apache-2.0" ]
0
2f33c36d5aa2e1c2770fb3bab35afc8c665e01ce
https://github.com/cometta/training/tree/2f33c36d5aa2e1c2770fb3bab35afc8c665e01ce
LogSumPenalty
from torch.nn import Module import torch class LogSumPenalty(Module): def __init__(self, epsilon=1): super(LogSumPenalty, self).__init__() self.epsilon = epsilon def forward(self, input): return torch.sum(torch.log(torch.abs(input) + self.epsilon)) def eta_hat(self, 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 from torch.nn import M...
dlej/adaptive-dropout
LogSumPenalty
false
10,067
[ "MIT" ]
0
0540b2d06f1f97eb5861c6917eec6c086d33dfa8
https://github.com/dlej/adaptive-dropout/tree/0540b2d06f1f97eb5861c6917eec6c086d33dfa8
Policy
import torch import torch.nn.functional as F import torch.nn as nn class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False) self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4) self.size = 9 * 9...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
faberfred/udacity-deep-RL
Policy
false
10,068
[ "MIT" ]
0
37b9bf8fa5489eb1c77e5c61ea2f59de10c734bd
https://github.com/faberfred/udacity-deep-RL/tree/37b9bf8fa5489eb1c77e5c61ea2f59de10c734bd
Generative_Model
import torch import torch.nn as nn class Generative_Model(nn.Module): def __init__(self, input_size, hidden_size_1, hidden_size_2, output_size, n_classes): super(Generative_Model, self).__init__() self.input_size = input_size self.hidden_size_1 = hidden_size_1 self.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 import triton_helpers import torch.nn as nn assert_...
frhrdr/MMD-GAN
Generative_Model
false
10,069
[ "Apache-2.0" ]
0
7522093498b658026344541ddd5c248095763fb6
https://github.com/frhrdr/MMD-GAN/tree/7522093498b658026344541ddd5c248095763fb6
nin
import torch import torch.nn as nn from torch.nn.utils import weight_norm as wn class nin(nn.Module): def __init__(self, dim_in, dim_out): super(nin, self).__init__() self.lin_a = wn(nn.Linear(dim_in, dim_out)) self.dim_out = dim_out def forward(self, x): """ a network in net...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
elahekhodaie/PixelCnnPP
nin
false
10,070
[ "MIT" ]
0
ab1e245ed8c24009364b1f891288eb1a526b0121
https://github.com/elahekhodaie/PixelCnnPP/tree/ab1e245ed8c24009364b1f891288eb1a526b0121
ResNetBlock
from torch.nn import Module import torch from torch.nn import Conv2d from torch.nn import InstanceNorm2d from torch.nn.init import kaiming_normal_ from torch.nn.init import xavier_normal_ from torch import relu def create_init_function(method: 'str'='none'): def init(module: 'Module'): if method == 'none...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
fireresistance/talking_heads
ResNetBlock
false
10,071
[ "MIT" ]
0
949af9ee8192d737bdfd9f2d83b70f56b3cdfbe7
https://github.com/fireresistance/talking_heads/tree/949af9ee8192d737bdfd9f2d83b70f56b3cdfbe7
AnimalBaselineNet
import torch import torch.nn as nn import torch.nn.functional as F class AnimalBaselineNet(nn.Module): def __init__(self, num_classes=16): super(AnimalBaselineNet, self).__init__() self.conv1 = nn.Conv2d(3, 6, kernel_size=3, stride=2, padding=1) self.conv2 = nn.Conv2d(6, 12, kernel_size=3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
elouie/CodeSamples
AnimalBaselineNet
false
10,072
[ "Apache-2.0" ]
0
3fe9fcf23cbfc82d84a679ea16d69ae41e700f06
https://github.com/elouie/CodeSamples/tree/3fe9fcf23cbfc82d84a679ea16d69ae41e700f06
LinearEmbedding
import math import torch import torch.utils.data import torch.nn as nn class LinearEmbedding(nn.Module): def __init__(self, inp_size, d_model): super(LinearEmbedding, self).__init__() self.lut = nn.Linear(inp_size, d_model) self.d_model = d_model def forward(self, x): return ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dyn...
flyslowly/Trajectory-Transformer
LinearEmbedding
false
10,073
[ "MIT" ]
0
8a5772e67366854155eb3f9a0ebff08c3e9f9186
https://github.com/flyslowly/Trajectory-Transformer/tree/8a5772e67366854155eb3f9a0ebff08c3e9f9186
AnimalStudentNet
import torch import torch.nn as nn import torch.nn.functional as F class AnimalStudentNet(nn.Module): def __init__(self, num_classes=16): super(AnimalStudentNet, self).__init__() self.pool = nn.MaxPool2d(2, 2) self.dropout = nn.Dropout2d(p=0.1) self.conv1 = nn.Conv2d(3, 6, kernel_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
elouie/CodeSamples
AnimalStudentNet
false
10,074
[ "Apache-2.0" ]
0
3fe9fcf23cbfc82d84a679ea16d69ae41e700f06
https://github.com/elouie/CodeSamples/tree/3fe9fcf23cbfc82d84a679ea16d69ae41e700f06
LogSumDualPenalty
from torch.nn import Module import torch class LogSumDualPenalty(Module): def __init__(self, epsilon=1): super(LogSumDualPenalty, self).__init__() self.epsilon = epsilon def forward(self, input): eta = input sqrt = torch.sqrt(self.epsilon ** 2 + 4 * eta) return 2 * to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch....
dlej/adaptive-dropout
LogSumDualPenalty
false
10,075
[ "MIT" ]
0
0540b2d06f1f97eb5861c6917eec6c086d33dfa8
https://github.com/dlej/adaptive-dropout/tree/0540b2d06f1f97eb5861c6917eec6c086d33dfa8
Downsample
import torch import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: return nn.Conv3d(*args, **kwargs) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
francoismaze/improved-diffusion
Downsample
false
10,076
[ "MIT" ]
0
bb403ba2437d6d834bb285b7259549fb3fa40f1b
https://github.com/francoismaze/improved-diffusion/tree/bb403ba2437d6d834bb285b7259549fb3fa40f1b
RELUTwosided
import torch class RELUTwosided(torch.nn.Module): def __init__(self, num_conv, lam=0.001, L=100, sigma=1, device=None): super(RELUTwosided, self).__init__() self.L = L self.lam = torch.nn.Parameter(lam * torch.ones(1, num_conv, 1, 1, device=device)) self.sigma = sigma ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
garysnake/crsae
RELUTwosided
false
10,077
[ "MIT" ]
0
ca03574fc75e855e612df71535504e956ef897c7
https://github.com/garysnake/crsae/tree/ca03574fc75e855e612df71535504e956ef897c7
Critic
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn class Critic(nn.Module): """Critic (Value) Model. This class construct the model. """ def __init__(self, state_size, action_size, seed, fc1_units=128, fc2_units=128, fc3_units=128): """ Initialize p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
fernandofsilva/Tennis
Critic
false
10,078
[ "MIT" ]
0
5b454f7999a33bfd189d45ed2fa3a95727b8f94f
https://github.com/fernandofsilva/Tennis/tree/5b454f7999a33bfd189d45ed2fa3a95727b8f94f
L2
import torch import torch.nn as nn class L2(nn.Module): def __init__(self): super(L2, self).__init__() def forward(self, output, target): lossvalue = torch.norm(output - target, p=2, dim=1).mean() return lossvalue 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
dark-tea/flownet2-pytorch
L2
false
10,079
[ "Apache-2.0" ]
0
41ea3353f11048833f6baebcf9f9c951b0b722d7
https://github.com/dark-tea/flownet2-pytorch/tree/41ea3353f11048833f6baebcf9f9c951b0b722d7
RobertaClassificationHead
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class RobertaClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size * 2, config.hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
frankxu2004/CodeT5
RobertaClassificationHead
false
10,080
[ "BSD-3-Clause" ]
0
454e30a40b833a5ed862a1942f5d545e6a06b2b1
https://github.com/frankxu2004/CodeT5/tree/454e30a40b833a5ed862a1942f5d545e6a06b2b1
SinActv
import torch import torch.nn as nn class SinActv(nn.Module): def __init__(self): super().__init__() def forward(self, input_): return torch.sin(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...
gnicks007/neurodiffeq
SinActv
false
10,081
[ "MIT" ]
0
a4a4fd2379442937b748712e1cf45510aba6f0c0
https://github.com/gnicks007/neurodiffeq/tree/a4a4fd2379442937b748712e1cf45510aba6f0c0
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1) self.conv2 = nn.Conv2d(16, 8, kernel_size=3, padding=1) self.fc1 = nn.Linear(8 * 8 * 8, 32) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
frullah/website-fruits-classification
Net
false
10,082
[ "MIT" ]
0
1fdd67884e75e2894afa6b170c023c7e60e28155
https://github.com/frullah/website-fruits-classification/tree/1fdd67884e75e2894afa6b170c023c7e60e28155
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn class Actor(nn.Module): """Actor (Policy) Model. This class construct the model. """ def __init__(self, state_size, action_size, seed, fc1_units=128, fc2_units=128, fc3_units=128): """ Initialize pa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
fernandofsilva/Tennis
Actor
false
10,083
[ "MIT" ]
0
5b454f7999a33bfd189d45ed2fa3a95727b8f94f
https://github.com/fernandofsilva/Tennis/tree/5b454f7999a33bfd189d45ed2fa3a95727b8f94f
down_right_shifted_conv2d
import torch import torch.nn as nn from torch.nn.utils import weight_norm as wn def right_shift(x, pad=None): xs = [int(y) for y in x.size()] x = x[:, :, :, :xs[3] - 1] pad = nn.ZeroPad2d((1, 0, 0, 0)) if pad is None else pad return pad(x) class down_right_shifted_conv2d(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 torch.nn as ...
elahekhodaie/PixelCnnPP
down_right_shifted_conv2d
false
10,084
[ "MIT" ]
0
ab1e245ed8c24009364b1f891288eb1a526b0121
https://github.com/elahekhodaie/PixelCnnPP/tree/ab1e245ed8c24009364b1f891288eb1a526b0121
SelfAttention
import math import torch from torch import nn import torch.nn.functional as F def mask_(matrices, maskval=0.0, mask_diagonal=True): """ Masks out all values in the given batch of matrices where i <= j holds, i < j if mask_diagonal is false In place operation :param tns: :return: """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
esvhd/former
SelfAttention
false
10,085
[ "MIT" ]
0
9aca51b8f7a6f2abe2175293b895ed4af468e890
https://github.com/esvhd/former/tree/9aca51b8f7a6f2abe2175293b895ed4af468e890
DiscriReceiver
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.distributions class DiscriReceiver(nn.Module): def __init__(self, n_features, n_hidden): super(DiscriReceiver, self).__init__() self.fc1 = nn.Linear(n_features, n_hidden) def forward(self, x, _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 ...
eugene-kharitonov/EGG
DiscriReceiver
false
10,086
[ "MIT" ]
0
714958f24ac23bc18cc7fac395e1aae0afbcabe0
https://github.com/eugene-kharitonov/EGG/tree/714958f24ac23bc18cc7fac395e1aae0afbcabe0
BottleNeck
import torch import torch.nn as nn class BottleNeck(nn.Module): def __init__(self): super().__init__() def forward(self, x): avg = x.mean(dim=-1).unsqueeze(2) return torch.cat((x, avg), dim=2) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
etienne87/pytorch-cifar
BottleNeck
false
10,087
[ "MIT" ]
0
d9164df8ba0cb9259daf857e006db3fecb762af7
https://github.com/etienne87/pytorch-cifar/tree/d9164df8ba0cb9259daf857e006db3fecb762af7
BasicModel
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, input): input = 1 - F.relu(1 - input) return input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_...
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...
aravipati12/captum
BasicModel
false
10,088
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
SineLayer
import math import torch import torch.nn as nn class SineLayer(nn.Module): def __init__(self, in_features, out_features, bias=True, is_first=False, omega_0=30): super().__init__() self.omega_0 = omega_0 self.is_first = is_first self.in_features = in_features self.l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math i...
etienne87/pytorch-cifar
SineLayer
false
10,089
[ "MIT" ]
0
d9164df8ba0cb9259daf857e006db3fecb762af7
https://github.com/etienne87/pytorch-cifar/tree/d9164df8ba0cb9259daf857e006db3fecb762af7
BasicModel_MaxPool_ReLU
import torch import torch.nn as nn class BasicModel_MaxPool_ReLU(nn.Module): def __init__(self, inplace=False) ->None: super().__init__() self.maxpool = nn.MaxPool1d(3) self.relu = nn.ReLU(inplace=inplace) def forward(self, x): return self.relu(self.maxpool(x)).sum(dim=1) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
aravipati12/captum
BasicModel_MaxPool_ReLU
false
10,090
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
Encoder
import torch from torch import nn class Encoder(nn.Module): def __init__(self, input_dim, hidden_dim, latent_dim): super(Encoder, self).__init__() self.FC_input = nn.Linear(input_dim, hidden_dim) self.FC_mean = nn.Linear(hidden_dim, latent_dim) self.FC_var = nn.Linear(hidden_dim, ...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
georgezefko/dtu_mlops
Encoder
false
10,091
[ "Apache-2.0" ]
0
3b715bcb934d0c2827d89395823b7d4768faac97
https://github.com/georgezefko/dtu_mlops/tree/3b715bcb934d0c2827d89395823b7d4768faac97
BasicModel3
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel3(nn.Module): """ Example model two from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2)) """ def __init__(self) ->None: super().__init__() def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
aravipati12/captum
BasicModel3
false
10,092
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
BasicModel2
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel2(nn.Module): """ Example model one from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1) - 1 - ReLU(x2)) """ def __init__(self) ->None: super().__init__() def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
aravipati12/captum
BasicModel2
false
10,093
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
BasicModel5_MultiArgs
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel5_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) * x3[0] - ReLU(x2) * x3[1]) """ def __init__(self) ->None: s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
aravipati12/captum
BasicModel5_MultiArgs
false
10,094
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
Attn
import math import torch import torch.nn as nn import torch.nn.functional as F class Attn(nn.Module): def __init__(self, method, hidden_size): super(Attn, self).__init__() self.method = method self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
erytheis/HDSA-Dialog
Attn
false
10,095
[ "MIT" ]
0
08fa6c583e51989f45201e232864ccb495fa823c
https://github.com/erytheis/HDSA-Dialog/tree/08fa6c583e51989f45201e232864ccb495fa823c
Feedback
from _paritybench_helpers import _mock_config import torch import torch.nn as nn def weights_init(m): classname = m.__class__.__name__ if classname.find('Linear') != -1: m.weight.data.normal_(0.0, 0.02) if m.bias is not None: m.bias.data.fill_(0) elif classname.find('BatchNorm'...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
e96031413/tfvaegan
Feedback
false
10,096
[ "MIT" ]
0
4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
https://github.com/e96031413/tfvaegan/tree/4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
BasicModel6_MultiTensor
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel6_MultiTensor(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, input1, input2): input = input1 + input2 return 1 - F.relu(1 - input)[:, 1] def get_inputs(): return [tor...
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...
aravipati12/captum
BasicModel6_MultiTensor
false
10,097
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
TinyCnn
import torch import torch.nn as nn class TinyCnn(nn.Module): def __init__(self, feature_extraction=False) ->None: super().__init__() self.feature_extraction = feature_extraction self.conv1 = nn.Conv2d(3, 3, 5) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2, 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 assert_...
aravipati12/captum
TinyCnn
false
10,098
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
Lagrange
import torch import torch.nn as nn import torch.utils.data def objective(x, h): return torch.log(1 + torch.sum(x * h, dim=1)) class Lagrange(nn.Module): def __init__(self): super(Lagrange, self).__init__() def forward(self, approx, dual, h): result = -objective(approx, h) + dual ...
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 ...
goldenBill/Power_Control
Lagrange
false
10,099
[ "MIT" ]
0
8218aaffe8d5c69da454f76ecdacce46340cb81c
https://github.com/goldenBill/Power_Control/tree/8218aaffe8d5c69da454f76ecdacce46340cb81c
down_shifted_conv2d
import torch import torch.nn as nn from torch.nn.utils import weight_norm as wn def down_shift(x, pad=None): xs = [int(y) for y in x.size()] x = x[:, :, :xs[2] - 1, :] pad = nn.ZeroPad2d((0, 0, 1, 0)) if pad is None else pad return pad(x) class down_shifted_conv2d(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.triton_helpers import libdevice import torch.nn as ...
elahekhodaie/PixelCnnPP
down_shifted_conv2d
false
10,100
[ "MIT" ]
0
ab1e245ed8c24009364b1f891288eb1a526b0121
https://github.com/elahekhodaie/PixelCnnPP/tree/ab1e245ed8c24009364b1f891288eb1a526b0121
TanhDeepLiftModel
import torch import torch.nn as nn class TanhDeepLiftModel(nn.Module): """ Same as the ReLUDeepLiftModel, but with activations that can have negative outputs """ def __init__(self) ->None: super().__init__() self.tanh1 = nn.Tanh() self.tanh2 = nn.Tanh() def forward(se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
aravipati12/captum
TanhDeepLiftModel
false
10,101
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
ReLUDeepLiftModel
import torch import torch.nn as nn class ReLUDeepLiftModel(nn.Module): """ https://www.youtube.com/watch?v=f_iAM0NPwnM """ def __init__(self) ->None: super().__init__() self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x1, x2, x3=2): return 2 * self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
aravipati12/captum
ReLUDeepLiftModel
false
10,102
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
ODDetector
import torch import torch.nn as nn class ODDetector(nn.Module): def __init__(self, input_dim, h_size, num_classes): super(ODDetector, self).__init__() self.relu = nn.ReLU(True) self.fc1 = nn.Linear(input_dim, h_size) self.fc2 = nn.Linear(h_size, h_size) self.classifier = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
e96031413/tfvaegan
ODDetector
false
10,103
[ "MIT" ]
0
4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
https://github.com/e96031413/tfvaegan/tree/4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
LinearMaxPoolLinearModel
import torch import torch.nn as nn class LinearMaxPoolLinearModel(nn.Module): def __init__(self) ->None: super().__init__() self.lin1 = nn.Linear(4, 4, bias=False) self.lin1.weight = nn.Parameter(torch.eye(4, 4)) self.pool1 = nn.MaxPool1d(4) self.lin2 = nn.Linear(1, 1, bia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
aravipati12/captum
LinearMaxPoolLinearModel
false
10,104
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
NormLayer
import torch import torch.nn as nn class NormLayer(nn.Module): def __init__(self, mean, std, n=None, eps=1e-08) ->None: super().__init__() self.mean = mean self.std = std self.eps = eps def forward(self, x): return (x - self.mean) / (self.std + self.eps) def get_inp...
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...
aravipati12/captum
NormLayer
false
10,105
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
BasicModel_ConvNet_One_Conv
import torch from torch import Tensor from typing import Optional import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet_One_Conv(nn.Module): def __init__(self, inplace: 'bool'=False) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.Re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
aravipati12/captum
BasicModel_ConvNet_One_Conv
false
10,106
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
ReduceDim
import torch import torch.nn as nn import torch.nn.functional as F class ReduceDim(nn.Module): def __init__(self, input_dimension, output_dimension): super(ReduceDim, self).__init__() self.fc = nn.Linear(input_dimension, output_dimension) def forward(self, x): x = self.fc(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....
dendisuhubdy/collaborative-experts
ReduceDim
false
10,107
[ "MIT" ]
0
e6db63837537c054723ce00b73264101acc29d39
https://github.com/dendisuhubdy/collaborative-experts/tree/e6db63837537c054723ce00b73264101acc29d39
SigmoidDeepLiftModel
import torch import torch.nn as nn class SigmoidDeepLiftModel(nn.Module): """ Model architecture from: https://medium.com/coinmonks/create-a-neural-network-in -pytorch-and-make-your-life-simpler-ec5367895199 """ def __init__(self, num_in, num_hidden, num_out) ->None: super().__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_...
aravipati12/captum
SigmoidDeepLiftModel
false
10,108
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
Net
import torch import numpy as np import torch.nn as nn class Net(nn.Module): def __init__(self, input_size, hidden_size, num_distros): super(Net, self).__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.tanh = nn.Tanh() self.fc2 = nn.Linear(hidden_size, num_distros) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
gganssle/mixture-density-networks
Net
false
10,109
[ "Apache-2.0" ]
0
246f05d8a1dedd259232760a1b54ac5845c4b8f6
https://github.com/gganssle/mixture-density-networks/tree/246f05d8a1dedd259232760a1b54ac5845c4b8f6
Discriminator_D1
from _paritybench_helpers import _mock_config import torch import torch.nn as nn def weights_init(m): classname = m.__class__.__name__ if classname.find('Linear') != -1: m.weight.data.normal_(0.0, 0.02) if m.bias is not None: m.bias.data.fill_(0) elif classname.find('BatchNorm'...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
e96031413/tfvaegan
Discriminator_D1
false
10,110
[ "MIT" ]
0
4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
https://github.com/e96031413/tfvaegan/tree/4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
SoftmaxDeepLiftModel
import torch import torch.nn as nn class SoftmaxDeepLiftModel(nn.Module): """ Model architecture from: https://adventuresinmachinelearning.com/pytorch-tutorial-deep-learning/ """ def __init__(self, num_in, num_hidden, num_out) ->None: super().__init__() self.num_in = num_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....
aravipati12/captum
SoftmaxDeepLiftModel
false
10,111
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
VarianceC
import torch import torch.utils.data import torch import torch.nn as nn class VarianceC(nn.Module): def __init__(self): super(VarianceC, self).__init__() def forward(self, x): mean_x = torch.mean(x, dim=1, keepdim=True) sub_x = x.sub(mean_x) x = torch.mean(torch.mul(sub_x, su...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
caixin1998/pl-template
VarianceC
false
10,112
[ "BSD-3-Clause" ]
0
6918f0289ab2b32d107e5722617d25c9a683399c
https://github.com/caixin1998/pl-template/tree/6918f0289ab2b32d107e5722617d25c9a683399c
BasicModel4_MultiArgs
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel4_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2) / x3) """ def __init__(self) ->None: super().__in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
aravipati12/captum
BasicModel4_MultiArgs
false
10,113
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
SpatialGather_Module
import torch import torch.nn as nn import torch.nn.functional as F import torch._utils class SpatialGather_Module(nn.Module): """ Aggregate the context features according to the initial predicted probability distribution. Employ the soft-weighted method to aggregate the context. 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 import triton_helpers from torch._inductor.runtime....
garylidd/semantic-segmentation
SpatialGather_Module
false
10,114
[ "BSD-3-Clause" ]
0
64ae675076bea12ab994e7ae88d719a413e9c484
https://github.com/garylidd/semantic-segmentation/tree/64ae675076bea12ab994e7ae88d719a413e9c484
MultiRelu
import torch from torch import Tensor from typing import Tuple import torch.nn as nn from typing import no_type_check class MultiRelu(nn.Module): def __init__(self, inplace: 'bool'=False) ->None: super().__init__() self.relu1 = nn.ReLU(inplace=inplace) self.relu2 = nn.ReLU(inplace=inplace...
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...
aravipati12/captum
MultiRelu
false
10,115
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
AttDec
from _paritybench_helpers import _mock_config import torch import torch.nn as nn def weights_init(m): classname = m.__class__.__name__ if classname.find('Linear') != -1: m.weight.data.normal_(0.0, 0.02) if m.bias is not None: m.bias.data.fill_(0) elif classname.find('BatchNorm'...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
e96031413/tfvaegan
AttDec
false
10,116
[ "MIT" ]
0
4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
https://github.com/e96031413/tfvaegan/tree/4d0512c6ce98155b9e8ba37fbcf90d43cd5bbe90
ScoringFunction
import torch import torch.utils.data import torch import torch.nn as nn class Conv2dAct(nn.Module): def __init__(self, in_channels, out_channels, ksize=1, activation='relu'): super(Conv2dAct, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, ksize) if activation == 'sigmoi...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.nn as nn assert_size_stride = ...
caixin1998/pl-template
ScoringFunction
false
10,117
[ "BSD-3-Clause" ]
0
6918f0289ab2b32d107e5722617d25c9a683399c
https://github.com/caixin1998/pl-template/tree/6918f0289ab2b32d107e5722617d25c9a683399c
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(1, 15, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(15, 30, 5) self.fc1 = nn.Linear(30 * 9 * 9, 300) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
gg4u/cnc_2017
Net
false
10,118
[ "MIT" ]
0
1a5c52c3207ba131139214d14a2161af2db80a5c
https://github.com/gg4u/cnc_2017/tree/1a5c52c3207ba131139214d14a2161af2db80a5c
BasicCNN1
import torch import torch.nn as nn import torch.nn.functional as F class BasicCNN1(nn.Module): def __init__(self): super().__init__() self.layer_names = ['conv1', 'conv2', 'conv3', 'fc1', 'output_layer'] self.conv1 = nn.Conv2d(3, 32, 3, padding=1) self.conv2 = nn.Conv2d(32, 64, 3,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
fnc11/CosDefence
BasicCNN1
false
10,119
[ "MIT" ]
0
94f451b7d4b36cb3b9fcc85098dae242f311532b
https://github.com/fnc11/CosDefence/tree/94f451b7d4b36cb3b9fcc85098dae242f311532b
DisConvModule
import torch import torch.utils.data import torch import torch.nn as nn def dis_conv(input_dim, output_dim, kernel_size=5, stride=2, padding=0, rate=1, activation='lrelu'): return Conv2dBlock(input_dim, output_dim, kernel_size, stride, conv_padding=padding, dilation=rate, activation=activation) clas...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.nn as nn assert_size_stride = ...
caixin1998/pl-template
DisConvModule
false
10,120
[ "BSD-3-Clause" ]
0
6918f0289ab2b32d107e5722617d25c9a683399c
https://github.com/caixin1998/pl-template/tree/6918f0289ab2b32d107e5722617d25c9a683399c
BasicModel_ConvNet_MaxPool3d
import torch import torch.nn as nn class BasicModel_ConvNet_MaxPool3d(nn.Module): """Same as above, but with the MaxPool1d replaced with a MaxPool3d. This is useful because the MaxPool modules behave differently to other modules from the perspective of the DeepLift Attributions """ 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....
aravipati12/captum
BasicModel_ConvNet_MaxPool3d
false
10,121
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
SequentialCNNNet
import torch import torch.nn as nn class SequentialCNNNet(nn.Module): def __init__(self): super(SequentialCNNNet, self).__init__() self.conv1 = nn.Conv2d(3, 64, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(64, 128, 5) self.fc1 = nn.Linear(128 * 5 * 5, 1024) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
fangkaimin/pytorch_classification_new
SequentialCNNNet
false
10,122
[ "MIT" ]
0
21032e7ab91f0f3106ba07aa97657a023b1cc717
https://github.com/fangkaimin/pytorch_classification_new/tree/21032e7ab91f0f3106ba07aa97657a023b1cc717
BasicModel_ConvNet
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet(nn.Module): def __init__(self) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2) self.conv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
aravipati12/captum
BasicModel_ConvNet
false
10,123
[ "BSD-3-Clause" ]
0
ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
https://github.com/aravipati12/captum/tree/ef3e81d89c8c4404a49c384cf0727f2e7d393f5f
ContractingBlock
import torch import torch.nn as nn class ContractingBlock(nn.Module): def __init__(self, input_channel): super(ContractingBlock, self).__init__() self.conv1 = nn.Conv2d(in_channels=input_channel, out_channels= input_channel * 2, kernel_size=(3, 3)) self.conv2 = nn.Conv2d(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_...
furkannturkmen/pytorch-CNN-architecture
ContractingBlock
false
10,124
[ "MIT" ]
0
6a864811f51409c1526224c288fe608010e0c888
https://github.com/furkannturkmen/pytorch-CNN-architecture/tree/6a864811f51409c1526224c288fe608010e0c888
BertPooler
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class BertPooler(nn.Module): def __init__(self, config): super(BertPooler, self).__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
etherlabsio/ai-engine
BertPooler
false
10,125
[ "MIT" ]
0
e73a4419a34db42a410e2a7e7629eb946b86f2c2
https://github.com/etherlabsio/ai-engine/tree/e73a4419a34db42a410e2a7e7629eb946b86f2c2
ConvertTCHWtoCTHW
import torch import torch.utils.data class ConvertTCHWtoCTHW(torch.nn.Module): """ Convert a torch.FloatTensor of shape (TIME x CHANNELS x HEIGHT x WIDTH) to a torch.FloatTensor of shape (CHANNELS x TIME x HEIGHT x WIDTH). """ def forward(self, tensor): return tensor.permute(1, 0, 2, 3).c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
XianyuanLiu/Transfer-Learning-Library
ConvertTCHWtoCTHW
false
10,126
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
TLU
import torch import torch.nn as nn import torch.utils.data.distributed class TLU(nn.Module): """ Thresholded Linear Unit """ def __init__(self, num_features): super().__init__() self.num_features = num_features self.tau = nn.Parameter(torch.zeros(1, num_features, 1, 1)) def forwa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data.distributed assert_size_stride = torch._C._...
derwind/mxfont
TLU
false
10,127
[ "MIT" ]
0
0b6d4554a1e2208906230d3121d792d450ed28dd
https://github.com/derwind/mxfont/tree/0b6d4554a1e2208906230d3121d792d450ed28dd
CNNNet
import torch import torch.nn.functional as F import torch.nn as nn class CNNNet(nn.Module): def __init__(self): super(CNNNet, self).__init__() self.conv1 = nn.Conv2d(3, 64, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(64, 128, 5) self.fc1 = nn.Linear(128 * 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_...
fangkaimin/pytorch_classification_new
CNNNet
false
10,128
[ "MIT" ]
0
21032e7ab91f0f3106ba07aa97657a023b1cc717
https://github.com/fangkaimin/pytorch_classification_new/tree/21032e7ab91f0f3106ba07aa97657a023b1cc717