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
TRPO
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def flat_grad(grads): grad_flatten = [] for grad in grads: grad_flatten.append(grad.view(-1)) grad_flatten = torch.cat(grad_flatten) return grad_flatten def flat_hessian(hessians): hessians_flatten = []...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
g6ling/Pytorch-Cartpole
TRPO
false
15,388
[ "MIT" ]
116
ecb7b622cfefe825ac95388cceb6752413d90a2a
https://github.com/g6ling/Pytorch-Cartpole/tree/ecb7b622cfefe825ac95388cceb6752413d90a2a
ResNetV2
import torch import torch.nn.functional as F import torch.nn as nn from collections import OrderedDict def conv3x3(cin, cout, stride=1, groups=1, bias=False): return StdConv2d(cin, cout, kernel_size=3, stride=stride, padding=1, bias=bias, groups=groups) def conv1x1(cin, cout, stride=1, bias=False): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
RicJM/weighted_c2d
ResNetV2
false
15,389
[ "MIT" ]
49
38053869b77c1544349c53ba6f3c1325254aa413
https://github.com/RicJM/weighted_c2d/tree/38053869b77c1544349c53ba6f3c1325254aa413
Capsule
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Capsule(nn.Module): def __init__(self, cfg): super(Capsule, self).__init__() self.input_dim_capsule = cfg.input_dim_capsule self.dim_capsule = cfg.dim_capsule self.num_capsule = cfg.num_capsule ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
fmc123653/DeepKE
Capsule
false
15,390
[ "MIT" ]
676
4d30e51368681c7cb73e2ecacf9b922b441cbe99
https://github.com/fmc123653/DeepKE/tree/4d30e51368681c7cb73e2ecacf9b922b441cbe99
BalancedLoss
import torch from torch import nn import torch.nn.functional as F class BalancedLoss(nn.Module): def __init__(self, neg_weight=1.0): super(BalancedLoss, self).__init__() self.neg_weight = neg_weight def forward(self, input, target): pos_mask = target == 0 neg_mask = target ==...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
gabrielsluz/vince
BalancedLoss
false
15,391
[ "Apache-2.0" ]
61
f4e17a2cf70c080a7e01e46d15537e33224c869b
https://github.com/gabrielsluz/vince/tree/f4e17a2cf70c080a7e01e46d15537e33224c869b
GAE
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class GAE(nn.Module): def __init__(self, num_inputs, num_outputs): super(GAE, self).__init__() self.num_inputs = num_inputs self.num_outputs = num_outputs self.fc = nn.Linear(num_inputs, 128) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
g6ling/Pytorch-Cartpole
GAE
false
15,392
[ "MIT" ]
116
ecb7b622cfefe825ac95388cceb6752413d90a2a
https://github.com/g6ling/Pytorch-Cartpole/tree/ecb7b622cfefe825ac95388cceb6752413d90a2a
TemperatureHolder
import torch from torch import nn class TemperatureHolder(nn.Module): """Module that holds a temperature as a learnable value. Args: initial_log_temperature (float): Initial value of log(temperature). """ def __init__(self, initial_log_temperature=0): super().__init__() self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
g-votte/pfrl
TemperatureHolder
false
15,393
[ "MIT" ]
824
4c30c1d73f0941a2b649b62937eec346bb55a95e
https://github.com/g-votte/pfrl/tree/4c30c1d73f0941a2b649b62937eec346bb55a95e
ConvCompress
import torch from torch import nn class ConvCompress(nn.Module): def __init__(self, dim, ratio=4): super().__init__() self.conv = nn.Conv1d(dim, dim, ratio, stride=ratio) def forward(self, mem): mem = mem.transpose(1, 2) compressed_mem = self.conv(mem) return compress...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
fwka92/compressive-transformer-pytorch
ConvCompress
false
15,394
[ "MIT" ]
108
e51faba52a8c1ec6a8b966e5b912e6ecc3840f57
https://github.com/fwka92/compressive-transformer-pytorch/tree/e51faba52a8c1ec6a8b966e5b912e6ecc3840f57
ImageToTensor
import torch import numpy as np import torch.optim import torch.nn as nn import torch.nn.utils import torch.autograd class BaseMetric: """ Base class for all the metrics """ def __init__(self, name): self.name = name def calculate(self, batch_info): """ Calculate value of a metric based ...
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 numpy as np import torch.optim import torch.nn as nn import torch.nn.utils import torch.autograd assert_size_stride = torch._C._dynam...
galatolofederico/vel
ImageToTensor
false
15,395
[ "MIT" ]
273
0473648cffb3f34fb784d12dbb25844ab58ffc3c
https://github.com/galatolofederico/vel/tree/0473648cffb3f34fb784d12dbb25844ab58ffc3c
PreNormTransformerDecoderLayer
import torch import torch.nn as nn class PreNormTransformerDecoderLayer(nn.TransformerDecoderLayer): """ A variant of :class:`torch.nn.TransformerDecoderLayer` where layer normalization is included inside the residual branch, and performed before self-attention and feedforward layers. Refer docum...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
funnyzhou/REFERS
PreNormTransformerDecoderLayer
false
15,396
[ "MIT" ]
46
392eddf13cbf3c3a7dc0bf8bfffd108ca4a65a19
https://github.com/funnyzhou/REFERS/tree/392eddf13cbf3c3a7dc0bf8bfffd108ca4a65a19
CausalConv1d
import torch from torch import nn class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super(CausalConv1d, self).__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size, padding=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
gaotianyu1350/new_fewrel_bertpair
CausalConv1d
false
15,397
[ "MIT" ]
180
27184050d476fc93576948fb26680d508a2824bb
https://github.com/gaotianyu1350/new_fewrel_bertpair/tree/27184050d476fc93576948fb26680d508a2824bb
OneHotEncode
import torch import torch.optim import torch.nn as nn import torch.nn.utils import torch.autograd def one_hot_encoding(input_tensor, num_labels): """ One-hot encode labels from input """ xview = input_tensor.view(-1, 1) onehot = torch.zeros(xview.size(0), num_labels, device=input_tensor. device, 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 import torch.optim import torch.nn as nn import torch.nn.utils import torch.autograd assert_size_stride = torch._C._dynamo.guards.assert_siz...
galatolofederico/vel
OneHotEncode
false
15,399
[ "MIT" ]
273
0473648cffb3f34fb784d12dbb25844ab58ffc3c
https://github.com/galatolofederico/vel/tree/0473648cffb3f34fb784d12dbb25844ab58ffc3c
TimeBlock
import torch import torch.nn as nn import torch.nn.functional as F class TimeBlock(nn.Module): """ Neural network block that applies a temporal convolution to each node of a graph in isolation. """ def __init__(self, in_channels, out_channels, kernel_size=3): """ :param in_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
garygsw/STGCN-PyTorch
TimeBlock
false
15,400
[ "MIT" ]
220
83ae49e566c779444efd21fc03cce54a765ee9f7
https://github.com/garygsw/STGCN-PyTorch/tree/83ae49e566c779444efd21fc03cce54a765ee9f7
DenseBlock
import torch from torch import nn from torch.nn import functional as F class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super(CausalConv1d, self).__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
gaotianyu1350/new_fewrel_bertpair
DenseBlock
false
15,401
[ "MIT" ]
180
27184050d476fc93576948fb26680d508a2824bb
https://github.com/gaotianyu1350/new_fewrel_bertpair/tree/27184050d476fc93576948fb26680d508a2824bb
DiagGaussianActionHead
import torch import numpy as np import torch.optim import torch.nn as nn import torch.nn.init as init import torch.nn.utils import torch.autograd class DiagGaussianActionHead(nn.Module): """ Action head where actions are normally distibuted uncorrelated variables with specific means and variances. Means ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.optim import torch.nn as nn import torch.nn.init...
galatolofederico/vel
DiagGaussianActionHead
false
15,402
[ "MIT" ]
273
0473648cffb3f34fb784d12dbb25844ab58ffc3c
https://github.com/galatolofederico/vel/tree/0473648cffb3f34fb784d12dbb25844ab58ffc3c
DotAttention
import torch import torch.nn as nn import torch.nn.functional as F class DotAttention(nn.Module): def __init__(self, dropout=0.0): super(DotAttention, self).__init__() self.dropout = dropout def forward(self, Q, K, V, mask_out=None, head_mask=None): """ 一般输入信息 X 时,假设 K = V = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
fmc123653/DeepKE
DotAttention
false
15,403
[ "MIT" ]
676
4d30e51368681c7cb73e2ecacf9b922b441cbe99
https://github.com/fmc123653/DeepKE/tree/4d30e51368681c7cb73e2ecacf9b922b441cbe99
CosSim
import torch import torch.nn as nn class CosSim(nn.Module): def __init__(self, nfeat, nclass, codebook=None, learn_cent=True): super(CosSim, self).__init__() self.nfeat = nfeat self.nclass = nclass self.learn_cent = learn_cent if codebook is None: codebook = to...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
gajrajgchouhan/orthohash
CosSim
false
15,404
[ "BSD-3-Clause" ]
51
4e04cfe1dd32e21ba004e308d5a1ce9c8578ea2b
https://github.com/gajrajgchouhan/orthohash/tree/4e04cfe1dd32e21ba004e308d5a1ce9c8578ea2b
PrecomputedNorm
import torch import torch.nn as nn class PrecomputedNorm(nn.Module): """Normalization using Pre-computed Mean/Std. Args: stats: Precomputed (mean, std). axis: Axis setting used to calculate mean/variance. """ def __init__(self, stats, axis=[1, 2]): super().__init__() 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
gcambara/s3prl
PrecomputedNorm
false
15,405
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
PGenLayer
import torch import torch.nn as nn import torch.nn.functional as F class PGenLayer(nn.Module): def __init__(self, emb_dim, hidden_size, enc_dim): super(PGenLayer, self).__init__() self.emb_dim = emb_dim self.hidden_size = hidden_size self.enc_dim = enc_dim self.lin = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gau820827/AI-writer_Data2Doc
PGenLayer
false
15,406
[ "Apache-2.0" ]
77
6be0ee6238158a47aa0fdfa8a34df2a47714835a
https://github.com/gau820827/AI-writer_Data2Doc/tree/6be0ee6238158a47aa0fdfa8a34df2a47714835a
AMSoftmaxLoss
import torch import torch.nn as nn import torch.nn.functional as F class AMSoftmaxLoss(nn.Module): def __init__(self, hidden_dim, speaker_num, s=30.0, m=0.4, **kwargs): """ AM Softmax Loss """ super(AMSoftmaxLoss, self).__init__() self.s = s self.m = m self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gcambara/s3prl
AMSoftmaxLoss
false
15,407
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
TransformerDecoderBlock
import math import torch import torch.nn as nn class AddAndNorm(nn.Module): def __init__(self, d_model): super(AddAndNorm, self).__init__() self.layer_norm = nn.LayerNorm(d_model) def forward(self, x, residual): return self.layer_norm(x + residual) class ScaledDotProductAttention(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....
francismontalbo/attention-is-all-you-need-paper
TransformerDecoderBlock
false
15,408
[ "MIT" ]
167
21ba3e48917da0c6808126d183bece6a9969cfd2
https://github.com/francismontalbo/attention-is-all-you-need-paper/tree/21ba3e48917da0c6808126d183bece6a9969cfd2
TransformerEncoderBlock
import math import torch import torch.nn as nn class AddAndNorm(nn.Module): def __init__(self, d_model): super(AddAndNorm, self).__init__() self.layer_norm = nn.LayerNorm(d_model) def forward(self, x, residual): return self.layer_norm(x + residual) class ScaledDotProductAttention(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....
francismontalbo/attention-is-all-you-need-paper
TransformerEncoderBlock
false
15,409
[ "MIT" ]
167
21ba3e48917da0c6808126d183bece6a9969cfd2
https://github.com/francismontalbo/attention-is-all-you-need-paper/tree/21ba3e48917da0c6808126d183bece6a9969cfd2
Attn
import torch import torch.nn as nn import torch.nn.functional as F class Attn(nn.Module): """ The score function for the attention mechanism. We define the score function as the general function from Luong et al. Where score(s_{i}, h_{j}) = s_{i} * W * h_{j} """ def __init__(self, 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....
gau820827/AI-writer_Data2Doc
Attn
false
15,410
[ "Apache-2.0" ]
77
6be0ee6238158a47aa0fdfa8a34df2a47714835a
https://github.com/gau820827/AI-writer_Data2Doc/tree/6be0ee6238158a47aa0fdfa8a34df2a47714835a
AP
import torch import torch.nn as nn class AttentivePooling(nn.Module): """ Implementation of Attentive Pooling """ def __init__(self, input_dim, **kwargs): super(AttentivePooling, self).__init__() self.W_a = nn.Linear(input_dim, input_dim) self.W = nn.Linear(input_dim, 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....
gcambara/s3prl
AP
false
15,411
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
AttentivePoolingModule
import torch import torch.nn as nn class AttentivePoolingModule(nn.Module): """ Implementation of Attentive Pooling """ def __init__(self, input_dim, activation='ReLU', **kwargs): super(AttentivePoolingModule, self).__init__() self.W_a = nn.Linear(input_dim, input_dim) self.W...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gcambara/s3prl
AttentivePoolingModule
false
15,412
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
ASP
import torch import torch.nn as nn class AttentivePooling(nn.Module): """ Implementation of Attentive Pooling """ def __init__(self, input_dim, **kwargs): super(AttentivePooling, self).__init__() self.W_a = nn.Linear(input_dim, input_dim) self.W = nn.Linear(input_dim, 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....
gcambara/s3prl
ASP
false
15,413
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
RegLoss
import torch import torch.nn as nn class RegLoss(nn.Module): """ RegLoss, L2 regularization on model parameters """ def __init__(self): super(RegLoss, self).__init__() def forward(self, parameters): reg_loss = None for W in parameters: if reg_loss is None: ...
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_...
geekinglcq/HRec
RegLoss
false
15,414
[ "MIT" ]
49
b3a67f7721e6e73a7af37d308b5b00e9df68d495
https://github.com/geekinglcq/HRec/tree/b3a67f7721e6e73a7af37d308b5b00e9df68d495
SelfAttentionPooling
import torch import torch.nn as nn class SelfAttentionPooling(nn.Module): """ Implementation of SelfAttentionPooling Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition https://arxiv.org/pdf/2008.01077v1.pdf """ def __init__(self, input_dim): super(SelfAttentio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gcambara/s3prl
SelfAttentionPooling
false
15,415
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
SoftmaxLoss
import torch import torch.nn as nn class SoftmaxLoss(nn.Module): def __init__(self, hidden_dim, speaker_num, **kwargs): """ Softmax Loss """ super(SoftmaxLoss, self).__init__() self.fc = nn.Linear(hidden_dim, speaker_num) self.loss = nn.CrossEntropyLoss() def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gcambara/s3prl
SoftmaxLoss
false
15,416
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
MLP
from torch.nn import Module import torch import torch.nn as nn from torch.nn.modules.module import Module class MLP(Module): """ A Simple two layers MLP to make SGC a bit better. """ def __init__(self, nfeat, nhid, nclass, dp=0.2): super(MLP, self).__init__() self.W1 = nn.Linear(nfeat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 torch.nn as nn from torch.nn.modules.module i...
gear/gfnn
MLP
false
15,417
[ "MIT" ]
46
36667861caacba921469d43917d002896e832c3f
https://github.com/gear/gfnn/tree/36667861caacba921469d43917d002896e832c3f
KGCN
from torch.nn import Module import math import torch import torch.nn.functional as F import torch.nn as nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer """ def __init__(self, in_features, out_features, bias=Tr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
gear/gfnn
KGCN
false
15,418
[ "MIT" ]
46
36667861caacba921469d43917d002896e832c3f
https://github.com/gear/gfnn/tree/36667861caacba921469d43917d002896e832c3f
L2NormLoss
import torch import torch.utils.data import torch.nn as nn class L2NormLoss(nn.Module): def __init__(self): super(L2NormLoss, self).__init__() def forward(self, x1, x2, y1, y2): dist_in = torch.norm(x1 - x2, dim=1, keepdim=True) dist_out = torch.norm(y1 - y2, dim=1, keepdim=True) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dy...
gfiumara/MSU-LatentAFIS
L2NormLoss
false
15,419
[ "MIT" ]
53
682464b0bc4501977f1304c51e2638c0ee89d87c
https://github.com/gfiumara/MSU-LatentAFIS/tree/682464b0bc4501977f1304c51e2638c0ee89d87c
AttLayer
import torch import torch.nn as nn import torch.nn.functional as fn class AttLayer(nn.Module): """Calculate the attention signal(weight) according the input tensor. Args: infeatures (torch.FloatTensor): A 3D input tensor with shape of[batch_size, M, embed_dim]. Returns: torch.FloatTensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
geekinglcq/HRec
AttLayer
false
15,420
[ "MIT" ]
49
b3a67f7721e6e73a7af37d308b5b00e9df68d495
https://github.com/geekinglcq/HRec/tree/b3a67f7721e6e73a7af37d308b5b00e9df68d495
VisErrorLossV2
import torch import torch.nn.functional as F from torch import nn class VisErrorLossV2(nn.Module): def __init__(self): super(VisErrorLossV2, self).__init__() def compute_l1_weighted_loss(self, hm_targets, hm_preds, vismap, ohem=1.0): """ :param hm_targets: [batch size, keypoint numbe...
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.functi...
gathierry/FashionAI-KeyPointsDetectionOfApparel
VisErrorLossV2
false
15,421
[ "Apache-2.0" ]
174
2e0942b42b4a9cd974cdddc151675738dc8a8cb4
https://github.com/gathierry/FashionAI-KeyPointsDetectionOfApparel/tree/2e0942b42b4a9cd974cdddc151675738dc8a8cb4
RobertaOutput
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.utils.checkpoint class RobertaOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(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.triton_helpers import libdevice from torch import n...
IntelLabs/Model-Compression-Research-Package
RobertaOutput
false
15,422
[ "Apache-2.0" ]
58
69aecbf5cc73b10fab88a13d8ca6d8314d284c0b
https://github.com/IntelLabs/Model-Compression-Research-Package/tree/69aecbf5cc73b10fab88a13d8ca6d8314d284c0b
Net
import torch import torch.nn as nn class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1_1 = nn.Conv2d(1, 8, 5, 2, 0) self.conv2_1 = nn.Conv2d(8, 16, 3, 1, 0) self.conv2_2 = nn.Conv2d(16, 16, 3, 1, 0) self.conv3_1 = nn.Conv2d(16, 24, 3, 1, 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...
fengjixuchui/EmbeddedSystem
Net
false
15,423
[ "MIT" ]
228
ae17e41bb120922a99f2d91818c381e38e868040
https://github.com/fengjixuchui/EmbeddedSystem/tree/ae17e41bb120922a99f2d91818c381e38e868040
Delta
import torch import torch.nn as nn from torchaudio import transforms class Delta(nn.Module): def __init__(self, order=2, **kwargs): super(Delta, self).__init__() self.order = order self.compute_delta = transforms.ComputeDeltas(**kwargs) def forward(self, x): feats = [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 from torchaudio import transforms assert_size_stride = tor...
gcambara/s3prl
Delta
false
15,424
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
Glu
import torch import torch.nn as nn class Glu(nn.Module): def __init__(self, dim): super(Glu, self).__init__() self.dim = dim def forward(self, x): x_in, x_gate = x.chunk(2, dim=self.dim) return x_in * x_gate.sigmoid() def get_inputs(): return [torch.rand([4, 4, 4, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
gheyret/EfficientConformer
Glu
false
15,425
[ "Apache-2.0" ]
101
b28a0aaa3b182f72abaccbeb12df0402adf96097
https://github.com/gheyret/EfficientConformer/tree/b28a0aaa3b182f72abaccbeb12df0402adf96097
VisErrorLoss
import torch import torch.nn.functional as F from torch import nn class VisErrorLoss(nn.Module): def __init__(self): super(VisErrorLoss, self).__init__() def compute_l1_weighted_loss(self, hm_targets, hm_preds, vismap, ohem=1.0): """ :param hm_targets: [batch size, keypoint number, h...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functi...
gathierry/FashionAI-KeyPointsDetectionOfApparel
VisErrorLoss
false
15,426
[ "Apache-2.0" ]
174
2e0942b42b4a9cd974cdddc151675738dc8a8cb4
https://github.com/gathierry/FashionAI-KeyPointsDetectionOfApparel/tree/2e0942b42b4a9cd974cdddc151675738dc8a8cb4
GroupedMultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F class Linear(nn.Linear): def __init__(self, in_features, out_features, bias=True): super(Linear, self).__init__(in_features=in_features, out_features= out_features, bias=bias) self.noise = None self.vn_std = No...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
gheyret/EfficientConformer
GroupedMultiHeadAttention
false
15,427
[ "Apache-2.0" ]
101
b28a0aaa3b182f72abaccbeb12df0402adf96097
https://github.com/gheyret/EfficientConformer/tree/b28a0aaa3b182f72abaccbeb12df0402adf96097
RelativeThreshold_RegLoss
import torch import torch.nn as nn import torch.nn.init class RelativeThreshold_RegLoss(nn.Module): def __init__(self, threshold, size_average=True): super(RelativeThreshold_RegLoss, self).__init__() self.size_average = size_average self.eps = 1e-07 self.threshold = threshold ...
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 import torch.nn.init assert_size_stride = torch._C....
ginobilinie/medSynthesisV1
RelativeThreshold_RegLoss
false
15,428
[ "MIT" ]
166
1fd202c5928466ef9b11cfebc4490341899312e7
https://github.com/ginobilinie/medSynthesisV1/tree/1fd202c5928466ef9b11cfebc4490341899312e7
Conv1d
import torch import torch.nn as nn import torch.nn.functional as F class Conv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding='same', dilation=1, groups=1, bias=True): super(Conv1d, self).__init__(in_channels=in_channels, out_channels= out_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gheyret/EfficientConformer
Conv1d
false
15,429
[ "Apache-2.0" ]
101
b28a0aaa3b182f72abaccbeb12df0402adf96097
https://github.com/gheyret/EfficientConformer/tree/b28a0aaa3b182f72abaccbeb12df0402adf96097
GCN
import torch import torch.nn.functional as F from torch import nn import torch.nn.parallel class Conv2D(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', stride=1, dilation=1, groups=1): super(Conv2D, self).__init__() assert type(kernel_size) in [int,...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import nn import torch.nn.parallel as...
gist-ailab/uoais
GCN
false
15,430
[ "BSD-2-Clause" ]
52
fb42d9a96cd54daad61c956d8d9d65dd0ebef4c7
https://github.com/gist-ailab/uoais/tree/fb42d9a96cd54daad61c956d8d9d65dd0ebef4c7
maxPool23DUinit
import torch import torch.nn as nn import torch.nn.init class maxPool23DUinit(nn.Module): def __init__(self, kernel_size, stride, padding=1, dilation=1, nd=2): super(maxPool23DUinit, self).__init__() assert nd == 1 or nd == 2 or nd == 3, 'nd is not correctly specified!!!!, it should be {1,2,3}' ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo.guards.a...
ginobilinie/medSynthesisV1
maxPool23DUinit
false
15,431
[ "MIT" ]
166
1fd202c5928466ef9b11cfebc4490341899312e7
https://github.com/ginobilinie/medSynthesisV1/tree/1fd202c5928466ef9b11cfebc4490341899312e7
residualUnit
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init import torch.nn.init class conv23DUnit(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, groups=1, bias=True, dilation=1, nd=2): super(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....
ginobilinie/medSynthesisV1
residualUnit
false
15,432
[ "MIT" ]
166
1fd202c5928466ef9b11cfebc4490341899312e7
https://github.com/ginobilinie/medSynthesisV1/tree/1fd202c5928466ef9b11cfebc4490341899312e7
PACRRConvMax2dModule
import torch class PACRRConvMax2dModule(torch.nn.Module): def __init__(self, shape, n_filters, k, channels): super().__init__() self.shape = shape if shape != 1: self.pad = torch.nn.ConstantPad2d((0, shape - 1, 0, shape - 1), 0) else: self.pad = 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 assert_size_stride = torch._C...
gitter-badger/FlexNeuART
PACRRConvMax2dModule
false
15,433
[ "Apache-2.0" ]
101
f69e5421bdebe9db0d993b5470dace61872f90df
https://github.com/gitter-badger/FlexNeuART/tree/f69e5421bdebe9db0d993b5470dace61872f90df
VisErrorLossV3
import torch import torch.nn.functional as F from torch import nn class VisErrorLossV3(nn.Module): def __init__(self): super(VisErrorLossV3, self).__init__() def compute_l1_weighted_loss(self, hm_targets, hm_preds, vismap, ohem=1.0): """ :param hm_targets: [batch size, keypoint numbe...
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.functi...
gathierry/FashionAI-KeyPointsDetectionOfApparel
VisErrorLossV3
false
15,434
[ "Apache-2.0" ]
174
2e0942b42b4a9cd974cdddc151675738dc8a8cb4
https://github.com/gathierry/FashionAI-KeyPointsDetectionOfApparel/tree/2e0942b42b4a9cd974cdddc151675738dc8a8cb4
ClusterAssignment
import torch import torch.nn as nn from torch.nn import Parameter from typing import Optional class ClusterAssignment(nn.Module): def __init__(self, cluster_number: 'int', embedding_dimension: 'int', alpha: 'float'=1.0, cluster_centers: 'Optional[torch.Tensor]'=None ) ->None: """ ...
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.nn import Parameter from typing import Optional assert_size_stride = torch._C._dynamo.guards.assert_size_st...
giorgosVardakas/pt-dec
ClusterAssignment
false
15,435
[ "MIT" ]
200
c29b9634eb74c828efd9d2b87c613cdb0ddd1dd5
https://github.com/giorgosVardakas/pt-dec/tree/c29b9634eb74c828efd9d2b87c613cdb0ddd1dd5
SqueezeAndExcitationModule
import torch import torch.nn as nn import torch.nn.functional as F class Swish(nn.Module): def __init__(self): super(Swish, self).__init__() def forward(self, x): return x * x.sigmoid() class Conv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
gheyret/EfficientConformer
SqueezeAndExcitationModule
false
15,436
[ "Apache-2.0" ]
101
b28a0aaa3b182f72abaccbeb12df0402adf96097
https://github.com/gheyret/EfficientConformer/tree/b28a0aaa3b182f72abaccbeb12df0402adf96097
_Extraction
import torch from torch import Tensor import torch.onnx.operators def create_max_segment_mask(tensor: 'Tensor', max_segment_length): """ Create max-segment mask. Args: tensor: :math: (N, T, *) where T is target dimension Returns: - max-segment mask: :math:`(N,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import Tensor imp...
godweiyang/ParaGen
_Extraction
false
15,437
[ "Apache-2.0" ]
50
9665d1244ea38a41fc06b4e0a7f6411985e2221f
https://github.com/godweiyang/ParaGen/tree/9665d1244ea38a41fc06b4e0a7f6411985e2221f
MultiHeadLinearAttention
import torch import torch.nn as nn import torch.nn.functional as F class Linear(nn.Linear): def __init__(self, in_features, out_features, bias=True): super(Linear, self).__init__(in_features=in_features, out_features= out_features, bias=bias) self.noise = None self.vn_std = No...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gheyret/EfficientConformer
MultiHeadLinearAttention
false
15,438
[ "Apache-2.0" ]
101
b28a0aaa3b182f72abaccbeb12df0402adf96097
https://github.com/gheyret/EfficientConformer/tree/b28a0aaa3b182f72abaccbeb12df0402adf96097
PowerLaw_Compressed_Loss
import torch import torch.nn as nn import torch.utils.data class PowerLaw_Compressed_Loss(nn.Module): def __init__(self, power=0.3, complex_loss_ratio=0.113): super(PowerLaw_Compressed_Loss, self).__init__() self.power = power self.complex_loss_ratio = complex_loss_ratio self.crit...
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...
giuliacassara/VoiceSplit
PowerLaw_Compressed_Loss
false
15,439
[ "Apache-2.0" ]
84
1aa98dce9460db7ec6c5449eb7f92e3902f71a2a
https://github.com/giuliacassara/VoiceSplit/tree/1aa98dce9460db7ec6c5449eb7f92e3902f71a2a
AUXModule
import torch import torch.nn as nn import torch.nn.functional as F class AUXModule(nn.Module): def __init__(self, in_features, out_features): super().__init__() self.linear = nn.Linear(in_features, out_features) def forward(self, x): x = F.adaptive_max_pool2d(x, output_size=(1, 1)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gorogoroyasu/mlcomp
AUXModule
false
15,440
[ "Apache-2.0" ]
166
fc6572ca5b226b35df97f13badd4420b30468a3b
https://github.com/gorogoroyasu/mlcomp/tree/fc6572ca5b226b35df97f13badd4420b30468a3b
HuggingfaceClassifier
import torch import torch.nn.functional as F import torch.nn as nn import torch.onnx.operators def get_activation_fn(activation): """ Get activation function by name Args: activation: activation function name Returns: - activation function """ if activation == '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 import torch.nn.functional as...
godweiyang/ParaGen
HuggingfaceClassifier
false
15,441
[ "Apache-2.0" ]
50
9665d1244ea38a41fc06b4e0a7f6411985e2221f
https://github.com/godweiyang/ParaGen/tree/9665d1244ea38a41fc06b4e0a7f6411985e2221f
SimpleTextClassifier
import torch import torch.nn as nn import torch.nn.functional as F class SimpleTextClassifier(nn.Module): """Text Classifier with 1 hidden layer """ def __init__(self, num_labels, vocab_size): super(SimpleTextClassifier, self).__init__() self.linear1 = nn.Linear(vocab_size, 128) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
goodmike31/pytorch_active_learning
SimpleTextClassifier
false
15,442
[ "MIT" ]
629
1224efad1f8022efa933cd36e30f78ed06eaaea7
https://github.com/goodmike31/pytorch_active_learning/tree/1224efad1f8022efa933cd36e30f78ed06eaaea7
LocalMultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F class Linear(nn.Linear): def __init__(self, in_features, out_features, bias=True): super(Linear, self).__init__(in_features=in_features, out_features= out_features, bias=bias) self.noise = None self.vn_std = No...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gheyret/EfficientConformer
LocalMultiHeadAttention
false
15,443
[ "Apache-2.0" ]
101
b28a0aaa3b182f72abaccbeb12df0402adf96097
https://github.com/gheyret/EfficientConformer/tree/b28a0aaa3b182f72abaccbeb12df0402adf96097
NormedMSE
import torch import torch.nn as nn import torch.utils.data class NormedMSE(nn.MSELoss): def forward(self, inp, tgt, *args, **kwargs): """ Args: inp: (*, C) tgt: (*, C) Will normalize the input before the loss """ inp = nn.functional.normalize(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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
gongda0e/AVT
NormedMSE
false
15,444
[ "Apache-2.0" ]
102
d6a7032b86416e852c76cc04a20ccabe34f111dc
https://github.com/gongda0e/AVT/tree/d6a7032b86416e852c76cc04a20ccabe34f111dc
output
import math import torch import torch.nn as nn class output(nn.Module): def __init__(self, scope=512): super(output, self).__init__() self.conv1 = nn.Conv2d(32, 1, 1) self.sigmoid1 = nn.Sigmoid() self.conv2 = nn.Conv2d(32, 4, 1) self.sigmoid2 = nn.Sigmoid() self.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
glc12125/EAST
output
false
15,445
[ "MIT" ]
366
cec7ae98f9c21a475b935f74f4c3969f3a989bd4
https://github.com/glc12125/EAST/tree/cec7ae98f9c21a475b935f74f4c3969f3a989bd4
VirtualBatchNorm
import torch from torch import nn class VirtualBatchNorm(nn.Module): """ Applies Virtual Batch Normalization over a 4D input (a mini-batch of 2D inputs with additional channel dimension) as described in paper `Improved Techniques for Training GANs`: https://arxiv.org/abs/1606.03498 .. math:: ...
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...
goktug97/estorch
VirtualBatchNorm
false
15,446
[ "MIT" ]
53
aa7318b0662faadece1ac9eb241b895d028d613d
https://github.com/goktug97/estorch/tree/aa7318b0662faadece1ac9eb241b895d028d613d
SimmatModule
import torch class SimmatModule(torch.nn.Module): def __init__(self, padding=-1): super().__init__() self.padding = padding self._hamming_index_loaded = None self._hamming_index = None def forward(self, query_embed, doc_embed, query_tok, doc_tok): simmat = [] ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
gitter-badger/FlexNeuART
SimmatModule
false
15,447
[ "Apache-2.0" ]
101
f69e5421bdebe9db0d993b5470dace61872f90df
https://github.com/gitter-badger/FlexNeuART/tree/f69e5421bdebe9db0d993b5470dace61872f90df
NaiveGroupNorm
from torch.nn import Module import torch from torch.nn import Parameter from torch.nn import init import torch.nn.parallel class NaiveGroupNorm(Module): """NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch. It is a temporary solution to export GN by ONNX before the...
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.nn import Module from torch.nn import Parameter from torch.nn import...
gist-ailab/uoais
NaiveGroupNorm
false
15,448
[ "BSD-2-Clause" ]
52
fb42d9a96cd54daad61c956d8d9d65dd0ebef4c7
https://github.com/gist-ailab/uoais/tree/fb42d9a96cd54daad61c956d8d9d65dd0ebef4c7
FocalLoss
import torch import torch.nn as nn class FocalLoss(nn.Module): """ Softmax and sigmoid focal loss. copy from https://github.com/lonePatient/TorchBlocks """ def __init__(self, num_labels, activation_type='softmax', gamma=2.0, alpha=0.25, epsilon=1e-09): super(FocalLoss, self).__ini...
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 ...
gitabtion/BertBasedCscModels
FocalLoss
false
15,449
[ "Apache-2.0" ]
158
1daf505d109c5922eeedb6674edbb1b73db21e45
https://github.com/gitabtion/BertBasedCscModels/tree/1daf505d109c5922eeedb6674edbb1b73db21e45
LinearClassifier
import logging import random import torch import torch.nn.functional as F import torch.nn as nn from typing import List import torch.onnx.operators from functools import wraps def singleton(cls): """ Singleton decorator Args: cls: singleton class Returns: - an instance of a singleton...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
godweiyang/ParaGen
LinearClassifier
false
15,450
[ "Apache-2.0" ]
50
9665d1244ea38a41fc06b4e0a7f6411985e2221f
https://github.com/godweiyang/ParaGen/tree/9665d1244ea38a41fc06b4e0a7f6411985e2221f
ResidualConvUnit
import torch from torch import nn class ResidualConvUnit(nn.Module): """Residual convolution module. """ def __init__(self, features): """Init. Args: features (int): number of features """ super().__init__() self.conv1 = nn.Conv2d(features, features, 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...
google/dynamic-video-depth
ResidualConvUnit
false
15,451
[ "Apache-2.0" ]
144
7dab8f9e156fa35735301695ea020aee7221fb31
https://github.com/google/dynamic-video-depth/tree/7dab8f9e156fa35735301695ea020aee7221fb31
DownsampleB
import torch import torch.nn from torch import nn class DownsampleB(nn.Module): def __init__(self, nIn, nOut, stride): super(DownsampleB, self).__init__() self.avg = nn.AvgPool2d(stride) self.expand_ratio = nOut // nIn def forward(self, x): x = self.avg(x) return torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.g...
gpleiss/aum
DownsampleB
false
15,452
[ "MIT" ]
45
3c710662d74cdad9b299f541170070c0cb292042
https://github.com/gpleiss/aum/tree/3c710662d74cdad9b299f541170070c0cb292042
Conv2dBlock
import torch from torch import nn class Conv2dBlock(nn.Module): def __init__(self, input_dim, output_dim, kernel_size, stride, padding= 0, dilation=1, norm='weight', activation='relu', pad_type='zero', use_bias=True, *args, **karg): super(Conv2dBlock, self).__init__() self.conv = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
google/dynamic-video-depth
Conv2dBlock
false
15,453
[ "Apache-2.0" ]
144
7dab8f9e156fa35735301695ea020aee7221fb31
https://github.com/google/dynamic-video-depth/tree/7dab8f9e156fa35735301695ea020aee7221fb31
CenterIntersection
import torch import torch.nn as nn import torch.nn.functional as F class CenterIntersection(nn.Module): def __init__(self, dim): super(CenterIntersection, self).__init__() self.dim = dim self.layers = nn.Parameter(torch.zeros(self.dim * 2 + 2, self.dim)) nn.init.xavier_uniform_(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....
google-research/smore
CenterIntersection
false
15,454
[ "Apache-2.0" ]
78
e4ba95a7466ef7d018987bce7688b77bf2ea7e4f
https://github.com/google-research/smore/tree/e4ba95a7466ef7d018987bce7688b77bf2ea7e4f
ConvLayer
import torch class ConvLayer(torch.nn.Module): """ A small wrapper around nn.Conv2d, so as to make the code cleaner and allow for experimentation with padding """ def __init__(self, in_channels, out_channels, kernel_size, stride): super().__init__() self.conv2d = torch.nn.Conv2d(i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_s...
gordicaleksa/pytorch-nst-feedforward
ConvLayer
false
15,455
[ "MIT" ]
50
00c96e8e3f1b0b7fb4c14254fd0c6f1281a29598
https://github.com/gordicaleksa/pytorch-nst-feedforward/tree/00c96e8e3f1b0b7fb4c14254fd0c6f1281a29598
RingLoss
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.loss import CrossEntropyLoss class RingLoss(nn.Module): def __init__(self, type='auto', loss_weight=1.0, softmax_loss_weight=1.0): """ :param type: type of loss ('l1',...
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...
gorogoroyasu/mlcomp
RingLoss
false
15,456
[ "Apache-2.0" ]
166
fc6572ca5b226b35df97f13badd4420b30468a3b
https://github.com/gorogoroyasu/mlcomp/tree/fc6572ca5b226b35df97f13badd4420b30468a3b
ClipL1
import torch import torch.nn as nn class ClipL1(nn.Module): """ Clip L1 loss From: https://github.com/HolmesShuan/AIM2020-Real-Super-Resolution/ ClipL1 Loss combines Clip function and L1 loss. self.clip_min sets the gradients of well-trained pixels to zeros and clip_max works as a noise filter. da...
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 ...
grofit/traiNNer
ClipL1
false
15,457
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
CharbonnierLoss
import torch import torch.nn as nn def get_outnorm(x: 'torch.Tensor', out_norm: 'str'='') ->torch.Tensor: """ Common function to get a loss normalization value. Can normalize by either the batch size ('b'), the number of channels ('c'), the image size ('i') or combinations ('bi', 'bci', et...
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...
grofit/traiNNer
CharbonnierLoss
false
15,458
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
GramMatrix
import torch import torch.nn as nn def get_outnorm(x: 'torch.Tensor', out_norm: 'str'='') ->torch.Tensor: """ Common function to get a loss normalization value. Can normalize by either the batch size ('b'), the number of channels ('c'), the image size ('i') or combinations ('bi', 'bci', et...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
grofit/traiNNer
GramMatrix
false
15,459
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
BoxOffsetIntersection
import torch import torch.nn as nn import torch.nn.functional as F class BoxOffsetIntersection(nn.Module): def __init__(self, dim): super(BoxOffsetIntersection, self).__init__() self.dim = dim self.layers = nn.Parameter(torch.zeros(self.dim * 2 + 2, self.dim)) nn.init.xavier_unifo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
google-research/smore
BoxOffsetIntersection
false
15,460
[ "Apache-2.0" ]
78
e4ba95a7466ef7d018987bce7688b77bf2ea7e4f
https://github.com/google-research/smore/tree/e4ba95a7466ef7d018987bce7688b77bf2ea7e4f
AttentionBranch
import torch import torch.nn as nn class AttentionBranch(nn.Module): """Attention Branch.""" def __init__(self, nf, k_size=3): super(AttentionBranch, self).__init__() self.k1 = nn.Conv2d(nf, nf, kernel_size=k_size, padding=(k_size - 1 ) // 2, bias=False) self.lrelu = nn.Le...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
grofit/traiNNer
AttentionBranch
false
15,461
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
VisErrorLossV13
import torch import torch.nn.functional as F from torch import nn class VisErrorLossV13(nn.Module): def __init__(self): super(VisErrorLossV13, self).__init__() def compute_l1_weighted_loss(self, hm_targets, hm_preds, vismap, ohem=1.0): """ :param hm_targets: [batch size, keypoint num...
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.functi...
gathierry/FashionAI-KeyPointsDetectionOfApparel
VisErrorLossV13
false
15,462
[ "Apache-2.0" ]
174
2e0942b42b4a9cd974cdddc151675738dc8a8cb4
https://github.com/gathierry/FashionAI-KeyPointsDetectionOfApparel/tree/2e0942b42b4a9cd974cdddc151675738dc8a8cb4
DistmultCenterSet
import torch import torch.nn as nn import torch.nn.functional as F class DistmultCenterSet(nn.Module): def __init__(self, dim, aggr=torch.max, nonlinear=True): super(DistmultCenterSet, self).__init__() self.dim = dim self.layers = nn.Parameter(torch.zeros(self.dim * 4 + 4, self.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_...
google-research/smore
DistmultCenterSet
false
15,463
[ "Apache-2.0" ]
78
e4ba95a7466ef7d018987bce7688b77bf2ea7e4f
https://github.com/google-research/smore/tree/e4ba95a7466ef7d018987bce7688b77bf2ea7e4f
AngleSimpleLinear
import torch import torch.nn.functional as F import torch.nn as nn from torch.nn import Parameter class AngleSimpleLinear(nn.Module): """Computes cos of angles between input vectors and weights vectors""" def __init__(self, in_features, out_features): super(AngleSimpleLinear, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
grib0ed0v/face_recognition.pytorch
AngleSimpleLinear
false
15,464
[ "Apache-2.0" ]
158
05cb9b30e8220445fcb27988926d88f330091c12
https://github.com/grib0ed0v/face_recognition.pytorch/tree/05cb9b30e8220445fcb27988926d88f330091c12
ConvBlock
import torch class ConvBlock(torch.nn.Module): def __init__(self, input_size, output_size, kernel_size, stride, padding, bias=True): super(ConvBlock, self).__init__() self.conv = torch.nn.Conv2d(input_size, output_size, kernel_size, stride, padding, bias=bias) self.act...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
grofit/traiNNer
ConvBlock
false
15,465
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
CenterLoss
import torch import torch.nn.functional as F import torch.nn as nn class CenterLoss(nn.Module): """Implements the Center loss from https://ydwen.github.io/papers/WenECCV16.pdf""" def __init__(self, num_classes, embed_size, cos_dist=True): super().__init__() self.cos_dist = cos_dist 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
grib0ed0v/face_recognition.pytorch
CenterLoss
false
15,466
[ "Apache-2.0" ]
158
05cb9b30e8220445fcb27988926d88f330091c12
https://github.com/grib0ed0v/face_recognition.pytorch/tree/05cb9b30e8220445fcb27988926d88f330091c12
L1CosineSim
import torch import torch.nn as nn class L1CosineSim(nn.Module): """ L1 loss with Cosine similarity. Can be used to replace L1 pixel loss, but includes a cosine similarity term to ensure color correctness of the RGB vectors of each pixel. lambda is a constant factor that adjusts the contribution of th...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
grofit/traiNNer
L1CosineSim
false
15,467
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
PA
import torch import torch.nn as nn class PA(nn.Module): """PA is pixel attention""" def __init__(self, nf): super(PA, self).__init__() self.conv = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() def forward(self, x): y = self.conv(x) y = self.sigmoid(y) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
grofit/traiNNer
PA
false
15,468
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
PACnv
import torch import torch.nn as nn class PACnv(nn.Module): def __init__(self, nf, k_size=3): super(PACnv, self).__init__() self.k2 = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() self.k3 = nn.Conv2d(nf, nf, kernel_size=k_size, padding=(k_size - 1 ) // 2, bias=False)...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
grofit/traiNNer
PACnv
false
15,469
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
FrobeniusNormLoss
import torch import torch.nn as nn def get_outnorm(x: 'torch.Tensor', out_norm: 'str'='') ->torch.Tensor: """ Common function to get a loss normalization value. Can normalize by either the batch size ('b'), the number of channels ('c'), the image size ('i') or combinations ('bi', 'bci', et...
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...
grofit/traiNNer
FrobeniusNormLoss
false
15,470
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
PAM_Module
from torch.nn import Module import torch from math import sqrt as sqrt from itertools import product as product from torch.nn import Conv2d from torch.nn import Parameter from torch.nn import Softmax from torch.nn.modules.module import Module class PAM_Module(Module): """ Position attention module""" def __i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gpdsec/HSD
PAM_Module
false
15,471
[ "MIT" ]
58
8abcf78db5f313266a3bb3f85b9424927fe59a2d
https://github.com/gpdsec/HSD/tree/8abcf78db5f313266a3bb3f85b9424927fe59a2d
OFLoss
import torch import torch.nn as nn def get_outnorm(x: 'torch.Tensor', out_norm: 'str'='') ->torch.Tensor: """ Common function to get a loss normalization value. Can normalize by either the batch size ('b'), the number of channels ('c'), the image size ('i') or combinations ('bi', 'bci', et...
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 ...
grofit/traiNNer
OFLoss
false
15,472
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
Deconvolution
import torch import torch.nn as nn import torch.utils.model_zoo class Deconvolution(nn.Module): def __init__(self, C, stride): super(Deconvolution, self).__init__() if stride == 2: kernel_size = 3 output_padding = 1 elif stride == 4: kernel_size = 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 import torch.nn as nn import torch.utils.model_zoo assert_size_stride = torch._C...
guoyongcs/HNAS
Deconvolution
false
15,473
[ "MIT" ]
60
2b34e1b637bb03d23ca6559c1b5d1245d9744348
https://github.com/guoyongcs/HNAS/tree/2b34e1b637bb03d23ca6559c1b5d1245d9744348
RelativeL1
import torch import torch.nn as nn class RelativeL1(nn.Module): """ Relative L1 loss. Comparing to the regular L1, introducing the division by |c|+epsilon better models the human vision system’s sensitivity to variations in the dark areas. (where epsilon = 0.01, to prevent values of 0 in the denom...
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 ...
grofit/traiNNer
RelativeL1
false
15,474
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
ConvUpSample
import torch import torch.nn as nn class ConvUpSample(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, scale_factor=2, mode='nearest'): super(ConvUpSample, self).__init__() self.upsample = nn.Upsample(scale_factor=scale_factor, mode=mode) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
hadonga/PMF_MOD
ConvUpSample
false
15,475
[ "MIT" ]
65
1875be9bd019a7e8a121d92831fa3cbd557e2ca1
https://github.com/hadonga/PMF_MOD/tree/1875be9bd019a7e8a121d92831fa3cbd557e2ca1
TestUpsampleNearest2d
import torch import torch.nn as nn import torch.nn.functional as F class TestUpsampleNearest2d(nn.Module): """Module for UpsampleNearest2d conversion testing """ def __init__(self, inp=10, out=16, kernel_size=3, bias=True): super(TestUpsampleNearest2d, self).__init__() self.conv2d = nn.Co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gqgs/pytorch2keras
TestUpsampleNearest2d
false
15,476
[ "MIT" ]
733
9cd26e9e6698e1f07e455dbb94c15ecff53fb788
https://github.com/gqgs/pytorch2keras/tree/9cd26e9e6698e1f07e455dbb94c15ecff53fb788
Swish
import torch import torch.nn as nn def swish_func(x, beta=1.0, inplace=False): """ "Swish: a Self-Gated Activation Function" Searching for Activation Functions (https://arxiv.org/abs/1710.05941) If beta=1 applies the Sigmoid Linear Unit (SiLU) function element-wise If beta=0, Swish becomes the sc...
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...
grofit/traiNNer
Swish
false
15,477
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
Linear
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo class Linear(nn.Module): def __init__(self, stride): super(Linear, self).__init__() self.scale = stride def forward(self, x): return F.interpolate(x, scale_factor=self.scale, mode='linear'...
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.model_zoo assert_size_stride = torch._C._dynamo....
guoyongcs/HNAS
Linear
false
15,478
[ "MIT" ]
60
2b34e1b637bb03d23ca6559c1b5d1245d9744348
https://github.com/guoyongcs/HNAS/tree/2b34e1b637bb03d23ca6559c1b5d1245d9744348
UpscaleBlock
import torch import torch.nn as nn class UpscaleBlock(nn.Module): """ Upscaling Block using Pixel Shuffle to increase image dimensions. Used in Generator Network""" """ Pixel shuffle layer (Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network,...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
grofit/traiNNer
UpscaleBlock
false
15,479
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
soft_L1
import torch import torch.utils.data import torch.nn as nn class soft_L1(nn.Module): def __init__(self): super(soft_L1, self).__init__() def forward(self, input, target, eps=0.0): ret = torch.abs(input - target) - eps ret = torch.clamp(ret, min=0.0, max=100.0) return ret 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._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
haidongz-usc/Curriculum-DeepSDF
soft_L1
false
15,480
[ "MIT" ]
65
ca216dda8edc6435139a6f657c45800791be94a7
https://github.com/haidongz-usc/Curriculum-DeepSDF/tree/ca216dda8edc6435139a6f657c45800791be94a7
TVLoss
import torch from torch.nn import functional as F import torch.nn as nn def get_image_gradients(image: 'torch.Tensor', step: 'int'=1): """Returns image gradients (dy, dx) for each color channel, using the finite-difference approximation. Places the gradient [ie. I(x+1,y) - I(x,y)] on the base pixel (x, y)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import functional as F import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
grofit/traiNNer
TVLoss
false
15,481
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
EnergyConservingLoss
import torch import torch.nn as nn import torch.nn.functional as F class EnergyConservingLoss(nn.L1Loss): """Energy conserving loss. A two term loss that enforces energy conservation after :cite:`Rethage2018`. The loss can be described as: .. math:: \\ell(x, y, m) = L = \\{l_1,\\dots,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 ...
hagenw/audtorch
EnergyConservingLoss
false
15,482
[ "MIT" ]
81
d82ae7f7f8c7edb7b7180b83442224e9a68483bd
https://github.com/hagenw/audtorch/tree/d82ae7f7f8c7edb7b7180b83442224e9a68483bd
minibatch_std_concat_layer
import copy import torch import torch.nn as nn def mean(tensor, dim=None, keepdim=False): if dim is None: return torch.mean(tensor) else: if isinstance(dim, int): dim = [dim] dim = sorted(dim) for d in dim: tensor = tensor.mean(dim=d, keepdim=True) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
grofit/traiNNer
minibatch_std_concat_layer
false
15,483
[ "Apache-2.0" ]
78
12d006fd44ed304e4178839c53b1f3d95ca25dcb
https://github.com/grofit/traiNNer/tree/12d006fd44ed304e4178839c53b1f3d95ca25dcb
AdMSoftmaxLoss
import torch import torch.nn as nn import torch.nn.functional as F class AdMSoftmaxLoss(nn.Module): def __init__(self, in_features, out_features, s=30.0, m=0.4): """ AM Softmax Loss """ super(AdMSoftmaxLoss, self).__init__() self.s = s self.m = m self.in_fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gcambara/s3prl
AdMSoftmaxLoss
false
15,484
[ "MIT" ]
856
33284ebde3a903ed8604d6dae85669d0174ae1d3
https://github.com/gcambara/s3prl/tree/33284ebde3a903ed8604d6dae85669d0174ae1d3
Nullifier
import torch import torch.nn as nn class Nullifier(nn.Container): def __init__(self): super(Nullifier, self).__init__() def forward(self, inTensor): outTensor = inTensor.clone() outTensor.fill_(0.0) return outTensor def get_inputs(): return [torch.rand([4, 4, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
haoruilee/DeepSets
Nullifier
false
15,485
[ "Apache-2.0" ]
213
b405dd6b51a34fb1ef622e25e6685b417b7b7cbb
https://github.com/haoruilee/DeepSets/tree/b405dd6b51a34fb1ef622e25e6685b417b7b7cbb
MMTM
import torch import torch.nn as nn def init_weights(m): None if type(m) == nn.Linear: None else: None class MMTM(nn.Module): def __init__(self, dim_visual, dim_skeleton, ratio): super(MMTM, self).__init__() dim = dim_visual + dim_skeleton dim_out = int(2 * di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
haamoon/mmtm
MMTM
false
15,486
[ "MIT" ]
70
1c81cfefad5532cfb39193b8af3840ac3346e897
https://github.com/haamoon/mmtm/tree/1c81cfefad5532cfb39193b8af3840ac3346e897
MaskedInstanceNorm1d
import torch import torch.cuda from torch import nn import torch.distributed import torch.utils.data import torch.optim class MaskedInstanceNorm1d(nn.Module): """Instance norm + masking.""" MAX_CNT = 100000.0 def __init__(self, d_channel: 'int', unbiased: 'bool'=True, affine: 'bool'=False): ...
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.cuda from torch...
hamjam/NeMo
MaskedInstanceNorm1d
false
15,487
[ "Apache-2.0" ]
4,145
b3484d32e1317666151f931bfa39867d88ed8658
https://github.com/hamjam/NeMo/tree/b3484d32e1317666151f931bfa39867d88ed8658
ConvGLU
import torch import torch.cuda from torch import nn import torch.distributed import torch.utils.data import torch.optim def str2act(txt): """Translates text to neural network activation""" return {'sigmoid': nn.Sigmoid(), 'relu': nn.ReLU(), 'none': nn. Sequential(), 'lrelu': nn.LeakyReLU(0.2), 'selu':...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.cuda from torch import nn import torch.distributed import torch.uti...
hamjam/NeMo
ConvGLU
false
15,488
[ "Apache-2.0" ]
4,145
b3484d32e1317666151f931bfa39867d88ed8658
https://github.com/hamjam/NeMo/tree/b3484d32e1317666151f931bfa39867d88ed8658