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
ScaledDotProduct
import math import torch from torch import nn class ScaledDotProduct(nn.Module): def __init__(self, attentionHeadSize, dropOutProb=0.1): super(ScaledDotProduct, self).__init__() self.attentionHeadSize = attentionHeadSize self.dropout = nn.Dropout(dropOutProb) def forward(self, Q, K, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
simonepreite/QABERT
ScaledDotProduct
false
4,336
[ "MIT" ]
0
ed3e49f6619f3ff660068291231909693cb8f5d5
https://github.com/simonepreite/QABERT/tree/ed3e49f6619f3ff660068291231909693cb8f5d5
FeedForward
import math import torch from torch import nn class GELU(nn.Module): def __init__(self): super(GELU, self).__init__() def forward(self, tensor): geluPow = tensor + 0.044715 * torch.pow(tensor, 3) geluTanh = torch.tanh(math.sqrt(2 / math.pi) * geluPow) geluResult = 1 + geluTan...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
simonepreite/QABERT
FeedForward
false
4,337
[ "MIT" ]
0
ed3e49f6619f3ff660068291231909693cb8f5d5
https://github.com/simonepreite/QABERT/tree/ed3e49f6619f3ff660068291231909693cb8f5d5
RenormSoftmax
import torch import numpy as np import torch.nn as nn class RenormSoftmax(nn.Module): def __init__(self, dim=-1, norm=np.pi / 40): super().__init__() self.softmax = nn.Softmax(dim=dim) self.dim = dim self.norm = norm def forward(self, x): N = x.shape[self.dim] ...
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 numpy as np imp...
simonverret/deep_continuation
RenormSoftmax
false
4,338
[ "MIT" ]
0
986bfba7f6806dc4869a023ff1fc1d0d18324b25
https://github.com/simonverret/deep_continuation/tree/986bfba7f6806dc4869a023ff1fc1d0d18324b25
BertAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.utils.data class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super(BertLayerNorm...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
shubham-gupta-iitr/mmmlX
BertAttention
false
4,339
[ "Apache-2.0" ]
0
3485e6191e0e45bf1c8168e4e928a36ab9264d22
https://github.com/shubham-gupta-iitr/mmmlX/tree/3485e6191e0e45bf1c8168e4e928a36ab9264d22
MLP
import torch from torch import Tensor from torch import nn class GELU(nn.Module): """Quick GELU""" def forward(self, x: 'Tensor') ->Tensor: return x * torch.sigmoid(1.702 * x) class MLP(nn.Module): def __init__(self, c1, ch, c2=None): super().__init__() self.c_fc = nn.Linear(c1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 Tensor from torch import nn assert_size_stride = torch._C._dyn...
sithu31296/multimodal
MLP
false
4,340
[ "MIT" ]
0
78f57956cc84273579eb9e2e2be2a58fa1f38814
https://github.com/sithu31296/multimodal/tree/78f57956cc84273579eb9e2e2be2a58fa1f38814
RefModel2d
import torch import torch.nn.functional as F class RefModel2d(torch.nn.Module): """The 2D reference model.""" def __init__(self): super().__init__() self.l1 = torch.nn.Conv2d(2, 2, 3, stride=2, bias=False, padding=1, padding_mode='reflect') self.l2 = torch.nn.BatchNorm2d(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 torch._inductor.runtime....
shuohan/pytorch-layers
RefModel2d
false
4,341
[ "MIT" ]
0
020846fd02d501cf477552179c19ba4b5e9a0695
https://github.com/shuohan/pytorch-layers/tree/020846fd02d501cf477552179c19ba4b5e9a0695
TripletLoss
import torch from torch import Tensor from torch import nn from torch.nn import functional as F def euclidean_dist(x: 'Tensor', y: 'Tensor') ->Tensor: xx, yy = torch.meshgrid((x ** 2).sum(1), (y ** 2).sum(1)) return xx + yy - 2 * (x @ y.t()) class TripletLoss(nn.Module): """ Modified from Tong Xiao'...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 Tensor from...
sithu31296/re_identification
TripletLoss
false
4,342
[ "MIT" ]
0
28c2cf32c6c8c9d79330e1419a7156fe10d8ac95
https://github.com/sithu31296/re_identification/tree/28c2cf32c6c8c9d79330e1419a7156fe10d8ac95
RefModel2d2
import torch import torch.nn.functional as F class RefModel2d2(torch.nn.Module): """The 2D reference model.""" def __init__(self): super().__init__() self.l1 = torch.nn.Conv2d(2, 2, 3, padding=1, stride=2, padding_mode='circular', bias=False) self.l2 = torch.nn.Identity() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
shuohan/pytorch-layers
RefModel2d2
false
4,343
[ "MIT" ]
0
020846fd02d501cf477552179c19ba4b5e9a0695
https://github.com/shuohan/pytorch-layers/tree/020846fd02d501cf477552179c19ba4b5e9a0695
PositionAttentionModule
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rushirajsherlocked/External-Attention-pytorch
PositionAttentionModule
false
4,344
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
Actor
import torch import torch.nn.functional as F import torch.nn as nn class Actor(nn.Module): def __init__(self, state_dim, action_dim, max_action, nhid): super(Actor, self).__init__() self.l1 = nn.Linear(state_dim, nhid) self.l2 = nn.Linear(nhid, nhid) self.l3 = nn.Linear(nhid, acti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
simondlevy/pytorch-drl
Actor
false
4,345
[ "MIT" ]
0
b197bb93c2cc698971f98095d4e0180811c52042
https://github.com/simondlevy/pytorch-drl/tree/b197bb93c2cc698971f98095d4e0180811c52042
DeepContinuor
import torch import torch.nn as nn import torch.nn.functional as F class DeepContinuor(nn.Module): def __init__(self, x_dim, h_dim, y_dim): super().__init__() self.layer1 = nn.Linear(x_dim, h_dim) self.layer2 = nn.Linear(h_dim, h_dim) self.layer3 = nn.Linear(h_dim, h_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
simonverret/deep_continuation
DeepContinuor
false
4,346
[ "MIT" ]
0
986bfba7f6806dc4869a023ff1fc1d0d18324b25
https://github.com/simonverret/deep_continuation/tree/986bfba7f6806dc4869a023ff1fc1d0d18324b25
Normalizer
import torch import torch.nn as nn class Normalizer(nn.Module): def __init__(self, dim=-1, norm=1.0): super().__init__() self.dim = dim self.norm = norm self.softplus = nn.Softplus() def forward(self, x): out = self.softplus(x) return out / torch.abs(out.detac...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
simonverret/deep_continuation
Normalizer
false
4,347
[ "MIT" ]
0
986bfba7f6806dc4869a023ff1fc1d0d18324b25
https://github.com/simonverret/deep_continuation/tree/986bfba7f6806dc4869a023ff1fc1d0d18324b25
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...
sagnik/captum
BasicModel_MaxPool_ReLU
false
4,348
[ "BSD-3-Clause" ]
0
d6b663745ee6c01f072a4358233dec381324c283
https://github.com/sagnik/captum/tree/d6b663745ee6c01f072a4358233dec381324c283
MultiHeadAttention
import math import torch from torch import nn class ScaledDotProduct(nn.Module): def __init__(self, attentionHeadSize, dropOutProb=0.1): super(ScaledDotProduct, self).__init__() self.attentionHeadSize = attentionHeadSize self.dropout = nn.Dropout(dropOutProb) def forward(self, Q, K, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
simonepreite/QABERT
MultiHeadAttention
false
4,349
[ "MIT" ]
0
ed3e49f6619f3ff660068291231909693cb8f5d5
https://github.com/simonepreite/QABERT/tree/ed3e49f6619f3ff660068291231909693cb8f5d5
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...
sagnik/captum
NormLayer
false
4,350
[ "BSD-3-Clause" ]
0
d6b663745ee6c01f072a4358233dec381324c283
https://github.com/sagnik/captum/tree/d6b663745ee6c01f072a4358233dec381324c283
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_...
sagnik/captum
LinearMaxPoolLinearModel
false
4,351
[ "BSD-3-Clause" ]
0
d6b663745ee6c01f072a4358233dec381324c283
https://github.com/sagnik/captum/tree/d6b663745ee6c01f072a4358233dec381324c283
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_...
sagnik/captum
BasicLinearReLULinear
false
4,352
[ "BSD-3-Clause" ]
0
d6b663745ee6c01f072a4358233dec381324c283
https://github.com/sagnik/captum/tree/d6b663745ee6c01f072a4358233dec381324c283
ConcatPositionalEncoding
import torch import torch.nn as nn class ConcatPositionalEncoding(nn.Module): def __init__(self, d_model=256, max_len=512): super().__init__() self.timing_table = nn.Parameter(torch.FloatTensor(max_len, d_model // 2)) nn.init.normal_(self.timing_table) self.norm = nn.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 libdevice import torch.nn as nn assert...
skulick/self-attentive-parser
ConcatPositionalEncoding
false
4,353
[ "MIT" ]
0
04a91e80cc05bcfe8f48145517f58e85f0c8ade6
https://github.com/skulick/self-attentive-parser/tree/04a91e80cc05bcfe8f48145517f58e85f0c8ade6
PartitionedReLU
import torch import torch.nn as nn class PartitionedReLU(nn.ReLU): def forward(self, x): if isinstance(x, tuple): x_c, x_p = x else: x_c, x_p = torch.chunk(x, 2, dim=-1) return super().forward(x_c), super().forward(x_p) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
skulick/self-attentive-parser
PartitionedReLU
false
4,354
[ "MIT" ]
0
04a91e80cc05bcfe8f48145517f58e85f0c8ade6
https://github.com/skulick/self-attentive-parser/tree/04a91e80cc05bcfe8f48145517f58e85f0c8ade6
LogLoss
import torch from torch.nn import MSELoss class LogLoss(MSELoss): def __init__(self): super(LogLoss, self).__init__() self.loss = torch.nn.MSELoss() self.loss2 = torch.nn.MSELoss() def forward(self, input, target): tgt = torch.atan(target) inp = torch.atan(input) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import MSELoss...
slaveuser/testRepo20181123
LogLoss
false
4,355
[ "MIT" ]
0
0651de19b3b7d02f8c9094b8b24346ccc2e30480
https://github.com/slaveuser/testRepo20181123/tree/0651de19b3b7d02f8c9094b8b24346ccc2e30480
GlobalLayerNorm
import torch import torch.nn as nn from itertools import product as product class GlobalLayerNorm(nn.Module): def __init__(self, channel_size): super(GlobalLayerNorm, self).__init__() self.gamma = nn.Parameter(torch.Tensor(1, channel_size, 1)) self.beta = nn.Parameter(torch.Tensor(1, chan...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from itertools import product as product assert_size_stri...
slapshin/TalkNet_ASD
GlobalLayerNorm
false
4,356
[ "MIT" ]
0
343fac5c8d2bef2b98244e3acf20ac322711a4c7
https://github.com/slapshin/TalkNet_ASD/tree/343fac5c8d2bef2b98244e3acf20ac322711a4c7
PartitionedLinear
import torch import torch.nn as nn class PartitionedLinear(nn.Module): def __init__(self, in_features, out_features, bias=True): super().__init__() self.linear_c = nn.Linear(in_features // 2, out_features // 2, bias) self.linear_p = nn.Linear(in_features // 2, out_features // 2, bias) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
skulick/self-attentive-parser
PartitionedLinear
false
4,357
[ "MIT" ]
0
04a91e80cc05bcfe8f48145517f58e85f0c8ade6
https://github.com/skulick/self-attentive-parser/tree/04a91e80cc05bcfe8f48145517f58e85f0c8ade6
Normalize
import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self): super(Normalize, self).__init__() def forward(self, bottom): qn = torch.norm(bottom, p=2, dim=1).unsqueeze(dim=1) + 1e-12 top = bottom.div(qn) return top def get_inputs(): return [torch.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 libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
slyviacassell/Multi-taks-UNITE
Normalize
false
4,358
[ "MIT" ]
0
a010a92c94c0ee0f1ffed27df6d89da58d6d34c5
https://github.com/slyviacassell/Multi-taks-UNITE/tree/a010a92c94c0ee0f1ffed27df6d89da58d6d34c5
GlobalAveragePool2d
import torch import torch.nn as nn class GlobalAveragePool2d(nn.Module): def __init__(self): super(GlobalAveragePool2d, self).__init__() def forward(self, x: 'torch.Tensor'): assert len(x.size()) >= 2 x_size = x.size() out = x.view(*x_size[:-2], -1) out = out.mean(dim...
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...
slyviacassell/Multi-taks-UNITE
GlobalAveragePool2d
false
4,359
[ "MIT" ]
0
a010a92c94c0ee0f1ffed27df6d89da58d6d34c5
https://github.com/slyviacassell/Multi-taks-UNITE/tree/a010a92c94c0ee0f1ffed27df6d89da58d6d34c5
PointwiseConvolutionLayer
import torch class PointwiseConvolutionLayer(torch.nn.Module): def __init__(self, N, F, F_prime): super().__init__() self.f1 = torch.nn.Linear(F, 128) self.f2 = torch.nn.Linear(128, F_prime) def forward(self, f_bar_batch): output = torch.nn.functional.softplus(self.f1(f_bar_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.triton_helpers import libdevice, math as tl_math as...
slgao/FU-DeepLearningCourse
PointwiseConvolutionLayer
false
4,360
[ "MIT" ]
0
2300e8bdaa2afb4c73535d5de80874f6103af6f2
https://github.com/slgao/FU-DeepLearningCourse/tree/2300e8bdaa2afb4c73535d5de80874f6103af6f2
ArcFaceLinear
from torch.nn import Module import math import torch import torch.distributed import torch.nn.functional as F class ArcFaceLinear(Module): def __init__(self, embedding_size, num_classes): super(ArcFaceLinear, self).__init__() self.weight = torch.nn.Parameter(data=torch.FloatTensor(num_classes, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
smivv/kaggle-bengali
ArcFaceLinear
false
4,361
[ "Apache-2.0" ]
0
ab6a2153b657b4f4210551f7f4a674920d66a272
https://github.com/smivv/kaggle-bengali/tree/ab6a2153b657b4f4210551f7f4a674920d66a272
Encoder
import math import torch from torch import nn class NormLayer(nn.Module): """ Implementation of Layer Normalization (https://arxiv.org/abs/1607.06450) It consists of Batch Normalization Transform to speed up learning with mean and std computed according to the above paper normWeights: weights for this 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 from torch._inductor.runtime....
simonepreite/QABERT
Encoder
false
4,362
[ "MIT" ]
0
ed3e49f6619f3ff660068291231909693cb8f5d5
https://github.com/simonepreite/QABERT/tree/ed3e49f6619f3ff660068291231909693cb8f5d5
InnerProductDecoder
import torch import torch.nn import torch.nn.modules.loss import torch.nn.functional as F import torch.nn as nn class InnerProductDecoder(nn.Module): """Decoder for using inner product for prediction.""" def __init__(self, dropout, act=torch.sigmoid): super(InnerProductDecoder, 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 import torch.nn.modules.loss import torch.nn as nn assert_size_s...
spatial-Transcriptomics/DeepST
InnerProductDecoder
false
4,363
[ "MIT" ]
0
47ce64b06b62395cd2983939d4bf2419f558a562
https://github.com/spatial-Transcriptomics/DeepST/tree/47ce64b06b62395cd2983939d4bf2419f558a562
Encoder
import torch import torch.nn.functional as F class Encoder(torch.nn.Module): """Documentation for Encoder """ def __init__(self, input_dim, hidden_dim, latent_dim): super(Encoder, self).__init__() self.e1 = torch.nn.Linear(input_dim, hidden_dim) self.e2 = torch.nn.Linear(hidden_d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
slgao/FU-DeepLearningCourse
Encoder
false
4,364
[ "MIT" ]
0
2300e8bdaa2afb4c73535d5de80874f6103af6f2
https://github.com/slgao/FU-DeepLearningCourse/tree/2300e8bdaa2afb4c73535d5de80874f6103af6f2
PartitionedMultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F class PartitionedMultiHeadAttention(nn.Module): def __init__(self, d_model, n_head, d_qkv, attention_dropout=0.1, initializer_range=0.02): super().__init__() self.w_qkv_c = nn.Parameter(torch.Tensor(n_head, d_m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
skulick/self-attentive-parser
PartitionedMultiHeadAttention
false
4,365
[ "MIT" ]
0
04a91e80cc05bcfe8f48145517f58e85f0c8ade6
https://github.com/skulick/self-attentive-parser/tree/04a91e80cc05bcfe8f48145517f58e85f0c8ade6
CausalConv1d
import torch import torch.nn as nn class CausalConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=1, **kwargs): super(CausalConv1d, self).__init__(in_channels, out_channels, kernel_size, padding=dilation * (kernel_size - 1), dilation= ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
soumyac1999/instrumental-music-translation
CausalConv1d
false
4,366
[ "MIT" ]
0
f0d5edfdf34ef7bc9b329c426089f61d3468caa8
https://github.com/soumyac1999/instrumental-music-translation/tree/f0d5edfdf34ef7bc9b329c426089f61d3468caa8
RefModel3d2
import torch import torch.nn.functional as F class RefModel3d2(torch.nn.Module): """The 3D reference model.""" def __init__(self): super().__init__() self.l1 = torch.nn.Conv3d(2, 2, 3, padding=1, stride=2, padding_mode='replicate', bias=False) self.l2 = torch.nn.GroupNorm(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
shuohan/pytorch-layers
RefModel3d2
false
4,367
[ "MIT" ]
0
020846fd02d501cf477552179c19ba4b5e9a0695
https://github.com/shuohan/pytorch-layers/tree/020846fd02d501cf477552179c19ba4b5e9a0695
RefModel3d
import torch import torch.nn.functional as F class RefModel3d(torch.nn.Module): """The 3D reference model.""" def __init__(self): super().__init__() self.l1 = torch.nn.Conv3d(2, 2, 1, bias=True) self.l2 = torch.nn.InstanceNorm3d(2, affine=True) self.l3 = torch.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....
shuohan/pytorch-layers
RefModel3d
false
4,368
[ "MIT" ]
0
020846fd02d501cf477552179c19ba4b5e9a0695
https://github.com/shuohan/pytorch-layers/tree/020846fd02d501cf477552179c19ba4b5e9a0695
HardSwish
import torch import torch.nn as nn class HardSwish(nn.Module): """hardswish activation func (see MobileNetV3)""" def __init__(self): super(HardSwish, self).__init__() def forward(self, x): return x * nn.ReLU6(inplace=True)(x + 3.0) / 6.0 def get_inputs(): return [torch.rand([4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
stepbuystep/LightNAS
HardSwish
false
4,369
[ "Apache-2.0" ]
0
030d0e13e0c85354ed711e36fc4b91b1541f95e5
https://github.com/stepbuystep/LightNAS/tree/030d0e13e0c85354ed711e36fc4b91b1541f95e5
DDPGActor
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def fanin_init(size, fanin=None): """ Initilise network weights """ fanin = fanin or size[0] v = 1.0 / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class DDPGActor(nn.Module): """ Pytorc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Nikhil-Paleti/sawyer_analysis_reinforcement_learning
DDPGActor
false
4,370
[ "MIT" ]
0
dc774c9a162fabb98493b69d7656cb14cb37f094
https://github.com/Nikhil-Paleti/sawyer_analysis_reinforcement_learning/tree/dc774c9a162fabb98493b69d7656cb14cb37f094
attentionLayer
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import MultiheadAttention from itertools import product as product class attentionLayer(nn.Module): def __init__(self, d_model, nhead, dropout=0.1): super(attentionLayer, self).__init__() self.self_attn = MultiheadAt...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
slapshin/TalkNet_ASD
attentionLayer
false
4,371
[ "MIT" ]
0
343fac5c8d2bef2b98244e3acf20ac322711a4c7
https://github.com/slapshin/TalkNet_ASD/tree/343fac5c8d2bef2b98244e3acf20ac322711a4c7
BananaResNet
import torch import torch.nn as nn import torch.nn.functional as F class BananaResNet(nn.Module): def __init__(self, state_size, action_size): super(BananaResNet, self).__init__() self.blk1fc1 = nn.Linear(state_size, 128) self.blk1fc2 = nn.Linear(128, 128) self.blk1fc3 = nn.Linear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
slash-fury/DRL-Navigation
BananaResNet
false
4,372
[ "MIT" ]
0
5989dca62590b611ab39ac8722a22d897c65cc88
https://github.com/slash-fury/DRL-Navigation/tree/5989dca62590b611ab39ac8722a22d897c65cc88
HardSigmoid
import torch import torch.nn as nn class HardSigmoid(nn.Module): """hardsigmoid activation func used in squeeze-and-excitation module (see MobileNetV3)""" def __init__(self): super(HardSigmoid, self).__init__() def forward(self, x): return nn.ReLU6(inplace=True)(x + 3.0) / 6.0 def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
stepbuystep/LightNAS
HardSigmoid
false
4,373
[ "Apache-2.0" ]
0
030d0e13e0c85354ed711e36fc4b91b1541f95e5
https://github.com/stepbuystep/LightNAS/tree/030d0e13e0c85354ed711e36fc4b91b1541f95e5
HeatmapLoss
import torch import torch.utils.data class HeatmapLoss(torch.nn.Module): """ loss for detection heatmap """ def __init__(self): super(HeatmapLoss, self).__init__() def forward(self, pred, gt): l = (pred - gt) ** 2 l = l.mean(dim=3).mean(dim=2).mean(dim=1) return 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
seeinggreen/pyslr
HeatmapLoss
false
4,374
[ "BSD-3-Clause" ]
0
17009582f70aed09a9174ce47f9414f715173018
https://github.com/seeinggreen/pyslr/tree/17009582f70aed09a9174ce47f9414f715173018
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 GCLayer(Module): def __init__(self, dim_in, dim_out): super(GCLayer, self).__init__() self.dim_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....
spacemanidol/CS512DM
GCN
false
4,375
[ "MIT" ]
0
fa664ceb7526e27b9cccd372b65b15c587095c49
https://github.com/spacemanidol/CS512DM/tree/fa664ceb7526e27b9cccd372b65b15c587095c49
DilatedResConv
import torch import torch.nn as nn import torch.nn.functional as F class DilatedResConv(nn.Module): def __init__(self, channels, dilation=1, activation='relu', padding=1, kernel_size=3, left_pad=0): super().__init__() in_channels = channels if activation == 'relu': sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
soumyac1999/instrumental-music-translation
DilatedResConv
false
4,376
[ "MIT" ]
0
f0d5edfdf34ef7bc9b329c426089f61d3468caa8
https://github.com/soumyac1999/instrumental-music-translation/tree/f0d5edfdf34ef7bc9b329c426089f61d3468caa8
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 ...
sourcery-ai-bot/Megatron-LM
VitMlpHead
false
4,377
[ "MIT" ]
0
f27f44e2c49d1cb39b2288bef6f7d837e11094cb
https://github.com/sourcery-ai-bot/Megatron-LM/tree/f27f44e2c49d1cb39b2288bef6f7d837e11094cb
Attention
import torch from torch import nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. """ def __init__(self, dim): super(Attention, self).__init__() self.dim = dim self.linear1 = nn.Linear(dim ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
salmon7ish/Video-Captioning
Attention
false
4,378
[ "MIT" ]
0
08359b1824195a7f5eac5b58982efd19ebc6db01
https://github.com/salmon7ish/Video-Captioning/tree/08359b1824195a7f5eac5b58982efd19ebc6db01
PartitionedTransformerEncoderLayer
import math import torch import torch.nn as nn import torch.nn.functional as F class FeatureDropoutFunction(torch.autograd.function.InplaceFunction): @staticmethod def forward(ctx, input, p=0.5, train=False, inplace=False): if p < 0 or p > 1: raise ValueError( 'dropout pro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
skulick/self-attentive-parser
PartitionedTransformerEncoderLayer
false
4,379
[ "MIT" ]
0
04a91e80cc05bcfe8f48145517f58e85f0c8ade6
https://github.com/skulick/self-attentive-parser/tree/04a91e80cc05bcfe8f48145517f58e85f0c8ade6
mlp_model
import torch import torch.nn as nn class mlp_model(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim): super(mlp_model, self).__init__() self.fc1 = nn.Linear(input_dim, hidden_dim) self.relu1 = nn.ReLU() self.fc2 = nn.Linear(hidden_dim, 128) self.relu2 = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
st186/complementary_label_learning
mlp_model
false
4,380
[ "MIT" ]
0
5d22ea638e9e6c087cc5bba7797c1c201679ba12
https://github.com/st186/complementary_label_learning/tree/5d22ea638e9e6c087cc5bba7797c1c201679ba12
PrimaryCaps
import torch import torch.nn as nn def squash(x, dim=2): v_length_sq = x.pow(2).sum(dim=dim, keepdim=True) v_length = torch.sqrt(v_length_sq) scaling_factor = v_length_sq / (1 + v_length_sq) / v_length return x * scaling_factor class PrimaryCaps(nn.Module): """ PrimaryCaps layers. """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
spikefairway/CapsNet-PyTorch
PrimaryCaps
false
4,381
[ "MIT" ]
0
76aaabaad01283333a5f73a564cb1461449b4449
https://github.com/spikefairway/CapsNet-PyTorch/tree/76aaabaad01283333a5f73a564cb1461449b4449
DownRightShiftedConv2d
import torch import torch.nn as nn class DownRightShiftedConv2d(nn.Conv2d): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.shift_pad = nn.ConstantPad2d((self.kernel_size[1] - 1, 0, self .kernel_size[0] - 1, 0), 0.0) def forward(self, x): x = 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...
stankevich-mipt/pixiv-tags-to-image
DownRightShiftedConv2d
false
4,382
[ "MIT" ]
0
220a157956296c8a5b183ffe219e7c1929342c39
https://github.com/stankevich-mipt/pixiv-tags-to-image/tree/220a157956296c8a5b183ffe219e7c1929342c39
OhemLoss
import torch import torch.nn as nn class OhemLoss(nn.Module): def __init__(self): super(OhemLoss, self).__init__() self.criteria = nn.BCELoss() def forward(self, label_p, label_t): label_p = label_p.view(-1) label_t = label_t.view(-1) loss = self.criteria(label_p, lab...
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...
suifengwangshi/MotifC
OhemLoss
false
4,383
[ "Apache-2.0" ]
0
34117a6bfb7dacd5a84da3abd5b8a339ae73cc76
https://github.com/suifengwangshi/MotifC/tree/34117a6bfb7dacd5a84da3abd5b8a339ae73cc76
EncoderBlock
import torch import torch.nn as nn from collections import OrderedDict class EncoderBlock(nn.Module): def __init__(self, n_in, n_out, n_layers): super().__init__() self.n_in = n_in self.n_out = n_out self.n_hid = self.n_out self.n_layers = n_layers self.post_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 from co...
stankevich-mipt/pixiv-tags-to-image
EncoderBlock
false
4,384
[ "MIT" ]
0
220a157956296c8a5b183ffe219e7c1929342c39
https://github.com/stankevich-mipt/pixiv-tags-to-image/tree/220a157956296c8a5b183ffe219e7c1929342c39
DownShiftedConv2d
import torch import torch.nn as nn class DownShiftedConv2d(nn.Conv2d): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.shift_pad = nn.ConstantPad2d((int((self.kernel_size[1] - 1) // 2), int((self.kernel_size[1] - 1) // 2), self.kernel_size[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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
stankevich-mipt/pixiv-tags-to-image
DownShiftedConv2d
false
4,385
[ "MIT" ]
0
220a157956296c8a5b183ffe219e7c1929342c39
https://github.com/stankevich-mipt/pixiv-tags-to-image/tree/220a157956296c8a5b183ffe219e7c1929342c39
StatsPool
import torch import warnings import torch.nn as nn from typing import Optional import torch.optim import torch.nn.functional as F class StatsPool(nn.Module): """Statistics pooling Compute temporal mean and (unbiased) standard deviation and returns their concatenation. Reference --------- htt...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo....
suissemaxx/pyannote-audio-develop_colab
StatsPool
false
4,386
[ "MIT" ]
0
e9499372a1771c21e1604424a6dd041337111093
https://github.com/suissemaxx/pyannote-audio-develop_colab/tree/e9499372a1771c21e1604424a6dd041337111093
ConvRelu
import torch import torch.nn as nn class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = nn.Conv2d(in_, out, 3, padding=1) self.activation = nn.LeakyReLU(inplace=True) def forward(self, x): x = self.conv(x) x = self.activation(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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
sudonull1/Crack-Segmentation
ConvRelu
false
4,387
[ "MIT" ]
0
640f86839ce5d79b48916b176caf8ad83c7355ae
https://github.com/sudonull1/Crack-Segmentation/tree/640f86839ce5d79b48916b176caf8ad83c7355ae
fire
import torch from itertools import product as product import torch.nn as nn class fire(nn.Module): def __init__(self, inplanes, squeeze_planes, expand_planes, st=1): super(fire, self).__init__() self.conv1 = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1, stride=1) self.rel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from itertools import product...
suiguoxin/Pytorch_Retinaface
fire
false
4,388
[ "MIT" ]
0
d9393bad43103635261b4ec5b03f20e79931d0da
https://github.com/suiguoxin/Pytorch_Retinaface/tree/d9393bad43103635261b4ec5b03f20e79931d0da
Attn
import torch from torch import nn class Attn(torch.nn.Module): """ Attention: feature_dim: dimension of feature embedding method: method to calculate attention, (general, dot, concat) input_dim: dimension of input embedding, default is the same as feature_dim; method dot is only availa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
stillarrow/NRT-Lite
Attn
false
4,389
[ "MIT" ]
0
ba0f091ebfeae19325ce713e11bc426ff63402cd
https://github.com/stillarrow/NRT-Lite/tree/ba0f091ebfeae19325ce713e11bc426ff63402cd
TransformerEncoderLayer
import torch from torch import nn def fill_with_neg_inf(t): """FP16-compatible function that fills a tensor with -inf.""" return t.float().fill_(float('-inf')).type_as(t) def buffered_future_mask(tensor1, tensor2, device): dim1 = dim2 = tensor1.size() if tensor2 is not None: dim2 = tensor2.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._inductor.runtime....
sreekanth-sreekumar/daiz-woz-nlp-project
TransformerEncoderLayer
false
4,390
[ "MIT" ]
0
9971f752aee6a850e265f15e97a3a1ef2dacd323
https://github.com/sreekanth-sreekumar/daiz-woz-nlp-project/tree/9971f752aee6a850e265f15e97a3a1ef2dacd323
IdentityPadding
import torch import torch.nn as nn import torch.nn.functional as F class IdentityPadding(nn.Module): def __init__(self, num_filters, channels_in, stride): super(IdentityPadding, self).__init__() self.identity = nn.MaxPool2d(1, stride=stride) self.num_zeros = num_filters - channels_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
sunqcc/Pytorch-HW-CIFAR10
IdentityPadding
false
4,391
[ "MIT" ]
0
33a55a5a832474083820b65c46f809ac98f8b109
https://github.com/sunqcc/Pytorch-HW-CIFAR10/tree/33a55a5a832474083820b65c46f809ac98f8b109
SoftCrossEntropyLoss2d
import torch import torch.nn.functional as F from torch import nn class SoftCrossEntropyLoss2d(nn.Module): def forward(self, inputs, targets): loss = 0 inputs = -F.log_softmax(inputs, dim=1) for index in range(inputs.size()[0]): loss += F.conv2d(inputs[range(index, index + 1)]...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sudohainguyen/GLNet-pytorch
SoftCrossEntropyLoss2d
false
4,392
[ "Apache-2.0" ]
0
91454831fac6e27f894d55d320dd3bcec946ac0f
https://github.com/sudohainguyen/GLNet-pytorch/tree/91454831fac6e27f894d55d320dd3bcec946ac0f
TransformerDecoderLayer
import torch from torch import nn import torch.nn.functional as F def _get_activation_fn(activation): if activation == 'relu': return F.relu raise RuntimeError('activation shud be relu, not {}'.format(activation)) class TransformerDecoderLayer(nn.Module): def __init__(self, d_model, nhead, dim_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
salmon7ish/Video-Captioning
TransformerDecoderLayer
false
4,393
[ "MIT" ]
0
08359b1824195a7f5eac5b58982efd19ebc6db01
https://github.com/salmon7ish/Video-Captioning/tree/08359b1824195a7f5eac5b58982efd19ebc6db01
AvgPoolPadding
import torch import torch.nn as nn import torch.nn.functional as F class AvgPoolPadding(nn.Module): def __init__(self, num_filters, channels_in, stride): super(AvgPoolPadding, self).__init__() self.identity = nn.AvgPool2d(stride, stride=stride) self.num_zeros = num_filters - channels_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
sunqcc/Pytorch-HW-CIFAR10
AvgPoolPadding
false
4,394
[ "MIT" ]
0
33a55a5a832474083820b65c46f809ac98f8b109
https://github.com/sunqcc/Pytorch-HW-CIFAR10/tree/33a55a5a832474083820b65c46f809ac98f8b109
GrayScaleToRGB
import torch import torch.utils.data class GrayScaleToRGB(torch.nn.Module): """ Applies the transformation on an image to convert grayscale to rgb """ def __init__(self): super().__init__() def forward(self, sample): return sample.repeat(3, 1, 1) def get_inputs(): return [t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
saifullah3396/doc_robustness
GrayScaleToRGB
false
4,395
[ "Apache-2.0" ]
0
80207fb44709d4b97de826331c074784be9c75ca
https://github.com/saifullah3396/doc_robustness/tree/80207fb44709d4b97de826331c074784be9c75ca
SineActivation
import torch import torch.nn as nn def t2v(tau, f, weight_linear, bias_linear, weight_periodic, bias_periodic, arg=None): if arg: v1 = f(torch.matmul(tau, weight_linear) + bias_linear, arg) else: v1 = f(torch.matmul(tau, weight_linear) + bias_linear) v2 = torch.matmul(tau, weight_perio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
sungreong/PyTimeSeries
SineActivation
false
4,396
[ "MIT" ]
0
d5321c1226fc7fb6a45fec7009843894be417594
https://github.com/sungreong/PyTimeSeries/tree/d5321c1226fc7fb6a45fec7009843894be417594
GraphConvolution
from torch.nn import Module import torch from torch import nn import torch.autograd from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907. """ def __init__(self, state_dim, name='', out_state_dim=None): sup...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch import nn import torch.autograd from torc...
sumanmichael/Palmira_pb
GraphConvolution
false
4,397
[ "MIT" ]
0
8ca9f370ccd9bba694317be648ce5e4f4c55d0e7
https://github.com/sumanmichael/Palmira_pb/tree/8ca9f370ccd9bba694317be648ce5e4f4c55d0e7
GraphResConvolution
from torch.nn import Module import torch from torch import nn import torch.autograd from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907. """ def __init__(self, state_dim, name='', out_state_dim=None): sup...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 f...
sumanmichael/Palmira_pb
GraphResConvolution
false
4,398
[ "MIT" ]
0
8ca9f370ccd9bba694317be648ce5e4f4c55d0e7
https://github.com/sumanmichael/Palmira_pb/tree/8ca9f370ccd9bba694317be648ce5e4f4c55d0e7
CosineActivation
import torch import torch.nn as nn def t2v(tau, f, weight_linear, bias_linear, weight_periodic, bias_periodic, arg=None): if arg: v1 = f(torch.matmul(tau, weight_linear) + bias_linear, arg) else: v1 = f(torch.matmul(tau, weight_linear) + bias_linear) v2 = torch.matmul(tau, weight_perio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
sungreong/PyTimeSeries
CosineActivation
false
4,399
[ "MIT" ]
0
d5321c1226fc7fb6a45fec7009843894be417594
https://github.com/sungreong/PyTimeSeries/tree/d5321c1226fc7fb6a45fec7009843894be417594
GlobalAvgPool2d
import torch import torch.nn as nn class GlobalAvgPool2d(nn.Module): def forward(self, inputs): return inputs.mean(-1).mean(-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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
synxlin/mini-torchpack
GlobalAvgPool2d
false
4,400
[ "MIT" ]
0
3ea5bca75992941e4346102d99e789a88417d7c1
https://github.com/synxlin/mini-torchpack/tree/3ea5bca75992941e4346102d99e789a88417d7c1
CharbonnierLoss
import torch import torch.utils.data import torch.nn as nn class CharbonnierLoss(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=1e-06): super(CharbonnierLoss, self).__init__() self.eps = eps def forward(self, x, y): diff = x - y loss = torch.sum(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.utils.data impo...
sutkarsh/EDVR
CharbonnierLoss
false
4,401
[ "Apache-2.0" ]
0
cd9f2d46edbb00333d8ffb31aebc52cfbda4b6e3
https://github.com/sutkarsh/EDVR/tree/cd9f2d46edbb00333d8ffb31aebc52cfbda4b6e3
ConvLayer
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as f class ConvLayer(nn.Conv3d): def __init__(self, network_config, config, name, in_shape, groups=1): self.name = name self.layer_config = config self.network_config = network_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
superrrpotato/Spike-Train-Predict
ConvLayer
false
4,402
[ "MIT" ]
0
0a924e5af11c2fc58cf9049a73fff00970a3c967
https://github.com/superrrpotato/Spike-Train-Predict/tree/0a924e5af11c2fc58cf9049a73fff00970a3c967
Policy
import torch import torch.nn as nn class Policy(nn.Module): def __init__(self, num_inputs, num_outputs): super(Policy, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.action_mean = nn.Linear(64, num_outputs) self.action_mean....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
SaminYeasar/pytorch-trpo
Policy
false
4,403
[ "MIT" ]
0
653a3357cf0461c175fb741604c0cd4ad1f4b841
https://github.com/SaminYeasar/pytorch-trpo/tree/653a3357cf0461c175fb741604c0cd4ad1f4b841
Gate
import torch from torch import nn class Gate(nn.Module): def __init__(self, input_size, dropout=0.2): """ To determine the importance of passage parts and attend to the ones relevant to the question, this Gate was added to the input of RNNCell in both Gated Attention-based Recurre...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
tailerr/R-NET-pytorch
Gate
false
4,404
[ "MIT" ]
0
a6ed4a02b0cf68bade9e9a43a93ec290a3b6fabd
https://github.com/tailerr/R-NET-pytorch/tree/a6ed4a02b0cf68bade9e9a43a93ec290a3b6fabd
DAInsHead
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 class DAInsHead(nn.Module): """ Adds a simple Instance-level Domain Classifier head """ def __init__(self, in_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 import triton_helpers import torch.nn as nn import ...
shreyasrajesh/DA-Object-Detection
DAInsHead
false
4,405
[ "MIT" ]
0
b1919fdf49a9f1589c48c63e0a3122852e5557ce
https://github.com/shreyasrajesh/DA-Object-Detection/tree/b1919fdf49a9f1589c48c63e0a3122852e5557ce
StyleResidual
import torch from torch import nn import torch.utils.data import torch.optim class StyleResidual(nn.Module): """Styling.""" def __init__(self, d_channel: 'int', d_style: 'int', kernel_size: 'int'=1): super().__init__() self.rs = nn.Conv1d(in_channels=d_style, out_channels=d_channel, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.optim assert_size_stri...
taufique74/nemotest
StyleResidual
false
4,406
[ "Apache-2.0" ]
0
812f201913cb9922bedc1b225dff844ffc765bf1
https://github.com/taufique74/nemotest/tree/812f201913cb9922bedc1b225dff844ffc765bf1
TorchGloVeLoss
import torch import torch.nn as nn import torch.utils.data class TorchGloVeLoss(nn.Module): def __init__(self): super().__init__() self.reduction = 'sum' def forward(self, diffs, weights): return torch.sum(0.5 * torch.mul(weights, diffs ** 2)) def get_inputs(): return [torch.ra...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
tayfuntuna/cs224u
TorchGloVeLoss
false
4,407
[ "Apache-2.0" ]
0
4368090c679d869f21ed2393b9ca0ef217b5c404
https://github.com/tayfuntuna/cs224u/tree/4368090c679d869f21ed2393b9ca0ef217b5c404
TorchGloVeModel
import torch import torch.nn as nn import torch.utils.data from torch.nn.init import xavier_uniform_ class TorchGloVeModel(nn.Module): def __init__(self, n_words, embed_dim): super().__init__() self.n_words = n_words self.embed_dim = embed_dim self.W = self._init_weights(self.n_wo...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch.nn.init import xavier_u...
tayfuntuna/cs224u
TorchGloVeModel
false
4,408
[ "Apache-2.0" ]
0
4368090c679d869f21ed2393b9ca0ef217b5c404
https://github.com/tayfuntuna/cs224u/tree/4368090c679d869f21ed2393b9ca0ef217b5c404
PoswiseFeedForwardNet
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class PoswiseFeedForwardNet(nn.Module): def __init__(self, config): super().__init__() self.config = config self.conv1 = nn.Conv1d(in_channels=self.config.d_hidn, 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 ...
star14ms/transformer-evolution
PoswiseFeedForwardNet
false
4,409
[ "Apache-2.0" ]
0
95b57485f59a0cee4528af62e5010002e6a3448a
https://github.com/star14ms/transformer-evolution/tree/95b57485f59a0cee4528af62e5010002e6a3448a
WL1Loss
import torch import torch.nn as nn class WL1Loss(nn.Module): def __init__(self): super(WL1Loss, self).__init__() def forward(self, pred, target, weight): return torch.mean(weight * torch.abs(pred - target)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
tccoin/UM-545-Machine-Learning
WL1Loss
false
4,410
[ "MIT" ]
0
0854d7ad7e546c009edeb4a4d3e507ce95b99cf8
https://github.com/tccoin/UM-545-Machine-Learning/tree/0854d7ad7e546c009edeb4a4d3e507ce95b99cf8
Net
import torch import torch.nn as nn import torch.nn.functional as F from torch import tanh class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.a1 = nn.Conv2d(5, 16, kernel_size=3, padding=1) self.a2 = nn.Conv2d(16, 16, kernel_size=3, padding=1) self.a3 = 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._inductor.runtime....
srivarshan-s/Neural-Chess-2D
Net
false
4,411
[ "MIT" ]
0
81ec7eb9b4c3c82dc7f6ba5bd4313bd6ede9994e
https://github.com/srivarshan-s/Neural-Chess-2D/tree/81ec7eb9b4c3c82dc7f6ba5bd4313bd6ede9994e
PointerNetwork
import torch from torch import nn class PointerNetwork(nn.Module): def __init__(self, input_size, model_dim, attn_size=75, dropout=0.2): """ Pointer Network Args: input_size(int): size of input Input: - **H** of shape `(passage_legth...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tailerr/R-NET-pytorch
PointerNetwork
false
4,412
[ "MIT" ]
0
a6ed4a02b0cf68bade9e9a43a93ec290a3b6fabd
https://github.com/tailerr/R-NET-pytorch/tree/a6ed4a02b0cf68bade9e9a43a93ec290a3b6fabd
Net
import torch import torch.nn as nn import torch.nn.functional as F def set_init(layers): for layer in layers: nn.init.normal_(layer.weight, mean=0.0, std=0.1) nn.init.constant_(layer.bias, 0.0) class Net(nn.Module): def __init__(self, s_dim, a_dim): super(Net, 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 import torch.nn as nn import ...
taomo/pytorch-A3C-1
Net
false
4,413
[ "MIT" ]
0
8e26720c75ca8b7e987b267e5e0e652d0c5d23cf
https://github.com/taomo/pytorch-A3C-1/tree/8e26720c75ca8b7e987b267e5e0e652d0c5d23cf
GlobalWeightedAvgPool2d
import torch from torch import nn class GlobalWeightedAvgPool2d(nn.Module): """ Global Weighted Average Pooling from paper "Global Weighted Average Pooling Bridges Pixel-level Localization and Image-level Classification" """ def __init__(self, features: 'int', flatten=False): super().__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 math as tl_math from torch im...
theNero93/dfdc_deepfake_challenge
GlobalWeightedAvgPool2d
false
4,414
[ "MIT" ]
0
ef275206efc6f1b0b7984b370a14bd8db61d1ec1
https://github.com/theNero93/dfdc_deepfake_challenge/tree/ef275206efc6f1b0b7984b370a14bd8db61d1ec1
My_SmoothL1Loss
import torch class My_SmoothL1Loss(torch.nn.Module): def __init__(self): super(My_SmoothL1Loss, self).__init__() def forward(self, x, y): total_loss = 0 assert x.shape == y.shape z = (x - y).float() mse_mask = (torch.abs(z) < 0.01).float() l1_mask = (torch.abs...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
theleokul/AWR-Adaptive-Weighting-Regression
My_SmoothL1Loss
false
4,415
[ "MIT" ]
0
a6c224302bab474db8b774a2d009c9497e32f6bd
https://github.com/theleokul/AWR-Adaptive-Weighting-Regression/tree/a6c224302bab474db8b774a2d009c9497e32f6bd
CategoricalDQN
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class CategoricalDQN(nn.Module): def __init__(self, num_inputs, num_actions, args): super(CategoricalDQN, self).__init__() self.num_inputs = num_inputs self.num_actions = num_a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
tegg89/categorical_dqn
CategoricalDQN
false
4,416
[ "MIT" ]
0
647c24ee4734450551fc446d3225f57dadd82d48
https://github.com/tegg89/categorical_dqn/tree/647c24ee4734450551fc446d3225f57dadd82d48
UNet
import torch from torch.functional import F import torch.nn as nn import torch.nn.functional as F class down(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.functional import ...
samuelpietri/Super-SloMo
UNet
false
4,417
[ "MIT" ]
0
e20eaa5550c30737be42b61f8e82e731cfd17457
https://github.com/samuelpietri/Super-SloMo/tree/e20eaa5550c30737be42b61f8e82e731cfd17457
SelfAttention2d
import torch from torch import nn class SelfAttention2d(nn.Module): def __init__(self, c_in, n_head=1, dropout_rate=0.1): super().__init__() assert c_in % n_head == 0 self.norm = nn.GroupNorm(1, c_in) self.n_head = n_head self.qkv_proj = nn.Conv2d(c_in, c_in * 3, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
technillogue/v-diffusion-pytorch
SelfAttention2d
false
4,418
[ "MIT" ]
0
3aa8c7f32adbde1d1ea3a9650004ffafabe5221b
https://github.com/technillogue/v-diffusion-pytorch/tree/3aa8c7f32adbde1d1ea3a9650004ffafabe5221b
BCEWithLogitsLoss
import torch from torch import nn as nn from torch.utils import data as data from torch import autograd as autograd import torch.onnx class BCEWithLogitsLoss(nn.Module): def __init__(self, loss_weight=1.0, **kwargs): super(BCEWithLogitsLoss, self).__init__() self.bce_wlogits_loss = nn.BCEWithLogi...
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 ...
theleokul/Real-ESRGAN
BCEWithLogitsLoss
false
4,419
[ "BSD-3-Clause" ]
0
0afbc090d012d729e6cb3ff47a80018d53bce3f6
https://github.com/theleokul/Real-ESRGAN/tree/0afbc090d012d729e6cb3ff47a80018d53bce3f6
Emo16
import torch import numpy as np from torch import nn import torch.nn.functional as F class Emo16(nn.Module): def __init__(self, input_size: 'int', num_channels: 'int'=40): """ Speech emotion recognition model proposed in: `Trigeorgis, G., Ringeval, F., Brueckner, R., Marchi, E.,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
tfyd/myEnd2you
Emo16
false
4,421
[ "BSD-3-Clause" ]
0
455d5404a19dd4867cb5db4f30705041d425d2b3
https://github.com/tfyd/myEnd2you/tree/455d5404a19dd4867cb5db4f30705041d425d2b3
ReluWithStats
import torch import torch.nn as nn import torch.nn.functional as F class ReluWithStats(nn.Module): def __init__(self): super(ReluWithStats, self).__init__() self.collect_preact = True self.avg_preacts = [] def forward(self, preact): if self.collect_preact: self.av...
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 ...
thudzj/SPAT
ReluWithStats
false
4,422
[ "MIT" ]
0
65632c157f40c05c9aee59080e26457bed5b484c
https://github.com/thudzj/SPAT/tree/65632c157f40c05c9aee59080e26457bed5b484c
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.LayerNorm): def __init__(self, normalized_shape, eps=1e-05, elementwise_affine=True): """Layer Norm.""" super(LayerNorm, self).__init__(normalized_shape, eps=eps, elementwise_affine=elementwise_affine) def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
thetobysiu/transfer-pytorch-dc-tts
LayerNorm
false
4,423
[ "MIT" ]
0
20d0c381970a01f0e343c65aeac2f325be436a7e
https://github.com/thetobysiu/transfer-pytorch-dc-tts/tree/20d0c381970a01f0e343c65aeac2f325be436a7e
FFNNClassifier
from torch.nn import Module import torch from torch import FloatTensor from torch.nn import Linear from torch.nn.functional import tanh from torch.nn.functional import log_softmax from torch.autograd import Variable class FFNNClassifier(Module): def __init__(self, n_inputs, n_hidden, n_outputs): super(FF...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
theofpa/ci-torcs
FFNNClassifier
false
4,424
[ "MIT" ]
0
fcd1e9822301f1ad8f633468ed6276059afa94b9
https://github.com/theofpa/ci-torcs/tree/fcd1e9822301f1ad8f633468ed6276059afa94b9
_SepConv1d
import torch from torch import nn class _SepConv1d(nn.Module): """A simple separable convolution implementation. The separable convlution is a method to reduce number of the parameters in the deep learning network for slight decrease in predictions quality. """ def __init__(self, ni, no, 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
thupchnsky/ModifiedBasesAnalysis
_SepConv1d
false
4,425
[ "MIT" ]
0
904fab75eb5fdc67a050b3862d1432ecce8cf691
https://github.com/thupchnsky/ModifiedBasesAnalysis/tree/904fab75eb5fdc67a050b3862d1432ecce8cf691
Highway
import torch import torch.nn as nn import torch.nn.utils class Highway(nn.Module): """it is not fun""" def __init__(self, e_word_size, drop_rate=0.3): super(Highway, self).__init__() self.w_proj = nn.Linear(e_word_size, e_word_size) self.w_gate = nn.Linear(e_word_size, e_word_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 import torch.nn as nn import ...
thophan92/cs224n-winter2019
Highway
false
4,426
[ "MIT" ]
0
f3f8041b35e949e73167135d662a2bd93e7406de
https://github.com/thophan92/cs224n-winter2019/tree/f3f8041b35e949e73167135d662a2bd93e7406de
GroupLinear
import torch import torch.optim import torch.nn as nn import torch.nn.functional as f class GroupLinear(nn.Module): def __init__(self, groups, channels, map_size, dropout=None): super(GroupLinear, self).__init__() self.groups = groups self.channels = channels self.map_size = map_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.optim import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
tiruns/grad_proj
GroupLinear
false
4,427
[ "MIT" ]
0
8882ff1e3205e346e972d963480c57dbf5aef407
https://github.com/tiruns/grad_proj/tree/8882ff1e3205e346e972d963480c57dbf5aef407
Net
import torch from torch import nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 16, 3, padding=1) self.conv2 = nn.Conv2d(16, 32, 3, padding=1) self.conv3 = nn.Conv2d(32, 64, 3, padding=1) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
thejammerr/DriveAlert
Net
false
4,428
[ "MIT" ]
0
bac025c2e2919aeb67ef717e90d3049403ecdef5
https://github.com/thejammerr/DriveAlert/tree/bac025c2e2919aeb67ef717e90d3049403ecdef5
Actor
import torch import numpy as np import torch.nn.functional as F from torch import nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tjkemp/ubik-agent
Actor
false
4,429
[ "MIT" ]
0
34e4dd0d6319b8f5c5dba0cd9e087490720b723b
https://github.com/tjkemp/ubik-agent/tree/34e4dd0d6319b8f5c5dba0cd9e087490720b723b
StableBCELoss
import torch import torch.nn as nn class StableBCELoss(nn.Module): def __init__(self): super(StableBCELoss, self).__init__() def forward(self, input, target): input = input.float().view(-1) target = target.float().view(-1) neg_abs = -input.abs() loss = input.clamp(min...
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 ...
toandaominh1997/understanding_cloud_organization
StableBCELoss
false
4,431
[ "MIT" ]
0
7da991ff3da557c18f4585c1b956ed799c104c7c
https://github.com/toandaominh1997/understanding_cloud_organization/tree/7da991ff3da557c18f4585c1b956ed799c104c7c
AngleMultipleLinear
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter def normalize(x, dim, p=2, eps=1e-12): if torch.onnx.is_in_onnx_export(): return OnnxLpNormalization.apply(x, dim, p, eps) else: return F.normalize(x, dim=dim) class OnnxLpNor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sovrasov/mmaction2
AngleMultipleLinear
false
4,432
[ "Apache-2.0" ]
0
055625bf6d6e06e9f811cc4f8b0332c18cebc98c
https://github.com/sovrasov/mmaction2/tree/055625bf6d6e06e9f811cc4f8b0332c18cebc98c
VectorQuantizer
import torch from torch import nn from torch.nn import functional as F class VectorQuantizer(nn.Module): """ Reference: [1] https://github.com/deepmind/sonnet/blob/v2/sonnet/src/nets/vqvae.py """ def __init__(self, num_embeddings: 'int', embedding_dim: 'int', beta: 'float'=0.25): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
threewisemonkeys-as/PyTorch-VAE
VectorQuantizer
false
4,433
[ "Apache-2.0" ]
0
4ed0fc7581d4792b435134aa9e06d5e35a5db118
https://github.com/threewisemonkeys-as/PyTorch-VAE/tree/4ed0fc7581d4792b435134aa9e06d5e35a5db118
Critic
import torch import numpy as np import torch.nn.functional as F from torch import nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np from torch...
tjkemp/ubik-agent
Critic
false
4,434
[ "MIT" ]
0
34e4dd0d6319b8f5c5dba0cd9e087490720b723b
https://github.com/tjkemp/ubik-agent/tree/34e4dd0d6319b8f5c5dba0cd9e087490720b723b
DeepQNetwork
import torch import torch as T import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class DeepQNetwork(nn.Module): def __init__(self, ALPHA): super(DeepQNetwork, self).__init__() self.conv1 = nn.Conv2d(1, 32, 8, stride=4, padding=1) self.conv2 = nn.Conv2d(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 import torch as T import torc...
SuperSaiyan-God/Reinforcement-Learning
DeepQNetwork
false
4,435
[ "MIT" ]
0
b43a2997e28ec3bf437c37d060637f6deecf89c6
https://github.com/SuperSaiyan-God/Reinforcement-Learning/tree/b43a2997e28ec3bf437c37d060637f6deecf89c6
Model
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, inputdim): super(Model, self).__init__() self.layer1 = nn.Linear(inputdim, 16) torch.nn.init.xavier_uniform_(self.layer1.weight) self.layer2 = nn.Linear(16, 32) torch.nn.init.xavier_uniform_(self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
terry97-guel/POENet-ActiveLearning
Model
false
4,436
[ "MIT" ]
0
78e959c8c5eacc5b2dc4e3334ed609d182ce7b6c
https://github.com/terry97-guel/POENet-ActiveLearning/tree/78e959c8c5eacc5b2dc4e3334ed609d182ce7b6c
wide_basic
import torch import torch.nn as nn def get_norm(n_filters, norm): if norm is None: return Identity() elif norm == 'batch': return nn.BatchNorm2d(n_filters, momentum=0.9) elif norm == 'instance': return nn.InstanceNorm2d(n_filters, affine=True) elif norm == 'layer': retu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
tianyi21/JEM
wide_basic
false
4,437
[ "Apache-2.0" ]
0
59b4bb87be1b1643731540133df557edd7780a88
https://github.com/tianyi21/JEM/tree/59b4bb87be1b1643731540133df557edd7780a88