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
GLU
import torch import torch.nn as nn import torch.nn.functional class GLU(nn.Module): def __init__(self, input_size, gating_size, output_size): super().__init__() self.gate = nn.Linear(gating_size, input_size) self.lin = nn.Linear(input_size, output_size) def forward(self, x, gating): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional assert_size_stride = torch._C._...
MichalOp/StarTrain
GLU
false
17,720
[ "MIT" ]
7
e8dddf879f103e18239ad37b373c9b51fbbe093b
https://github.com/MichalOp/StarTrain/tree/e8dddf879f103e18239ad37b373c9b51fbbe093b
TripletSoftmaxLoss
import torch import torch.nn as nn import torch.nn.functional as F class TripletSoftmaxLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample, a negative sample, logits and class labels """ def __init__(self, margin=0.0, size_average=True, lambda_factor=0.0): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
MikeLagunes/Supervised-Triplet-Network
TripletSoftmaxLoss
false
17,721
[ "MIT" ]
6
575bcaf8f17affb0ff0e93212dde0f3f634c196f
https://github.com/MikeLagunes/Supervised-Triplet-Network/tree/575bcaf8f17affb0ff0e93212dde0f3f634c196f
EdgeLoss
import torch import torch.nn as nn import torch.nn.functional as F def cross_entropy(logits, labels): return torch.mean((1 - labels) * logits + torch.log(1 + torch.exp(-logits)) ) class EdgeLoss(nn.Module): def __init__(self): super().__init__() laplace = torch.FloatTensor([[-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.triton_helpers import libdevice, math as tl_math im...
Mhaiyang/TCSVT2021_DCENet
EdgeLoss
false
17,722
[ "BSD-3-Clause" ]
4
aae8c7643402c15847836c0ce4934b743e11fd8a
https://github.com/Mhaiyang/TCSVT2021_DCENet/tree/aae8c7643402c15847836c0ce4934b743e11fd8a
Model
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_dim, out_dim): super(Model, self).__init__() self.out_dim = out_dim self.fc1 = nn.Linear(in_dim, in_dim // 2) self.fc2 = nn.Linear(in_dim // 2, in_dim // 4) 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....
MiscellaneousStuff/tlol-py
Model
false
17,723
[ "MIT" ]
4
60477b4f794daa12930d7bbec4cf692bab426a33
https://github.com/MiscellaneousStuff/tlol-py/tree/60477b4f794daa12930d7bbec4cf692bab426a33
ScaleUp
import torch import torch.nn as nn from torch.nn import Parameter class ScaleUp(nn.Module): """ScaleUp""" def __init__(self, scale): super(ScaleUp, self).__init__() self.scale = Parameter(torch.tensor(scale)) def forward(self, x): return x * self.scale def get_inputs(): ret...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = to...
NTDXYG/DeepPseudo
ScaleUp
false
17,724
[ "Apache-2.0" ]
7
0d89045ea145f23259306eb024e9bbe261f33d9b
https://github.com/NTDXYG/DeepPseudo/tree/0d89045ea145f23259306eb024e9bbe261f33d9b
ClampNorm
import torch from torch import nn class ClampNorm(nn.Module): def __init__(self): super(ClampNorm, self).__init__() def forward(self, x): out = x.clamp(0.0, 1.0) return out / out.sum(1, keepdim=True) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
NREL/ml-combustion-pdf-models
ClampNorm
false
17,725
[ "Apache-2.0" ]
6
0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
RelErrorLoss
import torch from torch import nn class RelErrorLoss(nn.Module): def __init__(self): super(RelErrorLoss, self).__init__() self.eps = 1e-06 def forward(self, input, target): return torch.mean(torch.abs(target - input) / (target + self.eps)) def get_inputs(): return [torch.rand([...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
NREL/ml-combustion-pdf-models
RelErrorLoss
false
17,726
[ "Apache-2.0" ]
6
0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
SSP
import torch import numpy as np from torch import nn import torch.nn.functional as F def ssp(*args, **kwargs): return F.softplus(*args, **kwargs) - np.log(2) class SSP(nn.Softplus): def forward(self, xs): return ssp(xs, self.beta, self.threshold) def get_inputs(): return [torch.rand([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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np from torch import nn import torch.nn.functi...
MikeEntwistle/deepqmc
SSP
false
17,727
[ "MIT" ]
4
b5c20bf1768f04227becd5079c6b40aefc97d26c
https://github.com/MikeEntwistle/deepqmc/tree/b5c20bf1768f04227becd5079c6b40aefc97d26c
SoftTargetCrossEntropy
import torch import torch.nn as nn import torch.nn.functional as F class SoftTargetCrossEntropy(nn.Module): def __init__(self, reduce='mean'): super(SoftTargetCrossEntropy, self).__init__() self.criterion = nn.KLDivLoss(reduction=reduce) self.reduce = reduce def forward(self, x, targ...
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...
MichalBusta/OpenCitiesAIC
SoftTargetCrossEntropy
false
17,728
[ "MIT" ]
7
2358118a782edde27a588d6adaf79941cbd90de6
https://github.com/MichalBusta/OpenCitiesAIC/tree/2358118a782edde27a588d6adaf79941cbd90de6
SoftmaxImage
import torch from torch import nn class SoftmaxImage(nn.Module): """Apply Softmax on an image. Softmax2d applies on second dimension (i.e. channels), which is not what I want. This applies along the H and W dimensions, where (N, C, H, W) is the size of the input. """ def __init__(self, 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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
NREL/ml-combustion-pdf-models
SoftmaxImage
false
17,729
[ "Apache-2.0" ]
6
0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
ElectronicAsymptotic
import torch from torch import nn class ElectronicAsymptotic(nn.Module): """Jastrow factor with a correct electronic cusp. The Jastrow factor is calculated from distances between all pairs of electrons, :math:`d_{ij}`, .. math:: \\mathrm \\gamma :=\\sum_{ij}-\\frac{c}{\\alpha(1+\\alp...
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...
MikeEntwistle/deepqmc
ElectronicAsymptotic
false
17,730
[ "MIT" ]
4
b5c20bf1768f04227becd5079c6b40aefc97d26c
https://github.com/MikeEntwistle/deepqmc/tree/b5c20bf1768f04227becd5079c6b40aefc97d26c
CNNLayer
import torch import torch.nn as nn import torch.nn.functional as F class CNNLayer(nn.Module): def __init__(self, input_size, in_channels, out_channels, kernel_width, act_fun=nn.ReLU, drop_prob=0.1): """Initilize CNN layer. Args: input_size [int]: embedding dim or the last 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....
NUSTM/PyTorch-DNN
CNNLayer
false
17,731
[ "MIT" ]
5
3cea33380df60e5db307cab50f273efe9ac445c1
https://github.com/NUSTM/PyTorch-DNN/tree/3cea33380df60e5db307cab50f273efe9ac445c1
SyntacticGCN
import torch import torch.nn as nn import torch.nn.functional as F class SyntacticGCN(nn.Module): def __init__(self, input_size, hidden_size, num_labels, bias=True): super(SyntacticGCN, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_labels = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
NLP-Discourse-SoochowU/TDDiscourseParser
SyntacticGCN
false
17,732
[ "Apache-2.0" ]
9
2f9c7cef85c564c47b368ee4935caf1fad7c598d
https://github.com/NLP-Discourse-SoochowU/TDDiscourseParser/tree/2f9c7cef85c564c47b368ee4935caf1fad7c598d
ValueNetwork
import torch import torch.nn as nn import torch.nn.functional as F class ValueNetwork(nn.Module): """ Value network V(s_t) = E[G_t | s_t] to use as a baseline in the reinforce update. This a Neural Net with 1 hidden layer """ def __init__(self, num_inputs, hidden_dim): super(ValueNetwork,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
NadeemWard/pytorch_simple_policy_gradients
ValueNetwork
false
17,733
[ "MIT" ]
5
d0ae66b46860504a077fdffdac45b5077c12c480
https://github.com/NadeemWard/pytorch_simple_policy_gradients/tree/d0ae66b46860504a077fdffdac45b5077c12c480
Softmax_Policy
import torch import torch.nn as nn import torch.nn.functional as F class Softmax_Policy(nn.Module): """ Simple neural network with softmax action selection """ def __init__(self, num_inputs, hidden_size, action_space): super(Softmax_Policy, self).__init__() num_outputs = action_space ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NadeemWard/pytorch_simple_policy_gradients
Softmax_Policy
false
17,734
[ "MIT" ]
5
d0ae66b46860504a077fdffdac45b5077c12c480
https://github.com/NadeemWard/pytorch_simple_policy_gradients/tree/d0ae66b46860504a077fdffdac45b5077c12c480
Decoder
import torch from torch import nn class Decoder(nn.Module): def __init__(self, layer_sizes, latent_size, nlabels): super(Decoder, self).__init__() self.MLP = nn.Sequential() input_size = latent_size + nlabels for i, (in_size, out_size) in enumerate(zip([input_size] + l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
NREL/ml-combustion-pdf-models
Decoder
false
17,735
[ "Apache-2.0" ]
6
0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
https://github.com/NREL/ml-combustion-pdf-models/tree/0505b9c54ab4c1e2b7ef8ca9f59f76bfb2e3732d
LossW2V
import torch import torch.nn as nn class LossW2V(nn.Module): """Triplet loss with hard positive/negative mining. Reference: Hermans et al. In Defense of the Triplet Loss for Person Re-Identification. arXiv:1703.07737. Code imported from https://github.com/Cysu/open-reid/blob/master/reid/loss/triplet....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
Nabeel-Malkani/Digital-Image-Processing
LossW2V
false
17,736
[ "MIT" ]
4
dee03cb61c54db55c5a2bfa9ca0f9dea7dba66a6
https://github.com/Nabeel-Malkani/Digital-Image-Processing/tree/dee03cb61c54db55c5a2bfa9ca0f9dea7dba66a6
EntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class EntropyLoss(nn.Module): def __init__(self): super(EntropyLoss, self).__init__() def forward(self, x): out = F.softmax(x, dim=1) * F.log_softmax(x, dim=1) out = -1.0 * out.sum(dim=1) return out.mean() d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation
EntropyLoss
false
17,737
[ "MIT" ]
3
fd0feab42151c0bae60712480301ea26f627a81d
https://github.com/NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation/tree/fd0feab42151c0bae60712480301ea26f627a81d
CNN
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self, input_size=50, hidden_size=256, dropout=0, kernel_size=3, padding=1, activation_function=F.relu): """ Args: input_size: dimention of input embedding kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
NanoGDA/gda-extraction
CNN
false
17,738
[ "MIT" ]
4
9dfedc54dab10ee4e90d8af622bcaf97e6dc2422
https://github.com/NanoGDA/gda-extraction/tree/9dfedc54dab10ee4e90d8af622bcaf97e6dc2422
SimSiamLoss
import torch import torch.nn as nn class SimSiamLoss(nn.Module): """ Loss function defined in https://arxiv.org/abs/2011.10566 """ def __init__(self): super(SimSiamLoss, self).__init__() def forward(self, zx, zy, px, py): loss = -(zx.detach() * py).sum(dim=1).mean() loss ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
NeurAI-Lab/DoGo
SimSiamLoss
false
17,739
[ "MIT" ]
3
e3038204f15a40a2d5caca20bb171c87a40d95ba
https://github.com/NeurAI-Lab/DoGo/tree/e3038204f15a40a2d5caca20bb171c87a40d95ba
Smooth_Loss
import torch import torch.nn as nn class Smooth_Loss(nn.Module): def __init__(self): super(Smooth_Loss, self).__init__() def forward(self, x): loss_smooth = torch.mean(torch.abs(x[:, :, :, :-1] - x[:, :, :, 1:]) ) + torch.mean(torch.abs(x[:, :, :-1, :] - x[:, :, 1:, :])) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
NeilDG/SGID-PFF
Smooth_Loss
false
17,740
[ "MIT" ]
8
e027ac65e63f3c052665290cd0438bb7bdeabf9f
https://github.com/NeilDG/SGID-PFF/tree/e027ac65e63f3c052665290cd0438bb7bdeabf9f
TFConvNet
import torch import torch.nn.functional as F import torch.nn as nn class TFConvNet(nn.Module): """ Network architecture in the Tensorflow image classification tutorial """ def __init__(self): super(TFConvNet, self).__init__() self.conv1 = nn.Conv2d(3, 32, 3) self.pool = nn.Max...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
NVlabs/FedFomo
TFConvNet
false
17,741
[ "BSD-3-Clause-Attribution" ]
7
fe04f6641407bce4fc58ea3fbf8cb314f9af8629
https://github.com/NVlabs/FedFomo/tree/fe04f6641407bce4fc58ea3fbf8cb314f9af8629
JsdCrossEntropy
import torch import torch.nn as nn import torch.nn.functional as F class JsdCrossEntropy(nn.Module): def __init__(self): super(JsdCrossEntropy, self).__init__() def forward(self, net_1_logits, net_2_logits): net_1_probs = F.softmax(net_1_logits, dim=1) net_2_probs = F.softmax(net_2_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, math as tl_math import torc...
NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation
JsdCrossEntropy
false
17,742
[ "MIT" ]
3
fd0feab42151c0bae60712480301ea26f627a81d
https://github.com/NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation/tree/fd0feab42151c0bae60712480301ea26f627a81d
IBLoss
import torch import torch.nn as nn import torch.nn.functional as F class EntropyLoss(nn.Module): def __init__(self): super(EntropyLoss, self).__init__() def forward(self, x): out = F.softmax(x, dim=1) * F.log_softmax(x, dim=1) out = -1.0 * out.sum(dim=1) return out.mean() c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation
IBLoss
false
17,743
[ "MIT" ]
3
fd0feab42151c0bae60712480301ea26f627a81d
https://github.com/NYCU-MLLab/Strategic-Optimization-for-Worst-case-Augmentation/tree/fd0feab42151c0bae60712480301ea26f627a81d
Critic
import torch import torch.nn as nn import torch.nn.functional as F def weight_init(m): """Custom weight init for Conv2D and Linear layers.""" if isinstance(m, nn.Linear): nn.init.orthogonal_(m.weight.data) m.bias.data.fill_(0.0) elif isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
LQNew/AUMC
Critic
false
17,744
[ "MIT" ]
5
c3ce9c289bc8c0912431d68ec4fe260f640df3bc
https://github.com/LQNew/AUMC/tree/c3ce9c289bc8c0912431d68ec4fe260f640df3bc
CosineSimilarityLoss
from torch.nn import Module import torch import torch.nn.functional as F class BaseLoss(Module): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class CosineSimilarityLoss(BaseLoss): def __init__(self, dim=1, eps=1e-08, reduction='mean', *args, **kwargs): super().__i...
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 Module ...
NullConvergence/torch_temp
CosineSimilarityLoss
false
17,745
[ "MIT" ]
3
29a0d7190f0be6124f51bd85b8320cd8b3cef29a
https://github.com/NullConvergence/torch_temp/tree/29a0d7190f0be6124f51bd85b8320cd8b3cef29a
ResBlock
import torch import torch.nn as nn def get_same_padding(kernel_size, dilation): kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1) padding = (kernel_size - 1) // 2 return padding class ResBlock(nn.Module): def __init__(self, inplanes, planes, kernel_size=3, stride=1, dilation=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_...
NeilDG/SGID-PFF
ResBlock
false
17,746
[ "MIT" ]
8
e027ac65e63f3c052665290cd0438bb7bdeabf9f
https://github.com/NeilDG/SGID-PFF/tree/e027ac65e63f3c052665290cd0438bb7bdeabf9f
BinaryTreeGRULayer
import torch import torch.nn as nn class BinaryTreeGRULayer(nn.Module): def __init__(self, hidden_dim): super(BinaryTreeGRULayer, self).__init__() self.fc1 = nn.Linear(in_features=2 * hidden_dim, out_features=3 * hidden_dim) self.fc2 = nn.Linear(in_features=2 * hidden_dim, out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
NanoGDA/gda-extraction
BinaryTreeGRULayer
false
17,747
[ "MIT" ]
4
9dfedc54dab10ee4e90d8af622bcaf97e6dc2422
https://github.com/NanoGDA/gda-extraction/tree/9dfedc54dab10ee4e90d8af622bcaf97e6dc2422
Select
import torch import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter class Select(nn.Module): def __init__(self, c): super(Select, self).__init__() self.weight = Parameter(torch.ones(c, requires_grad=False)) def forward(self, 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 import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.a...
Nuctech-AI/LBS_pruning
Select
false
17,748
[ "MIT" ]
6
d2f67b287b69968b54a55fc3d25e26eef64d29a7
https://github.com/Nuctech-AI/LBS_pruning/tree/d2f67b287b69968b54a55fc3d25e26eef64d29a7
PositionalEncoding
import math import torch class PositionalEncoding(torch.nn.Module): """ Positional encoding for Transformer Parameters ---------- hidden_size : `int`, required Hidden size of positional encoding. Must match hidden size of input tokens. dropout : `float`, required Dropo...
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 math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda...
Nemexur/nonauto-lm
PositionalEncoding
false
17,750
[ "Apache-2.0" ]
3
6f237e4fc2b3b679cd92126ea5facd58d3cf6e75
https://github.com/Nemexur/nonauto-lm/tree/6f237e4fc2b3b679cd92126ea5facd58d3cf6e75
BinResBlock
import torch import torch.nn as nn def get_same_padding(kernel_size, dilation): kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1) padding = (kernel_size - 1) // 2 return padding class BinResBlock(nn.Module): def __init__(self, inplanes, kernel_size=3, dilation=1): super(BinResB...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
NeilDG/SGID-PFF
BinResBlock
false
17,751
[ "MIT" ]
8
e027ac65e63f3c052665290cd0438bb7bdeabf9f
https://github.com/NeilDG/SGID-PFF/tree/e027ac65e63f3c052665290cd0438bb7bdeabf9f
ConvReluPool
import torch import torch.nn as nn from torch.nn import functional as F def Conv2d(fIn, fOut, k, stride=1): """torch Conv2d with same padding""" assert k % 2 == 0 pad = int((k - 1) / 2) return torch.nn.Conv2d(fIn, fOut, k, stride=stride, padding=pad) def Pool(k, stride=1, pad=0): return torch.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_...
NeuralMMO/baselines
ConvReluPool
false
17,752
[ "MIT" ]
7
407004cfd0c0959b871a982adf49e4fe667df8de
https://github.com/NeuralMMO/baselines/tree/407004cfd0c0959b871a982adf49e4fe667df8de
RNN
import torch import torch.nn as nn import torch.nn.init class RNN(nn.Module): def __init__(self, data_size, hidden_size, output_size): super(RNN, self).__init__() self.hidden_size = hidden_size input_size = data_size + hidden_size self.i2h = nn.Linear(input_size, 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 import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo...
OBA9k/Test_dev
RNN
false
17,753
[ "Apache-2.0" ]
4
bfdd337fb56ca160e1d09b6c310d1e6037d55fcd
https://github.com/OBA9k/Test_dev/tree/bfdd337fb56ca160e1d09b6c310d1e6037d55fcd
DownsampleA
import torch import torch.nn as nn import torch.nn.init class DownsampleA(nn.Module): def __init__(self, nIn, nOut, stride): super(DownsampleA, self).__init__() self.avg = nn.AvgPool2d(kernel_size=1, stride=stride) def forward(self, x): return torch.cat((self.avg(x), x.mul(0)), 1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dy...
OBA9k/Test_dev
DownsampleA
false
17,754
[ "Apache-2.0" ]
4
bfdd337fb56ca160e1d09b6c310d1e6037d55fcd
https://github.com/OBA9k/Test_dev/tree/bfdd337fb56ca160e1d09b6c310d1e6037d55fcd
AdaIN
import torch import torch.nn as nn class AdaIN(nn.Module): def __init__(self, style_dim, num_features): super().__init__() self.norm = nn.InstanceNorm2d(num_features, affine=False) self.fc = nn.Linear(style_dim, num_features * 2) def forward(self, x, s): h = self.fc(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.triton_helpers import libdevice import torch.nn as ...
ORANZINO/bouquet_server
AdaIN
false
17,755
[ "MIT" ]
7
2ce1bb59df15297878c555dd97e0f27b5202ed02
https://github.com/ORANZINO/bouquet_server/tree/2ce1bb59df15297878c555dd97e0f27b5202ed02
Linear_2L
import torch import torch.nn as nn import torch.utils.data class Linear_2L(nn.Module): def __init__(self, input_dim, output_dim, n_hid): super(Linear_2L, self).__init__() self.n_hid = n_hid self.input_dim = input_dim self.output_dim = output_dim self.fc1 = nn.Linear(input_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Neronjust2017/Bayesian-neural-networks
Linear_2L
false
17,756
[ "MIT" ]
4
9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
ShuffleBlock
import torch import torch.nn as nn class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.size(...
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...
ORNL/AADL
ShuffleBlock
false
17,757
[ "BSD-3-Clause" ]
6
8a509676d0a0a78f1f334a3dc93e92721cfcfe90
https://github.com/ORNL/AADL/tree/8a509676d0a0a78f1f334a3dc93e92721cfcfe90
RotaryEmbedding
import torch from typing import * class RotaryEmbedding(torch.nn.Module): """`Rotary Position Embedding <https://arxiv.org/abs/2104.09864v2> Args: rotary_dim (int): rotary dimension """ def __init__(self, rotary_dim: 'int'): super().__init__() self.rotary_dim = rotary_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.triton_helpers import libdevice, math as tl_math from typing import * assert_size_stride = torch._C._dynamo.gua...
OpenBMB/ModelCenter
RotaryEmbedding
false
17,758
[ "Apache-2.0" ]
4
28073f24a67f6c0beb4fd5e2cd13284f9de2284a
https://github.com/OpenBMB/ModelCenter/tree/28073f24a67f6c0beb4fd5e2cd13284f9de2284a
ResBlk
import math import torch import torch.nn as nn import torch.nn.functional as F def normalize(x, eps=1e-06): """Apply min-max normalization.""" x = x.contiguous() N, C, H, W = x.size() x_ = x.view(N * C, -1) max_val = torch.max(x_, dim=1, keepdim=True)[0] min_val = torch.min(x_, dim=1, keepdim=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
ORANZINO/bouquet_server
ResBlk
false
17,759
[ "MIT" ]
7
2ce1bb59df15297878c555dd97e0f27b5202ed02
https://github.com/ORANZINO/bouquet_server/tree/2ce1bb59df15297878c555dd97e0f27b5202ed02
sum_squared_error
import torch from torch.nn.modules.loss import _Loss class sum_squared_error(_Loss): """ Definition: sum_squared_error = 1/2 * nn.MSELoss(reduction = 'sum') The backward is defined as: input-target """ def __init__(self, size_average=None, reduce=None, reduction='sum'): super(sum_squared_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.guards.asse...
ORNL/AADL
sum_squared_error
false
17,760
[ "BSD-3-Clause" ]
6
8a509676d0a0a78f1f334a3dc93e92721cfcfe90
https://github.com/ORNL/AADL/tree/8a509676d0a0a78f1f334a3dc93e92721cfcfe90
HardAttn
import torch import torch.nn as nn from torch.nn import functional as F from torchvision.transforms import * class HardAttn(nn.Module): """Hard Attention (Sec. 3.1.II)""" def __init__(self, in_channels): super(HardAttn, self).__init__() self.fc = nn.Linear(in_channels, 4 * 2) self.ini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
KevinDocel/deep-person-reid
HardAttn
false
17,761
[ "MIT" ]
8
fafcb5e39837b8e441e7b6f57d5355f50d28c81d
https://github.com/KevinDocel/deep-person-reid/tree/fafcb5e39837b8e441e7b6f57d5355f50d28c81d
Linear_2L_KFRA
import torch import torch.nn as nn import torch.utils.data def sample_K_laplace_MN(MAP, upper_Qinv, lower_HHinv): Z = MAP.data.new(MAP.size()).normal_(mean=0, std=1) all_mtx_sample = MAP + torch.matmul(torch.matmul(lower_HHinv, Z), upper_Qinv) weight_mtx_sample = all_mtx_sample[:, :-1] bias_mt...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Neronjust2017/Bayesian-neural-networks
Linear_2L_KFRA
false
17,762
[ "MIT" ]
4
9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
VdLinear
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def calculate_kl(log_alpha): return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha))) class VdLinear(nn.Module): """ variational dropout """ def __init__(self, n_in, n_out, alpha_shape=(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.triton_helpers import libdevice, math as tl_math im...
Neronjust2017/Bayesian-neural-networks
VdLinear
false
17,763
[ "MIT" ]
4
9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
KLLoss
import torch import torch.nn as nn import torch.nn.functional as F class KLLoss(nn.Module): """ KL-Divergence symmetric loss between two distributions Used in here for knowledge distillation """ def __init__(self): super(KLLoss, self).__init__() self.similarity_f = nn.CosineSimila...
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...
NeurAI-Lab/DoGo
KLLoss
false
17,764
[ "MIT" ]
3
e3038204f15a40a2d5caca20bb171c87a40d95ba
https://github.com/NeurAI-Lab/DoGo/tree/e3038204f15a40a2d5caca20bb171c87a40d95ba
Linear_1L
import torch import torch.nn as nn import torch.utils.data class Linear_1L(nn.Module): def __init__(self, input_dim, output_dim, n_hid): super(Linear_1L, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.fc1 = nn.Linear(input_dim, n_hid) self.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 import torch.nn as nn import ...
Neronjust2017/Bayesian-neural-networks
Linear_1L
false
17,765
[ "MIT" ]
4
9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
Loss
import math import torch import torch.nn as nn import torch.utils.data class Loss(nn.Module): def __init__(self, type_in='pred_intervals', alpha=0.1, loss_type= 'qd_soft', censor_R=False, soften=100.0, lambda_in=10.0, sigma_in= 0.5, use_cuda=True): super().__init__() self.alpha = ...
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 ...
Neronjust2017/Bayesian-neural-networks
Loss
false
17,766
[ "MIT" ]
4
9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
PSLoss
import torch import torch.nn as nn import torch.fft class PSLoss(nn.Module): def __init__(self): super().__init__() self.l1_loss = torch.nn.L1Loss() def forward(self, x, y): x_power = torch.abs(torch.fft.fftn(x, dim=[2, 3])) y_power = torch.abs(torch.fft.fftn(y, dim=[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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
NejcHirci/material-addon
PSLoss
false
17,767
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
ResolutionScalingLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.fft class ResolutionScalingLayer(nn.Module): """Implements the resolution scaling layer. Basically, this layer can be used to upsample feature maps from spatial domain with nearest neighbor interpolation. """ def __init__(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.fft assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo...
NejcHirci/material-addon
ResolutionScalingLayer
false
17,768
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
PositionalEncoding
import math import torch from torch import nn class PositionalEncoding(nn.Module): """Implement the PE function.""" def __init__(self, d_model, dropout, max_len=5000): super(PositionalEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) pe = torch.zeros(max_len, d_model) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guard...
OpenNLPhub/MRC_NER
PositionalEncoding
false
17,769
[ "MIT" ]
4
27ca063764aed9eb5f2ac672bb10052acbf374a5
https://github.com/OpenNLPhub/MRC_NER/tree/27ca063764aed9eb5f2ac672bb10052acbf374a5
InstanceNormLayer
import torch import torch.nn as nn import torch.fft class InstanceNormLayer(nn.Module): """Implements instance normalization layer.""" def __init__(self, epsilon=1e-08): super().__init__() self.eps = epsilon def forward(self, x): if len(x.shape) != 4: raise ValueError...
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.fft assert_size_stride = torch._C._dynamo.gu...
NejcHirci/material-addon
InstanceNormLayer
false
17,770
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
AdaptiveInstanceNormalization
import torch import torch.nn as nn import torch.fft class AdaptiveInstanceNormalization(nn.Module): def and__init__(self): super(AdaptiveInstanceNormalization, self).__init__() def forward(self, x, mean, std): whitened_x = torch.nn.functional.instance_norm(x) return whitened_x * std ...
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.fft assert_size_stride = torch._C._dynamo.gu...
NejcHirci/material-addon
AdaptiveInstanceNormalization
false
17,771
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
VGGLoss
import torch import torch.nn as nn import torch.fft class VGGLoss(nn.Module): def __init__(self): super().__init__() self.mse_loss = torch.nn.MSELoss() def forward(self, x, y): loss = torch.tensor(0.0, device=x[0].device) input_features = x output_features = 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 import torch.nn as nn import torch.fft assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo...
NejcHirci/material-addon
VGGLoss
false
17,772
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
NegPearson
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class NegPearson(nn.Module): def __init__(self): super(NegPearson, self).__init__() return def forward(self, preds, labels): loss = 0 for i in range(preds.shape[0]): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel import torch.optim import torch....
Oichii/resnet3D_pulse
NegPearson
false
17,773
[ "MIT" ]
4
d123abfdb14eedc972ab1e0c4c3026fe8c4074af
https://github.com/Oichii/resnet3D_pulse/tree/d123abfdb14eedc972ab1e0c4c3026fe8c4074af
FocalLoss1
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class FocalLoss1(nn.Module): def __init__(self, gamma): super(FocalLoss1, self).__init__() self.gamma = gamma def forward(self, input, target): if not target.size() == input.size(): raise...
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...
OnurUner/DeepSide
FocalLoss1
false
17,774
[ "MIT" ]
4
dffb7ddc1d1bde36bbf5abb6eac107d39985c57a
https://github.com/OnurUner/DeepSide/tree/dffb7ddc1d1bde36bbf5abb6eac107d39985c57a
GramMatrix
import torch import torch.fft class GramMatrix(torch.nn.Module): def forward(self, input): b, c, h, w = input.size() features = input.view(b, c, h * w) gram_matrix = torch.bmm(features, features.transpose(1, 2)) gram_matrix.div_(h * w) return gram_matrix def get_inputs()...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.fft assert_size_stride = torch._C._dynamo.guards.assert_size_stride...
NejcHirci/material-addon
GramMatrix
false
17,775
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
Mapping
import torch import torch.nn as nn import torch.fft class Mapping(nn.Module): def __init__(self, z_size, out_size): super(Mapping, self).__init__() self.out_size = out_size self.mapping_layers = nn.ModuleList() self.linear = nn.Linear(z_size, z_size) self.relu = nn.ReLU(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 import torch.nn as nn import ...
NejcHirci/material-addon
Mapping
false
17,776
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
FocusLayer
import torch import torch.nn as nn class FocusLayer(nn.Module): def __init__(self, c1, c2, k=1): super(FocusLayer, self).__init__() def forward(self, x): return torch.cat([x[..., ::2], x[..., 1::2]], dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
OrigamiSL/TCCT2021-Neurocomputing-
FocusLayer
false
17,777
[ "Apache-2.0" ]
4
c98c7add5d68510db61f49038970d145393d42a5
https://github.com/OrigamiSL/TCCT2021-Neurocomputing-/tree/c98c7add5d68510db61f49038970d145393d42a5
vd_linear_1L
import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.utils.data def calculate_kl(log_alpha): return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha))) class VdLinear(nn.Module): """ variational dropout """ def __init__(self, n_in, n_ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Neronjust2017/Bayesian-neural-networks
vd_linear_1L
false
17,778
[ "MIT" ]
4
9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
GramLoss
import torch import torch.nn as nn import torch.fft class GramMatrix(torch.nn.Module): def forward(self, input): b, c, h, w = input.size() features = input.view(b, c, h * w) gram_matrix = torch.bmm(features, features.transpose(1, 2)) gram_matrix.div_(h * w) return gram_mat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
NejcHirci/material-addon
GramLoss
false
17,779
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
vd_linear_1L_hetero
import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.utils.data def calculate_kl(log_alpha): return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha))) class VdLinear(nn.Module): """ variational dropout """ def __init__(self, n_in, n_ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Neronjust2017/Bayesian-neural-networks
vd_linear_1L_hetero
false
17,780
[ "MIT" ]
4
9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
https://github.com/Neronjust2017/Bayesian-neural-networks/tree/9d7f781f5c2dfa8fadf26300b4b5b64366c939cd
Net
import torch import torch.nn as nn import torch.nn.functional as f class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.fc1 = nn.Linear(28 * 28, 1024) self.fc2 = nn.Linear(1024, 10) def forward(self, x): x = f.relu(self.fc1(x.view(-1, 28 * 28))) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
PacktPublishing/Hands-On-Computer-Vision-with-PyTorch-1.x
Net
false
17,781
[ "MIT" ]
6
bad073f7489792d3c4bc860a2d56fa133ba63617
https://github.com/PacktPublishing/Hands-On-Computer-Vision-with-PyTorch-1.x/tree/bad073f7489792d3c4bc860a2d56fa133ba63617
ThreeLayerNet_tanh
import torch class ThreeLayerNet_tanh(torch.nn.Module): def __init__(self, D_in, H_1, H_2, D_out): super(ThreeLayerNet_tanh, self).__init__() self.linear1 = torch.nn.Linear(D_in, H_1) self.tanh = torch.nn.Tanh() self.linear2 = torch.nn.Linear(H_1, H_2) self.linear3 = torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride ...
PanosAntoniadis/pattern_recognition-ntua
ThreeLayerNet_tanh
false
17,782
[ "MIT" ]
6
6dca44de77f0ca94221980fc789446a2e10410a4
https://github.com/PanosAntoniadis/pattern_recognition-ntua/tree/6dca44de77f0ca94221980fc789446a2e10410a4
BertLMPredictionHead
import torch import torch.nn as nn class BertPredictionHeadTransform(nn.Module): def __init__(self, hidden_size, hidden_act=nn.GELU()): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.transform_act_fn = hidden_act self.LayerNorm = nn.LayerNorm(hidden_size)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
PKU-DAIR/2021_CCF_BDCI_LargeBERT_Rank1st
BertLMPredictionHead
false
17,783
[ "Apache-2.0" ]
4
6382433cda69c655f03c3cc284dc076407f18dc9
https://github.com/PKU-DAIR/2021_CCF_BDCI_LargeBERT_Rank1st/tree/6382433cda69c655f03c3cc284dc076407f18dc9
BertPredictionHeadTransform
import torch import torch.nn as nn class BertPredictionHeadTransform(nn.Module): def __init__(self, hidden_size, hidden_act=nn.GELU()): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.transform_act_fn = hidden_act self.LayerNorm = nn.LayerNorm(hidden_size)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
PKU-DAIR/2021_CCF_BDCI_LargeBERT_Rank1st
BertPredictionHeadTransform
false
17,784
[ "Apache-2.0" ]
4
6382433cda69c655f03c3cc284dc076407f18dc9
https://github.com/PKU-DAIR/2021_CCF_BDCI_LargeBERT_Rank1st/tree/6382433cda69c655f03c3cc284dc076407f18dc9
Net
import torch import torch.nn as nn class Net(nn.Module): def __init__(self, input_size, hidden_size, dropout_rate, out_size): super(Net, self).__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, hidden_size) self.fc3 = nn.Linear(hidden_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
PatWalters/yamc
Net
false
17,785
[ "MIT" ]
7
8fcde09305d6600fdea6211d0941977bb2cff65b
https://github.com/PatWalters/yamc/tree/8fcde09305d6600fdea6211d0941977bb2cff65b
StyleBlock
import torch import torch.nn as nn import torch.fft class AdaptiveInstanceNormalization(nn.Module): def and__init__(self): super(AdaptiveInstanceNormalization, self).__init__() def forward(self, x, mean, std): whitened_x = torch.nn.functional.instance_norm(x) return whitened_x * std ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
NejcHirci/material-addon
StyleBlock
false
17,786
[ "MIT" ]
4
c08e2081413c3319b712c2f7193ac8013f601382
https://github.com/NejcHirci/material-addon/tree/c08e2081413c3319b712c2f7193ac8013f601382
SDRLoss
import torch import torch.nn as nn class SDRLoss(nn.Module): def __init__(self): super().__init__() def forward(self, deg, clean): loss_sdr = -1.0 * torch.mean(deg * clean) ** 2 / (torch.mean(deg ** 2) + 2e-07) return loss_sdr 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...
PandoraLS/SpeechEnhancement
SDRLoss
false
17,787
[ "MIT" ]
6
f548eaafbe524a40c8cfd2221f7adf3a444b7a7d
https://github.com/PandoraLS/SpeechEnhancement/tree/f548eaafbe524a40c8cfd2221f7adf3a444b7a7d
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1): """Dice Loss. Args: smooth (float, optional): Smoothing value. A larger smooth value (also known as Laplace smooth, or Additive smooth) can be used to avoid ove...
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...
Pandinosaurus/Depth-Estimation-Segmentation
DiceLoss
false
17,788
[ "MIT" ]
4
2eea883c96bf106774ea94464fc16c6baea86a95
https://github.com/Pandinosaurus/Depth-Estimation-Segmentation/tree/2eea883c96bf106774ea94464fc16c6baea86a95
BertPreTrainingHeads
import torch import torch.nn as nn class BertPredictionHeadTransform(nn.Module): def __init__(self, hidden_size, hidden_act=nn.GELU()): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.transform_act_fn = hidden_act self.LayerNorm = nn.LayerNorm(hidden_size)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
PKU-DAIR/2021_CCF_BDCI_LargeBERT_Rank1st
BertPreTrainingHeads
false
17,789
[ "Apache-2.0" ]
4
6382433cda69c655f03c3cc284dc076407f18dc9
https://github.com/PKU-DAIR/2021_CCF_BDCI_LargeBERT_Rank1st/tree/6382433cda69c655f03c3cc284dc076407f18dc9
ThreeLayerNet
import torch class ThreeLayerNet(torch.nn.Module): def __init__(self, D_in, H_1, H_2, D_out): super(ThreeLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H_1) self.relu = torch.nn.ReLU() self.linear2 = torch.nn.Linear(H_1, H_2) self.linear3 = torch.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 assert_size_stride = torch._C...
PanosAntoniadis/pattern_recognition-ntua
ThreeLayerNet
false
17,790
[ "MIT" ]
6
6dca44de77f0ca94221980fc789446a2e10410a4
https://github.com/PanosAntoniadis/pattern_recognition-ntua/tree/6dca44de77f0ca94221980fc789446a2e10410a4
Sine
import torch import torch.nn as nn class Sine(nn.Module): def __init__(self, w0: 'float'=30.0): super(Sine, self).__init__() self.w0 = w0 def forward(self, x: 'torch.Tensor') ->torch.Tensor: return torch.sin(self.w0 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
Open-Catalyst-Project/baselines
Sine
false
17,791
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
NavigatorUnit
import torch import torch.utils.data import torch.nn as nn def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. st...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
HyperGAN/imgclsmob
NavigatorUnit
false
17,792
[ "MIT" ]
9
88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3
https://github.com/HyperGAN/imgclsmob/tree/88b9776a5a927dc9a54e85e31978c4a9ec5ecbf3
RMSELoss
import torch import torch.nn as nn class RMSELoss(nn.Module): def __init__(self, smooth=1e-06): """RMSE Loss. Args: smooth (float, optional): Smoothing value. """ super().__init__() self.mse = nn.MSELoss() self.smooth = smooth def forward(self, 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 assert...
Pandinosaurus/Depth-Estimation-Segmentation
RMSELoss
false
17,793
[ "MIT" ]
4
2eea883c96bf106774ea94464fc16c6baea86a95
https://github.com/Pandinosaurus/Depth-Estimation-Segmentation/tree/2eea883c96bf106774ea94464fc16c6baea86a95
BaseCNN
import torch import torch.nn as nn class BaseCNN(nn.Module): def __init__(self): super(BaseCNN, self).__init__() self.conv = nn.Conv1d(in_channels=1, out_channels=512, kernel_size= 64, stride=32, padding=16) self.deconv = nn.ConvTranspose1d(in_channels=512, out_channels=1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
PandoraLS/SpeechEnhancement
BaseCNN
false
17,794
[ "MIT" ]
6
f548eaafbe524a40c8cfd2221f7adf3a444b7a7d
https://github.com/PandoraLS/SpeechEnhancement/tree/f548eaafbe524a40c8cfd2221f7adf3a444b7a7d
RmseBceDiceLoss
import torch import torch.nn as nn import torch.nn.functional as F def dice_loss(smooth=1): """Create Dice Loss. Args: smooth (float, optional): Smoothing value. A larger smooth value (also known as Laplace smooth, or Additive smooth) can be used to avoid overfitting. ...
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...
Pandinosaurus/Depth-Estimation-Segmentation
RmseBceDiceLoss
false
17,795
[ "MIT" ]
4
2eea883c96bf106774ea94464fc16c6baea86a95
https://github.com/Pandinosaurus/Depth-Estimation-Segmentation/tree/2eea883c96bf106774ea94464fc16c6baea86a95
ExponentialEnvelope
import torch class ExponentialEnvelope(torch.nn.Module): """ Exponential envelope function that ensures a smooth cutoff, as proposed in Unke, Chmiela, Gastegger, Schütt, Sauceda, Müller 2021. SpookyNet: Learning Force Fields with Electronic Degrees of Freedom and Nonlocal Effects """ def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
Open-Catalyst-Project/baselines
ExponentialEnvelope
false
17,796
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
PolynomialEnvelope
import torch class PolynomialEnvelope(torch.nn.Module): """ Polynomial envelope function that ensures a smooth cutoff. Parameters ---------- exponent: int Exponent of the envelope function. """ def __init__(self, exponent): super().__init__() assert expone...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Open-Catalyst-Project/baselines
PolynomialEnvelope
false
17,797
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
ScaledSiLU
import torch class ScaledSiLU(torch.nn.Module): def __init__(self): super().__init__() self.scale_factor = 1 / 0.6 self._activation = torch.nn.SiLU() def forward(self, x): return self._activation(x) * self.scale_factor 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Open-Catalyst-Project/baselines
ScaledSiLU
false
17,798
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
ScalingFactor
import logging import torch class ScalingFactor(torch.nn.Module): """ Scale the output y of the layer s.t. the (mean) variance wrt. to the reference input x_ref is preserved. """ def __init__(self): super().__init__() self.scale_factor = torch.nn.Parameter(torch.tensor(1.0), ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import logging assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_c...
Open-Catalyst-Project/baselines
ScalingFactor
false
17,799
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
SiQU
import torch class SiQU(torch.nn.Module): def __init__(self): super().__init__() self._activation = torch.nn.SiLU() def forward(self, x): return x * self._activation(x) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Open-Catalyst-Project/baselines
SiQU
false
17,800
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
BCEDiceLoss
import torch import torch.nn as nn import torch.nn.functional as F def dice_loss(smooth=1): """Create Dice Loss. Args: smooth (float, optional): Smoothing value. A larger smooth value (also known as Laplace smooth, or Additive smooth) can be used to avoid overfitting. ...
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...
Pandinosaurus/Depth-Estimation-Segmentation
BCEDiceLoss
false
17,801
[ "MIT" ]
4
2eea883c96bf106774ea94464fc16c6baea86a95
https://github.com/Pandinosaurus/Depth-Estimation-Segmentation/tree/2eea883c96bf106774ea94464fc16c6baea86a95
GaussianSmearing
import torch import torch.nn as nn class GaussianSmearing(nn.Module): def __init__(self, in_features, start=0, end=1, num_freqs=50): super(GaussianSmearing, self).__init__() self.num_freqs = num_freqs offset = torch.linspace(start, end, num_freqs) self.coeff = -0.5 / (offset[1] - ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
Open-Catalyst-Project/baselines
GaussianSmearing
false
17,802
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
RmseBceLoss
import torch import torch.nn as nn def rmse_loss(smooth=1e-06): """Create Root Mean Squared Error Loss. Returns: Root mean squared error loss function """ return RMSELoss(smooth=1e-06) def bce_loss(): """Create Binary Cross Entropy Loss. The loss automatically applies the sigmoid ac...
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...
Pandinosaurus/Depth-Estimation-Segmentation
RmseBceLoss
false
17,803
[ "MIT" ]
4
2eea883c96bf106774ea94464fc16c6baea86a95
https://github.com/Pandinosaurus/Depth-Estimation-Segmentation/tree/2eea883c96bf106774ea94464fc16c6baea86a95
SphericalBesselBasis
import math import torch import numpy as np class SphericalBesselBasis(torch.nn.Module): """ 1D spherical Bessel basis Parameters ---------- num_radial: int Controls maximum frequency. cutoff: float Cutoff distance in Angstrom. """ def __init__(self, num_radial: 'int'...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math import numpy as np assert_size_stride = torch._C._dynamo.guar...
Open-Catalyst-Project/baselines
SphericalBesselBasis
false
17,804
[ "MIT" ]
10
89948582edfb8debb736406d54db9813a5f2c88d
https://github.com/Open-Catalyst-Project/baselines/tree/89948582edfb8debb736406d54db9813a5f2c88d
GCNet
import torch import torch.nn as nn class GCN(nn.Module): def __init__(self, in_ft, out_ft, act, bias=True): super(GCN, self).__init__() self.fc = nn.Linear(in_ft, out_ft, bias=False) self.act = nn.PReLU() if act == 'prelu' else act if bias: self.bias = nn.Parameter(tor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
PetarV-/telesign
GCNet
false
17,805
[ "MIT" ]
4
05f58162b7c5fbc3993d320fdbc4d5465dd1c71e
https://github.com/PetarV-/telesign/tree/05f58162b7c5fbc3993d320fdbc4d5465dd1c71e
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, input_dim): super(Critic, self).__init__() self.fc1 = nn.Linear(input_dim, 128) self.fc2 = nn.Linear(128, 1) def forward(self, x): x = F.relu(self.fc1(x)) x ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
PaulPan00/donkey_wrapper
Critic
false
17,806
[ "MIT" ]
6
a03cf0f42f65625fbce792b06c98acd153c5d6c8
https://github.com/PaulPan00/donkey_wrapper/tree/a03cf0f42f65625fbce792b06c98acd153c5d6c8
Discriminator
import torch import torch.nn as nn import torch.nn.functional as F class Discriminator(nn.Module): def __init__(self, gen_out_dim): super().__init__() self.l1 = torch.nn.Linear(gen_out_dim, 256) self.l2 = torch.nn.Linear(256, 256) self.l3 = torch.nn.Linear(256, 256) self.l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Phutoast/Win-or-Learn-Fast
Discriminator
false
17,807
[ "MIT" ]
7
5a6b4ee0dee3bce87a2b75c90269ef431e54c2d7
https://github.com/Phutoast/Win-or-Learn-Fast/tree/5a6b4ee0dee3bce87a2b75c90269ef431e54c2d7
Policy
import torch import torch.nn as nn import torch.nn.functional as F class Policy(nn.Module): def __init__(self, input_dim, hidden_size, output_dim): super(Policy, self).__init__() self.fc1 = nn.Linear(input_dim, hidden_size) self.fc2 = nn.Linear(hidden_size, hidden_size) self.fc3 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
PaulPan00/donkey_wrapper
Policy
false
17,808
[ "MIT" ]
6
a03cf0f42f65625fbce792b06c98acd153c5d6c8
https://github.com/PaulPan00/donkey_wrapper/tree/a03cf0f42f65625fbce792b06c98acd153c5d6c8
Generator
import torch import torch.nn as nn import torch.nn.functional as F class Generator(nn.Module): def __init__(self, z_dim): super().__init__() self.l1 = torch.nn.Linear(z_dim, 256) self.l2 = torch.nn.Linear(256, 256) self.l3 = torch.nn.Linear(256, 256) self.l4 = torch.nn.Lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Phutoast/Win-or-Learn-Fast
Generator
false
17,809
[ "MIT" ]
7
5a6b4ee0dee3bce87a2b75c90269ef431e54c2d7
https://github.com/Phutoast/Win-or-Learn-Fast/tree/5a6b4ee0dee3bce87a2b75c90269ef431e54c2d7
TLU
import torch from torch import nn from torch.nn import Parameter from torch.nn.parameter import Parameter class TLU(nn.Module): def __init__(self, num_features): """max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau""" super(TLU, self).__init__() self.num_features = num_features ...
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 import nn from torch.nn import Parameter from torch.nn.parameter import Parame...
PangJian123/ISM-ReID
TLU
false
17,810
[ "Apache-2.0" ]
8
4c8e4b4ae591add83e1e6ba0b4b7d2750eeb9ee9
https://github.com/PangJian123/ISM-ReID/tree/4c8e4b4ae591add83e1e6ba0b4b7d2750eeb9ee9
FastBiliner
import math import torch import torch.nn as nn class FastBiliner(nn.Module): def __init__(self, in1_features, in2_features, out_features): super(FastBiliner, self).__init__() weight = torch.randn(out_features, in1_features, in2_features ) * math.sqrt(2 / (in1_features + in2_features))...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
Perfec-Yu/Lifelong-ED
FastBiliner
false
17,811
[ "MIT" ]
6
f1af49129dd6ed4ff545f84e680565cccdb5b55a
https://github.com/Perfec-Yu/Lifelong-ED/tree/f1af49129dd6ed4ff545f84e680565cccdb5b55a
ConvMlp
import torch import torch.nn as nn class ConvMlp(nn.Module): """ MLP using 1x1 convs that keeps spatial dims """ def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.ReLU, norm_layer=None, drop=0.0): super().__init__() out_features = out_features o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
RICE-EIC/Patch-Fool
ConvMlp
false
17,812
[ "MIT" ]
7
9638ec33a4d13b0c5ff0ec3ee5ce6b46ea7da5a6
https://github.com/RICE-EIC/Patch-Fool/tree/9638ec33a4d13b0c5ff0ec3ee5ce6b46ea7da5a6
Generator
import torch import torch.onnx import torch.nn as nn def outputActivation(x): muX = x[:, :, 0:1] muY = x[:, :, 1:2] sigX = x[:, :, 2:3] sigY = x[:, :, 3:4] rho = x[:, :, 4:5] sigX = torch.exp(sigX) sigY = torch.exp(sigY) rho = torch.tanh(rho) out = torch.cat([muX, muY, sigX, sigY, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
PhilippeW83440/conv-social-pooling
Generator
false
17,813
[ "MIT" ]
4
93d3a08af8678c3309d75a9bfb37df500da5cc46
https://github.com/PhilippeW83440/conv-social-pooling/tree/93d3a08af8678c3309d75a9bfb37df500da5cc46
VectorQuantizer
import torch import torch.nn as nn class VectorQuantizer(nn.Module): """ Reference: Taming Transformers for High-Resolution Image Synthesis https://arxiv.org/pdf/2012.09841.pdf """ def __init__(self, n_e, e_dim, beta=1.0): super().__init__() self.n_e = n_e self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
PeikeLi/pytorch-vector-quantization
VectorQuantizer
false
17,814
[ "MIT" ]
6
48ce6a74ec56b9d8c11dde2cd35b055a925c3070
https://github.com/PeikeLi/pytorch-vector-quantization/tree/48ce6a74ec56b9d8c11dde2cd35b055a925c3070
GAT
import torch import torch.nn as nn import torch.nn.functional as F class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super(GraphAttentionLayer, 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....
OkYongChoi/smac
GAT
false
17,815
[ "Apache-2.0" ]
8
5b2b59e42d17a124e97feeecf9154a3a0aa9d260
https://github.com/OkYongChoi/smac/tree/5b2b59e42d17a124e97feeecf9154a3a0aa9d260
myDecoder
import torch import torch.nn.functional as F class myDecoder(torch.nn.Module): def __init__(self, fomSize, romSize): super(myDecoder, self).__init__() self.romSize_ = romSize self.fomSize_ = fomSize self.fc1 = torch.nn.Linear(romSize, 64) self.fc2 = torch.nn.Linear(64, 200...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Pressio/pressio4py
myDecoder
false
17,816
[ "Unlicense", "BSD-3-Clause" ]
4
36676dbd112a7c7960ccbf302ff14d4376c819ec
https://github.com/Pressio/pressio4py/tree/36676dbd112a7c7960ccbf302ff14d4376c819ec
KDLoss_source_code
import torch import torch.nn.functional as F from torch import nn class KDLoss_source_code(nn.Module): def __init__(self, temp: 'float', reduction: 'str'): super(KDLoss_source_code, self).__init__() self.temp = temp self.reduction = reduction self.kl_loss = nn.KLDivLoss(reduction=...
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 ...
PangJian123/ISM-ReID
KDLoss_source_code
false
17,817
[ "Apache-2.0" ]
8
4c8e4b4ae591add83e1e6ba0b4b7d2750eeb9ee9
https://github.com/PangJian123/ISM-ReID/tree/4c8e4b4ae591add83e1e6ba0b4b7d2750eeb9ee9
ConvAttentionLayer
import math import torch import torch.nn as nn import torch.utils import torch.nn.functional as F import torch.optim import torch.utils.data import torch.onnx.operators def Linear(in_features, out_features, bias=True): m = nn.Linear(in_features, out_features, bias) nn.init.xavier_uniform_(m.weight) if bia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
PeterouZh/SemiNAS
ConvAttentionLayer
false
17,818
[ "Apache-2.0" ]
5
39731663271b994571160d43d796b2bb93386b3b
https://github.com/PeterouZh/SemiNAS/tree/39731663271b994571160d43d796b2bb93386b3b
Attention
import torch import torch.nn as nn import torch.utils import torch.nn.functional as F import torch.optim import torch.utils.data import torch.onnx.operators class Attention(nn.Module): def __init__(self, input_dim, source_dim=None, output_dim=None, bias=False ): super(Attention, 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....
PeterouZh/SemiNAS
Attention
false
17,819
[ "Apache-2.0" ]
5
39731663271b994571160d43d796b2bb93386b3b
https://github.com/PeterouZh/SemiNAS/tree/39731663271b994571160d43d796b2bb93386b3b
Normalize
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional as F class Normalize(Module): """Performs :math:`L_p` normalization of inputs over specified dimension. Does: .. math:: v = \\frac{v}{\\max(\\lVert v \\rVert_p, \\epsilon)} for each subtensor v over ...
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 Module ...
RL-WWW/ISST
Normalize
false
17,820
[ "BSD-3-Clause" ]
5
42b656686fa9660794007a0bc00a7177937410e9
https://github.com/RL-WWW/ISST/tree/42b656686fa9660794007a0bc00a7177937410e9