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 |
|---|---|---|---|---|---|---|---|---|---|---|
QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class QNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_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_... | NagisaZj/pytorch-soft-actor-critic | QNetwork | false | 9,319 | [
"MIT"
] | 0 | 7f219269356b11273e873a9f4d3ac7b86fe317cb | https://github.com/NagisaZj/pytorch-soft-actor-critic/tree/7f219269356b11273e873a9f4d3ac7b86fe317cb |
BCELoss4BraTS | import torch
from torch import nn
import torch.jit
import torch.nn.functional
class BCELoss4BraTS(nn.Module):
def __init__(self, ignore_index=None, **kwargs):
super(BCELoss4BraTS, self).__init__()
self.kwargs = kwargs
self.ignore_index = ignore_index
self.criterion = nn.BCEWithLog... | 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 ... | MargeryLab/nnConRes | BCELoss4BraTS | false | 9,320 | [
"Apache-2.0"
] | 0 | a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 | https://github.com/MargeryLab/nnConRes/tree/a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 |
combLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class combLoss(nn.Module):
def __init__(self, margin, l=1):
super(combLoss, self).__init__()
self.margin = margin
self.l = l
def forward(self, anchor, pos, neg):
distance_pos = (anchor - pos).pow(2).sum(1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | MingzheWu418/plastering | combLoss | false | 9,321 | [
"MIT"
] | 0 | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | https://github.com/MingzheWu418/plastering/tree/322531e934c3acf2ecc8f520b37a6d255b9959c2 |
angularLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class angularLoss(nn.Module):
def __init__(self, margin, l=1):
super(angularLoss, self).__init__()
self.margin = margin
self.l = l
def forward(self, anchor, pos, neg):
distance_pos = (anchor - pos).pow(2).sum(... | 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... | MingzheWu418/plastering | angularLoss | false | 9,322 | [
"MIT"
] | 0 | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | https://github.com/MingzheWu418/plastering/tree/322531e934c3acf2ecc8f520b37a6d255b9959c2 |
Model | import torch
from torch import nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super().__init__()
self.h1 = nn.Linear(input_size, hidden_size)
self.h2 = nn.Linear(hidden_size, num_classes)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Natenumber12/LUDO_QLearning | Model | false | 9,323 | [
"MIT"
] | 0 | 0878b9bce01d0afc5798bdbf96db253302654f33 | https://github.com/Natenumber12/LUDO_QLearning/tree/0878b9bce01d0afc5798bdbf96db253302654f33 |
BinaryDiceLoss | import torch
from torch import nn
import torch.jit
import torch.nn.functional
class BinaryDiceLoss(nn.Module):
def __init__(self, smooth=1, p=2, reduction='mean'):
super(BinaryDiceLoss, self).__init__()
self.smooth = smooth
self.p = p
self.reduction = reduction
def forward(se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.jit
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | MargeryLab/nnConRes | BinaryDiceLoss | false | 9,324 | [
"Apache-2.0"
] | 0 | a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 | https://github.com/MargeryLab/nnConRes/tree/a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 |
Conv3d | import torch
from torch import nn
import torch.jit
import torch.nn.functional as F
import torch.nn.functional
class Conv3d(nn.Conv3d):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1,
1), padding=(0, 0, 0), dilation=(1, 1, 1), groups=1, bias=False):
super(Conv3d, self).__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.... | MargeryLab/nnConRes | Conv3d | false | 9,325 | [
"Apache-2.0"
] | 0 | a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 | https://github.com/MargeryLab/nnConRes/tree/a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 |
tripletLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class tripletLoss(nn.Module):
def __init__(self, margin):
super(tripletLoss, self).__init__()
self.margin = margin
def forward(self, anchor, pos, neg):
distance_pos = (anchor - pos).pow(2).sum(1)
distance_neg ... | 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... | MingzheWu418/plastering | tripletLoss | false | 9,326 | [
"MIT"
] | 0 | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | https://github.com/MingzheWu418/plastering/tree/322531e934c3acf2ecc8f520b37a6d255b9959c2 |
softmaxtripletLoss | import torch
import torch.nn as nn
class softmaxtripletLoss(nn.Module):
def __init__(self):
super(softmaxtripletLoss, self).__init__()
self.relu = nn.ReLU()
def forward(self, anchor, pos, neg):
anchor.size(0)
d2pos = self.dist(anchor, pos)
d2neg = self.dist(anchor, ne... | 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... | MingzheWu418/plastering | softmaxtripletLoss | false | 9,327 | [
"MIT"
] | 0 | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | https://github.com/MingzheWu418/plastering/tree/322531e934c3acf2ecc8f520b37a6d255b9959c2 |
SelfAttentionWide | import torch
from torch import nn
import torch.nn.functional as F
def mask_(matrices, maskval=0.0, mask_diagonal=True):
"""
Masks out all values in the given batch of matrices where i <= j holds,
i < j if mask_diagonal is false
In place operation
:param tns:
:return:
"""
h, w = matri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Marcel-Busschers/former | SelfAttentionWide | false | 9,328 | [
"MIT"
] | 0 | 5380fad4c0890503188e01f9b2cbd06fdb33a7af | https://github.com/Marcel-Busschers/former/tree/5380fad4c0890503188e01f9b2cbd06fdb33a7af |
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 ... | MarkClemens301/OpenNRE | CNN | false | 9,329 | [
"MIT"
] | 0 | 14c0f77e5716814cba6d651088ec1f1e5d6f7d5c | https://github.com/MarkClemens301/OpenNRE/tree/14c0f77e5716814cba6d651088ec1f1e5d6f7d5c |
SuperPointNet | import torch
import torch.optim
import torch.utils.data
class SuperPointNet(torch.nn.Module):
""" Pytorch definition of SuperPoint Network. """
def __init__(self):
super(SuperPointNet, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.pool = torch.nn.MaxPool2d(kernel_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.... | KimSinjeong/SuperPoint_URP | SuperPointNet | false | 9,330 | [
"MIT"
] | 0 | 11e6203f6b651f1f32067e85058f8961b556f85c | https://github.com/KimSinjeong/SuperPoint_URP/tree/11e6203f6b651f1f32067e85058f8961b556f85c |
ForgetMult | import torch
from torch.optim import *
class ForgetMult(torch.nn.Module):
"""ForgetMult computes a simple recurrent equation:
h_t = f_t * x_t + (1 - f_t) * h_{t-1}
This equation is equivalent to dynamic weighted averaging.
Inputs: X, hidden
- X (seq_len, batch, input_size): tensor containing... | 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.optim import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empt... | MochizukiShinichi/NeuronBlocks | ForgetMult | false | 9,331 | [
"MIT"
] | 0 | ee15beb564b35900a179fe767745d031124273e9 | https://github.com/MochizukiShinichi/NeuronBlocks/tree/ee15beb564b35900a179fe767745d031124273e9 |
DiceLoss4BraTS | import torch
from torch import nn
import torch.jit
import torch.nn.functional
class BinaryDiceLoss(nn.Module):
def __init__(self, smooth=1, p=2, reduction='mean'):
super(BinaryDiceLoss, self).__init__()
self.smooth = smooth
self.p = p
self.reduction = reduction
def forward(se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.jit
import torch.nn.functional
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | MargeryLab/nnConRes | DiceLoss4BraTS | false | 9,332 | [
"Apache-2.0"
] | 0 | a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 | https://github.com/MargeryLab/nnConRes/tree/a5aba912d0f0f30490ae820fb6d3dbb8cf1556d4 |
LastLevelMaxPool | import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class LastLevelMaxPool(nn.Module):
def forward(self, x):
return [F.max_pool2d(x, 1, 2, 0)]
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | AmanKishore/maskrcnn-benchmark | LastLevelMaxPool | false | 9,333 | [
"MIT"
] | 0 | c95a00feaeba6fb4f9c3cd9a60bf1fdab98e696d | https://github.com/AmanKishore/maskrcnn-benchmark/tree/c95a00feaeba6fb4f9c3cd9a60bf1fdab98e696d |
SelfAttentionGPT2 | import torch
from torch import nn
def mask_(matrices, maskval=0.0, mask_diagonal=True):
"""
Masks out all values in the given batch of matrices where i <= j holds,
i < j if mask_diagonal is false
In place operation
:param tns:
:return:
"""
h, w = matrices.size(-2), matrices.size(-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.... | Marcel-Busschers/former | SelfAttentionGPT2 | false | 9,334 | [
"MIT"
] | 0 | 5380fad4c0890503188e01f9b2cbd06fdb33a7af | https://github.com/Marcel-Busschers/former/tree/5380fad4c0890503188e01f9b2cbd06fdb33a7af |
SelfAttention | import torch
import torch.nn as nn
from torch.nn import functional as F
def mask_fn(x, mask_diagonal=False):
_b, h, w = x.size()
indices = torch.triu_indices(h, w, offset=0 if mask_diagonal else 1)
mask = torch.zeros_like(x)
mask[:, indices[0], indices[1]] = 1
final_mask = (mask == 1) & (x == 0)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MukundhMurthy/viral-mutation | SelfAttention | false | 9,335 | [
"MIT"
] | 0 | 371422e418e8adc1ab9e68d2f09bd2f8aa5f00f0 | https://github.com/MukundhMurthy/viral-mutation/tree/371422e418e8adc1ab9e68d2f09bd2f8aa5f00f0 |
Head | import torch
import torch.nn as nn
class Conv(nn.Module):
def __init__(self, filters0, filters1, kernel_size, bn, bias=True):
super().__init__()
if bn:
bias = False
self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1,
padding=kernel_size // 2, bias=bias... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | IMOKURI/Hungry-Geese | Head | false | 9,336 | [
"MIT"
] | 0 | 5e770b3278452c2ba4006c18a43a16d572c636ac | https://github.com/IMOKURI/Hungry-Geese/tree/5e770b3278452c2ba4006c18a43a16d572c636ac |
Feedforward | import torch
class Feedforward(torch.nn.Module):
def __init__(self, input_size, hidden_size):
super(Feedforward, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.fc1 = torch.nn.Linear(self.input_size, self.hidden_size)
self.relu = 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
assert_size_stride = torch._C... | Orion34-lanbo/BladeDISC | Feedforward | false | 9,337 | [
"Apache-2.0"
] | 0 | 2310dfe6bd9e38bf28f4f4afd4189f30893c9249 | https://github.com/Orion34-lanbo/BladeDISC/tree/2310dfe6bd9e38bf28f4f4afd4189f30893c9249 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class Net(nn.Module):
def __init__(self, device):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=24, kernel_size=
5, padding=0)
self.conv2 = nn.Conv2d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | IW276/IW276SS21P16 | Net | false | 9,338 | [
"MIT"
] | 0 | b798a2747c2b25a5e33fd8bcda91d9c52b9c01fc | https://github.com/IW276/IW276SS21P16/tree/b798a2747c2b25a5e33fd8bcda91d9c52b9c01fc |
GatedLinearUnit | import torch
import torch.nn as nn
class GatedLinearUnit(nn.Module):
"""**The unit of gating operation that maps the input to the range of 0-1 and multiple original input through the
sigmoid function.**
"""
def __init__(self, input_size, hidden_layer_size, dropout_rate,
activation=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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | OneToolsCollection/4paradigm-AutoX | GatedLinearUnit | false | 9,339 | [
"Apache-2.0"
] | 0 | f8e838021354de17f5bb9bc44e9d68d12dda6427 | https://github.com/OneToolsCollection/4paradigm-AutoX/tree/f8e838021354de17f5bb9bc44e9d68d12dda6427 |
ConcatConv2d | import torch
import torch.nn as nn
class ConcatConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatConv2d, self).__init__()
module = nn.ConvTranspose2d if transpose else nn.Conv2d
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Lauu1023/torchdiffeq | ConcatConv2d | false | 9,340 | [
"MIT"
] | 0 | f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 | https://github.com/Lauu1023/torchdiffeq/tree/f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 |
ConstantODE | import torch
class ConstantODE(torch.nn.Module):
def __init__(self):
super(ConstantODE, self).__init__()
self.a = torch.nn.Parameter(torch.tensor(0.2))
self.b = torch.nn.Parameter(torch.tensor(3.0))
def forward(self, t, y):
return self.a + (y - (self.a * t + self.b)) ** 5
... | 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... | Lauu1023/torchdiffeq | ConstantODE | false | 9,341 | [
"MIT"
] | 0 | f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 | https://github.com/Lauu1023/torchdiffeq/tree/f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 |
SoftTargetCrossEntropy | import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftTargetCrossEntropy(nn.Module):
def __init__(self):
super(SoftTargetCrossEntropy, self).__init__()
def forward(self, x: 'torch.Tensor', target: 'torch.Tensor'
) ->torch.Tensor:
loss = torch.sum(-target * F.lo... | 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
... | Paddle-Team-7/PiT-Paddle-master | SoftTargetCrossEntropy | false | 9,342 | [
"Apache-2.0"
] | 0 | 125268471ca34be3161cce5364c728341c3711e0 | https://github.com/Paddle-Team-7/PiT-Paddle-master/tree/125268471ca34be3161cce5364c728341c3711e0 |
DilConv1dWithGLU | import torch
import torch.nn as nn
import torch.nn.functional as F
class DilConv1dWithGLU(nn.Module):
def __init__(self, num_channels, dilation, lenght=100, kernel_size=2,
activation=F.leaky_relu, residual_connection=True, dropout=0.2):
super(DilConv1dWithGLU, self).__init__()
self.dilati... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Napkin-DL/my-aws-example | DilConv1dWithGLU | false | 9,343 | [
"MIT-0"
] | 0 | c6e8a1ec60468938c259fcec7542c85f5464c898 | https://github.com/Napkin-DL/my-aws-example/tree/c6e8a1ec60468938c259fcec7542c85f5464c898 |
ResBlock | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ResBlock(nn.Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Lauu1023/torchdiffeq | ResBlock | false | 9,344 | [
"MIT"
] | 0 | f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 | https://github.com/Lauu1023/torchdiffeq/tree/f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 |
Return | import torch
import numpy as np
class Return(torch.nn.Module):
def __init__(self, discount_factor):
super().__init__()
assert 0 <= discount_factor < 1
self.coefficient = 1 / (1 - discount_factor)
self.min_reward = np.float32(-1)
self.max_reward = np.float32(1)
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
import numpy as np
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strid... | P-Schumacher/tonic | Return | false | 9,345 | [
"MIT"
] | 0 | 8d45a1668a3d60430bb36a7119947fc97d2690aa | https://github.com/P-Schumacher/tonic/tree/8d45a1668a3d60430bb36a7119947fc97d2690aa |
SubPixelConvolutionalBlock | import torch
from torch import nn
class SubPixelConvolutionalBlock(nn.Module):
"""
A subpixel convolutional block, comprising convolutional, pixel-shuffle, and PReLU activation layers.
"""
def __init__(self, kernel_size=3, n_channels=64, scaling_factor=2):
"""
:param kernel_size: kern... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | Louis-Navarro/a-PyTorch-Tutorial-to-Super-Resolution | SubPixelConvolutionalBlock | false | 9,346 | [
"MIT"
] | 0 | 93fc7cf878db04ee8610e61cfc586271ce10aa45 | https://github.com/Louis-Navarro/a-PyTorch-Tutorial-to-Super-Resolution/tree/93fc7cf878db04ee8610e61cfc586271ce10aa45 |
TransitionUp | import torch
import torch.utils.data
import torch
import torch.nn as nn
def center_crop(layer, max_height, max_width):
_, _, h, w = layer.size()
xy1 = (w - max_width) // 2
xy2 = (h - max_height) // 2
return layer[:, :, xy2:xy2 + max_height, xy1:xy1 + max_width]
class TransitionUp(nn.Module):
de... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = ... | KshingWang/LesionSeg | TransitionUp | false | 9,347 | [
"BSD-3-Clause"
] | 0 | a3c38aa7481eb7ce6a3b0fe5f9c4b349b8cf0b19 | https://github.com/KshingWang/LesionSeg/tree/a3c38aa7481eb7ce6a3b0fe5f9c4b349b8cf0b19 |
QRNNLayer | import torch
import torch.nn as nn
from torch.optim import *
class ForgetMult(torch.nn.Module):
"""ForgetMult computes a simple recurrent equation:
h_t = f_t * x_t + (1 - f_t) * h_{t-1}
This equation is equivalent to dynamic weighted averaging.
Inputs: X, hidden
- X (seq_len, batch, input_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | MochizukiShinichi/NeuronBlocks | QRNNLayer | false | 9,348 | [
"MIT"
] | 0 | ee15beb564b35900a179fe767745d031124273e9 | https://github.com/MochizukiShinichi/NeuronBlocks/tree/ee15beb564b35900a179fe767745d031124273e9 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, pred, target):
"""Cacluate dice loss
Parameters
----------
pred:
predictions from the model
targe... | 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... | MarouaJaoua/cells-nuclei-segmentation | DiceLoss | false | 9,349 | [
"MIT"
] | 0 | 09d65db104a7297ec6f4c975b668bb7ca93c7372 | https://github.com/MarouaJaoua/cells-nuclei-segmentation/tree/09d65db104a7297ec6f4c975b668bb7ca93c7372 |
TransformerEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn import Dropout
from torch.nn import LayerNorm
from typing import Optional
import torch.utils.data
from typing import Tuple
class InProjContainer(torch.nn.Module):
def __init__(self, query_proj, key_proj, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MauiDesign/PyTorchText | TransformerEncoderLayer | false | 9,350 | [
"BSD-3-Clause"
] | 0 | 324c072d55a49bf94da312bc6be893beec3a8bd9 | https://github.com/MauiDesign/PyTorchText/tree/324c072d55a49bf94da312bc6be893beec3a8bd9 |
SineODE | import math
import torch
class SineODE(torch.nn.Module):
def forward(self, t, y):
return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3
def y_exact(self, t):
return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * t ** 3 * torch.sin(
2 * t) + 0.25 * t ** 2 * torch.cos(2 * t)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | Lauu1023/torchdiffeq | SineODE | false | 9,351 | [
"MIT"
] | 0 | f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 | https://github.com/Lauu1023/torchdiffeq/tree/f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 |
AbsLayer | from torch.nn import Module
import torch
from torch import Tensor
from torch.nn.modules import Module
import torch.optim.lr_scheduler
class AbsLayer(Module):
def forward(self, x: 'Tensor') ->Tensor:
return torch.abs(x).reshape((-1, 1))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_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.triton_helpers import math as tl_math
from torch.nn import Module
from torch.nn.modules import Module
import to... | Mathieu4141/avalanche | AbsLayer | false | 9,352 | [
"MIT"
] | 0 | 09c922459edcf90441abb6912a73e351dcbd8b49 | https://github.com/Mathieu4141/avalanche/tree/09c922459edcf90441abb6912a73e351dcbd8b49 |
Swish | import torch
import torch.nn as nn
class Swish(nn.Module):
def forward(self, x):
return x.mul_(torch.sigmoid(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_mul_sigmoid_0(in_pt... | Nigel233/Different-Backbones-for-YOLO-v3 | Swish | false | 9,353 | [
"MIT"
] | 0 | 030e7860e966b079afc9b53a320a41f3eb7950be | https://github.com/Nigel233/Different-Backbones-for-YOLO-v3/tree/030e7860e966b079afc9b53a320a41f3eb7950be |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, latent_dim=4, obs_dim=2, nhidden=20):
super(Decoder, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.fc1 = nn.Linear(latent_dim, nhidden)
self.fc2 = nn.Linear(nhidden, obs_dim)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Lauu1023/torchdiffeq | Decoder | false | 9,354 | [
"MIT"
] | 0 | f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 | https://github.com/Lauu1023/torchdiffeq/tree/f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 |
Mish | import torch
import torch.nn.functional as F
import torch.nn as nn
class Mish(nn.Module):
def forward(self, x):
return x.mul_(F.softplus(x).tanh())
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | Nigel233/Different-Backbones-for-YOLO-v3 | Mish | false | 9,355 | [
"MIT"
] | 0 | 030e7860e966b079afc9b53a320a41f3eb7950be | https://github.com/Nigel233/Different-Backbones-for-YOLO-v3/tree/030e7860e966b079afc9b53a320a41f3eb7950be |
ODEfunc | import torch
import torch.nn as nn
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ConcatConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatConv2d, self).__init__()
module = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Lauu1023/torchdiffeq | ODEfunc | false | 9,356 | [
"MIT"
] | 0 | f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 | https://github.com/Lauu1023/torchdiffeq/tree/f4f3184a4c1b657da959c7d15bc8f727f1c25bd8 |
AvgPool2d | from torch.nn import Module
import torch
import torch as th
class AvgPool2d(Module):
"""
This class is the beginning of an exact python port of the torch.nn.AvgPool2d
module. Because PySyft cannot hook into layers which are implemented in C++,
our special functionalities (such as encrypted computation... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._em... | Prince326/PySyft | AvgPool2d | false | 9,357 | [
"Apache-2.0"
] | 0 | c7167680e9020853c353a2a725ff79f3df2bef05 | https://github.com/Prince326/PySyft/tree/c7167680e9020853c353a2a725ff79f3df2bef05 |
CoordConv | import torch
import torch.nn as nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Args:
input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | NguyenTheAn/AdaptiveWingLoss | CoordConv | false | 9,358 | [
"Apache-2.0"
] | 0 | abaade9521c1382739a158f3ad5ce493948add1d | https://github.com/NguyenTheAn/AdaptiveWingLoss/tree/abaade9521c1382739a158f3ad5ce493948add1d |
Anchor3DHead | import torch
import numpy as np
import torch.nn as nn
import torch.utils.dlpack
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e-06):
"""Calculate overlap between two set of bboxes.
If ``is_aligned `` is ``False``, then calculate the overlaps between each
bbox of bboxes1 and bboxe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
import torch.utils.dlpack
assert_size_s... | Jaein94/Open3D-ML | Anchor3DHead | false | 9,359 | [
"MIT"
] | 0 | 815c111229322d562e11ea3148ad6568ccf13d1d | https://github.com/Jaein94/Open3D-ML/tree/815c111229322d562e11ea3148ad6568ccf13d1d |
weightedFeatureFusion | import torch
import torch.nn as nn
class weightedFeatureFusion(nn.Module):
def __init__(self, layers, weight=False):
super(weightedFeatureFusion, self).__init__()
self.layers = layers
self.weight = weight
self.n = len(layers) + 1
if weight:
self.w = torch.nn.Pa... | 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... | Nigel233/Different-Backbones-for-YOLO-v3 | weightedFeatureFusion | false | 9,360 | [
"MIT"
] | 0 | 030e7860e966b079afc9b53a320a41f3eb7950be | https://github.com/Nigel233/Different-Backbones-for-YOLO-v3/tree/030e7860e966b079afc9b53a320a41f3eb7950be |
MLP_HD | import torch
import torch.nn as nn
class MLP_HD(nn.Module):
def __init__(self, dim_in, dim_hidden, dim_out):
super(MLP_HD, self).__init__()
self.layer_input = nn.Linear(dim_in, dim_hidden)
self.relu = nn.ReLU()
self.dropout = nn.Dropout()
self.layer_hidden = nn.Linear(dim_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | NaiboWang/HFL-CS6203-NaiboShiqi | MLP_HD | false | 9,361 | [
"MIT"
] | 0 | 4bab35a20f1ec1229b0011c952d93c341579c402 | https://github.com/NaiboWang/HFL-CS6203-NaiboShiqi/tree/4bab35a20f1ec1229b0011c952d93c341579c402 |
AddCoords | import torch
import torch.nn as nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Args:
input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_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... | NguyenTheAn/AdaptiveWingLoss | AddCoords | false | 9,362 | [
"Apache-2.0"
] | 0 | abaade9521c1382739a158f3ad5ce493948add1d | https://github.com/NguyenTheAn/AdaptiveWingLoss/tree/abaade9521c1382739a158f3ad5ce493948add1d |
BasicBlock | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, strd=1, padding=1, bias=False, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=strd,
padding=padding, bias=bias, dilation=dilation)
class BasicBlock(nn.Module):
exp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | NguyenTheAn/AdaptiveWingLoss | BasicBlock | false | 9,363 | [
"Apache-2.0"
] | 0 | abaade9521c1382739a158f3ad5ce493948add1d | https://github.com/NguyenTheAn/AdaptiveWingLoss/tree/abaade9521c1382739a158f3ad5ce493948add1d |
Normalization | import torch
from torch import nn
from torch import stack
class Normalization(nn.Module):
def __init__(self, S_low, S_up, a_low, a_up, **kwargs):
super(Normalization, self).__init__(**kwargs)
self.low_bound_S = S_low
self.upper_bound_S = S_up
self.low_bound_a = a_low
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | PML-UCF/2020_pinn_educational | Normalization | false | 9,364 | [
"MIT"
] | 0 | 20322167ef802fb6926d846d14dfed2ddd10d940 | https://github.com/PML-UCF/2020_pinn_educational/tree/20322167ef802fb6926d846d14dfed2ddd10d940 |
SeparableConvolutionLayer | import torch
class SeparableConvolutionLayer(torch.nn.Module):
"""Depthwise separable convolution layer implementation."""
def __init__(self, nin, nout, kernel_size=3):
super(SeparableConvolutionLayer, self).__init__()
self.depthwise = torch.nn.Conv2d(nin, nin, kernel_size=kernel_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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
de... | NileshPranami/Emotion-age-and-ethnicity-Estimation | SeparableConvolutionLayer | false | 9,365 | [
"MIT"
] | 0 | 2631470899e55956252e2ef84f4f590eede27090 | https://github.com/NileshPranami/Emotion-age-and-ethnicity-Estimation/tree/2631470899e55956252e2ef84f4f590eede27090 |
InstanceNorm | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class InstanceNorm(Module):
"""
## Instance Normalization Layer
Instance normalization layer $\\text{IN}$ normalizes the input $X$ as follows:
When input $X \\in \\m... | 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 import nn
import torch.utils.data
import... | Hadryan/nn | InstanceNorm | false | 9,366 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
bodypose_model | import torch
import torch.nn as nn
from collections import OrderedDict
def make_layers(block, no_relu_layers):
layers = []
for layer_name, v in block.items():
if 'pool' in layer_name:
layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2])
layers.append((layer_name, 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
from co... | KamaljeetSahoo/6thSense | bodypose_model | false | 9,367 | [
"Unlicense",
"MIT"
] | 0 | db1f2cd2bb7858410c128a6d11cfbdf8ea69e691 | https://github.com/KamaljeetSahoo/6thSense/tree/db1f2cd2bb7858410c128a6d11cfbdf8ea69e691 |
Smooth | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Smooth(nn.Module):
"""
<a id="smooth"></a>
### Smoothing Layer
This layer blurs each channel
"""
def __init__(self):
super().__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 import nn
import torch.utils.data
import torch.nn.functional
import t... | Hadryan/nn | Smooth | false | 9,368 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
Dunet_2levels | import torch
import torch.nn as nn
class Unet_2levels(nn.Module):
def __init__(self):
super().__init__()
self.relu = nn.ReLU()
self.sigmoid = nn.Sigmoid()
self.upsample = nn.Upsample(scale_factor=2, mode='bilinear',
align_corners=True)
self.maxpool = nn.MaxPool... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | MuhammadIbrahim0/dvae-refiner | Dunet_2levels | false | 9,369 | [
"MIT"
] | 0 | 034241ce6a5aeb19e9f8952ee996b56412a1f95a | https://github.com/MuhammadIbrahim0/dvae-refiner/tree/034241ce6a5aeb19e9f8952ee996b56412a1f95a |
VariableSelectionNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class GatedLinearUnit(nn.Module):
"""**The unit of gating operation that maps the input to the range of 0-1 and multiple original input through the
sigmoid function.**
"""
def __init__(self, input_size, hidden_layer_size, dropout_rat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | OneToolsCollection/4paradigm-AutoX | VariableSelectionNetwork | false | 9,370 | [
"Apache-2.0"
] | 0 | f8e838021354de17f5bb9bc44e9d68d12dda6427 | https://github.com/OneToolsCollection/4paradigm-AutoX/tree/f8e838021354de17f5bb9bc44e9d68d12dda6427 |
SequenceClassifier | import torch
from collections import OrderedDict
import torch.nn as nn
class SequenceClassifier(nn.Module):
"""
Given a sequence of image vectors, intelligently weight the importance of each member
of the sequence and use it to predict presence/absence of a class.
"""
def __init__(self, s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from collections import Order... | NaimKabir/hakuna-madata | SequenceClassifier | false | 9,371 | [
"MIT"
] | 0 | b7672fe8e50267adf9d3c65cc31c268364133e9c | https://github.com/NaimKabir/hakuna-madata/tree/b7672fe8e50267adf9d3c65cc31c268364133e9c |
Conv2d | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
def weight_standardization(weight: 'torch.Tensor', eps: 'float'):
"""
## Weight Standardization
$$\\hat{W}_{i,j} = \\frac{W_{i,j} - \\mu_{W_{i,\\cdot}}} {\\sigma_{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.triton_helpers import libdevice
from torch import n... | Hadryan/nn | Conv2d | false | 9,372 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
Unet_2levels | import torch
import torch.nn as nn
class Unet_2levels(nn.Module):
def __init__(self):
super().__init__()
self.relu = nn.ReLU()
self.sigmoid = nn.Sigmoid()
self.upsample = nn.Upsample(scale_factor=2, mode='bilinear',
align_corners=True)
self.maxpool = nn.MaxPool... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | MuhammadIbrahim0/dvae-refiner | Unet_2levels | false | 9,373 | [
"MIT"
] | 0 | 034241ce6a5aeb19e9f8952ee996b56412a1f95a | https://github.com/MuhammadIbrahim0/dvae-refiner/tree/034241ce6a5aeb19e9f8952ee996b56412a1f95a |
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.... | PumpkinYing/GAT | GAT | false | 9,374 | [
"MIT"
] | 0 | 723a20fcd9f915123d46ef4ef03eeadb6910635a | https://github.com/PumpkinYing/GAT/tree/723a20fcd9f915123d46ef4ef03eeadb6910635a |
MiniBatchStdDev | import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class MiniBatchStdDev(nn.Module):
"""
<a id="mini_batch_std_dev"></a>
### Mini-batch Standard Deviation
Mini-batch standard deviation calculates the standard deviation
across a mini-batch (... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import torch.utils.data
import torch.nn.functional
import ... | Hadryan/nn | MiniBatchStdDev | false | 9,375 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
EqualizedLinear | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 numpy as np
from torch import nn
import torch.utils.data
impo... | Hadryan/nn | EqualizedLinear | false | 9,376 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
Conv1dCompression | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Conv1dCompression(Module):
"""
## 1D Convolution Compression $f_c$
This is a simple wrapper around
[`nn.Conv1d`](https://pytorch.org/docs/stable/generated/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.nn import Module
from torch import nn
import torch.utils.data
import ... | Hadryan/nn | Conv1dCompression | false | 9,377 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
SpacialGatingUnit | import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
from typing import Optional
import torch.autograd
class SpacialGatingUnit(nn.Module):
"""
## Spatial Gating Unit
$$s(Z) = Z_1 \\odot f_{W,b}(Z_2)$$
where $f_{W,b}(Z) = W Z + b$ is a linear transformation along the 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
from torch import n... | Hadryan/nn | SpacialGatingUnit | false | 9,378 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
DownSample | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Smooth(nn.Module):
"""
<a id="smooth"></a>
### Smoothing Layer
This layer blurs each channel
"""
def __init__(self):
super().__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 import nn
import t... | Hadryan/nn | DownSample | false | 9,379 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
ToRGB | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 numpy as np
from torch import nn
import torch.nn.functional a... | Hadryan/nn | ToRGB | false | 9,380 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=3)
self.conv2 = nn.Conv2d(10, 20, kernel_size=4)
self.conv3 = nn.Conv2d(20, 20, kernel_size=2)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Prabhu204/MNISTdata | Net | false | 9,381 | [
"MIT"
] | 0 | 1ab3be23a0cec8caacd4adec6cd3c413639a62cc | https://github.com/Prabhu204/MNISTdata/tree/1ab3be23a0cec8caacd4adec6cd3c413639a62cc |
RefTanhModule | import torch
class RefTanhModule(torch.nn.Module):
def forward(self, input):
return torch.tanh(input)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | RaulMurillo/QPyTorch | RefTanhModule | false | 9,382 | [
"MIT"
] | 0 | b34c3a232ffdf387485b8a7e119a3729d066d5df | https://github.com/RaulMurillo/QPyTorch/tree/b34c3a232ffdf387485b8a7e119a3729d066d5df |
Envelope | import torch
import torch.utils.data
class Envelope(torch.nn.Module):
def __init__(self, exponent):
super(Envelope, self).__init__()
self.p = exponent + 1
self.a = -(self.p + 1) * (self.p + 2) / 2
self.b = self.p * (self.p + 2)
self.c = -self.p * (self.p + 1) / 2
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | MINATILO/pytroch-geometric | Envelope | false | 9,383 | [
"MIT"
] | 0 | 706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 | https://github.com/MINATILO/pytroch-geometric/tree/706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 |
UpSample | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Smooth(nn.Module):
"""
<a id="smooth"></a>
### Smoothing Layer
This layer blurs each channel
"""
def __init__(self):
super().__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 import nn
import t... | Hadryan/nn | UpSample | false | 9,384 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
PreNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class PreNet(nn.Module):
def __init__(self, in_dims, fc1_dims=256, fc2_dims=128, dropout=0.5):
super().__init__()
self.fc1 = nn.Linear(in_dims, fc1_dims)
self.fc2 = nn.Linear(fc1_dims, fc2_dims)
self.p = dropout
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | NarutoUA/WaveRNN | PreNet | false | 9,385 | [
"MIT"
] | 0 | ed80c3f092b9c086d42af51a7f2545727ed1610c | https://github.com/NarutoUA/WaveRNN/tree/ed80c3f092b9c086d42af51a7f2545727ed1610c |
GroupNorm | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class GroupNorm(Module):
"""
## Group Normalization Layer
"""
def __init__(self, groups: 'int', channels: 'int', *, eps: float=1e-05,
affine: bool=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
from torch.nn import Module
from torch import nn
import torch.utils.data
import... | Hadryan/nn | GroupNorm | false | 9,386 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
ToyNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ToyNet(nn.Module):
def __init__(self):
super(ToyNet, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.conv3 = nn.Conv2d(16, 64, 3)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | LokeshBonta/MIVisionX | ToyNet | false | 9,387 | [
"MIT"
] | 0 | 980d4254b8a1b50e09cc19d41f3cbf362f8a93db | https://github.com/LokeshBonta/MIVisionX/tree/980d4254b8a1b50e09cc19d41f3cbf362f8a93db |
EqualizedWeight | import math
import torch
import numpy as np
from torch import nn
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter
This is based on equalized... | 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
import numpy as np
from torch import nn
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.... | Hadryan/nn | EqualizedWeight | false | 9,388 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
StyleBlock | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
from typing import Optional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | Hadryan/nn | StyleBlock | false | 9,389 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
decoder5 | import torch
import torch.nn as nn
class decoder5(nn.Module):
def __init__(self, d=None):
super(decoder5, self).__init__()
self.reflecPad15 = nn.ReflectionPad2d((1, 1, 1, 1))
self.conv15 = nn.Conv2d(512, 512, 3, 1, 0)
if d:
self.conv15.weight = torch.nn.Parameter(d.get... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MingSun-Tse/PytorchWCT | decoder5 | false | 9,390 | [
"MIT"
] | 0 | 9d11cc0995c0610c129b78ff5f72a26f4d60e10a | https://github.com/MingSun-Tse/PytorchWCT/tree/9d11cc0995c0610c129b78ff5f72a26f4d60e10a |
InnerProductDecoder | import torch
import torch.utils.data
class InnerProductDecoder(torch.nn.Module):
"""The inner product decoder from the `"Variational Graph Auto-Encoders"
<https://arxiv.org/abs/1611.07308>`_ paper
.. math::
\\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top})
where :math:`\\mathbf{Z} \\in \\mathbb{R}^{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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | MINATILO/pytroch-geometric | InnerProductDecoder | false | 9,391 | [
"MIT"
] | 0 | 706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 | https://github.com/MINATILO/pytroch-geometric/tree/706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 |
IdentityMessage | import torch
import torch.utils.data
class IdentityMessage(torch.nn.Module):
def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'):
super(IdentityMessage, self).__init__()
self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim
def forward(self, z_src, z_dst, raw_msg... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | MINATILO/pytroch-geometric | IdentityMessage | false | 9,392 | [
"MIT"
] | 0 | 706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 | https://github.com/MINATILO/pytroch-geometric/tree/706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 |
ResidualDenseBlock_5C | import torch
import torch.nn as nn
class ResidualDenseBlock_5C(nn.Module):
def __init__(self, nf=64, gc=32, bias=True):
super(ResidualDenseBlock_5C, self).__init__()
self.conv1 = nn.Conv2d(nf, gc, 3, 1, 1, bias=bias)
self.conv2 = nn.Conv2d(nf + gc, gc, 3, 1, 1, bias=bias)
self.con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | PVjammer/ESRGAN | ResidualDenseBlock_5C | false | 9,393 | [
"Apache-2.0"
] | 0 | a37fda8d4efe58eff4dc0ce1cffd8ee4051a7871 | https://github.com/PVjammer/ESRGAN/tree/a37fda8d4efe58eff4dc0ce1cffd8ee4051a7871 |
TFSamepaddingLayer | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class TFSamepaddingLayer(nn.Module):
"""To align with tf `same` padding.
Putting this before any conv layer that need padding
Assuming kernel has Height == Width for simplicity
"""
def __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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | Pacific89/hover_net | TFSamepaddingLayer | false | 9,394 | [
"MIT"
] | 0 | 37abc6c036e45a0f6a7248573ad58e811bfdecc1 | https://github.com/Pacific89/hover_net/tree/37abc6c036e45a0f6a7248573ad58e811bfdecc1 |
ShiftedSoftplus | import torch
import torch.nn.functional as F
import torch.utils.data
class ShiftedSoftplus(torch.nn.Module):
def __init__(self):
super(ShiftedSoftplus, self).__init__()
self.shift = torch.log(torch.tensor(2.0)).item()
def forward(self, x):
return F.softplus(x) - self.shift
def get_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.utils.data
assert_size_stride = torch._C._dynamo.... | MINATILO/pytroch-geometric | ShiftedSoftplus | false | 9,395 | [
"MIT"
] | 0 | 706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 | https://github.com/MINATILO/pytroch-geometric/tree/706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 |
InstanceNormLayer | import torch
import torch.nn as nn
class InstanceNormLayer(nn.Module):
"""Implements instance normalization layer."""
def __init__(self, epsilon=1e-08):
super().__init__()
self.epsilon = 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
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AsianZeus/Diverse-Facial-Edit | InstanceNormLayer | false | 9,396 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
ScaledDotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, scale=None, attn_dropout=0.1):
super().__init__()
self.scale = scale
self.dropout = nn.Dropout(attn_dropout)
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.... | PINE4PPLE/transformer-lm | ScaledDotProductAttention | false | 9,397 | [
"MIT"
] | 0 | da76a4afd29d1fd023ba866ccc21a49901ad46f2 | https://github.com/PINE4PPLE/transformer-lm/tree/da76a4afd29d1fd023ba866ccc21a49901ad46f2 |
ScaledLeakyReLU | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledLeakyReLU(nn.Module):
def __init__(self, negative_slope=0.2):
super().__init__()
self.negative_slope = negative_slope
def forward(self, input):
out = F.leaky_relu(input, negative_slope=self.neg... | 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... | AsianZeus/Diverse-Facial-Edit | ScaledLeakyReLU | false | 9,398 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
PixelNormLayer | import torch
import torch.nn as nn
class PixelNormLayer(nn.Module):
"""Implements pixel-wise feature vector normalization layer."""
def __init__(self, epsilon=1e-08):
super().__init__()
self.epsilon = epsilon
def forward(self, x):
return x / torch.sqrt(torch.mean(x ** 2, dim=1, k... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AsianZeus/Diverse-Facial-Edit | PixelNormLayer | false | 9,399 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
HighwayNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class HighwayNetwork(nn.Module):
def __init__(self, size):
super().__init__()
self.W1 = nn.Linear(size, size)
self.W2 = nn.Linear(size, size)
self.W1.bias.data.fill_(0.0)
def forward(self, x):
x1 = sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | NarutoUA/WaveRNN | HighwayNetwork | false | 9,400 | [
"MIT"
] | 0 | ed80c3f092b9c086d42af51a7f2545727ed1610c | https://github.com/NarutoUA/WaveRNN/tree/ed80c3f092b9c086d42af51a7f2545727ed1610c |
PixelNorm | import torch
import torch.nn as nn
class PixelNorm(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim=
True) + 1e-08)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AsianZeus/Diverse-Facial-Edit | PixelNorm | false | 9,401 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
SelfAttentive | import torch
import torch.nn as nn
class SelfAttentive(nn.Module):
def __init__(self, hidden_size, att_hops=1, att_unit=200, dropout=0.2):
super(SelfAttentive, self).__init__()
self.drop = nn.Dropout(dropout)
self.ws1 = nn.Linear(hidden_size, att_unit, bias=False)
self.ws2 = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | OLUWAMUYIWA/sent_analysis | SelfAttentive | false | 9,402 | [
"MIT"
] | 0 | 16334d9f5f2bad1135763c6e8cbe3d7272237d73 | https://github.com/OLUWAMUYIWA/sent_analysis/tree/16334d9f5f2bad1135763c6e8cbe3d7272237d73 |
EqualConv2d | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class EqualConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_channel, 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
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | AsianZeus/Diverse-Facial-Edit | EqualConv2d | false | 9,403 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
ResolutionScalingLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResolutionScalingLayer(nn.Module):
"""Implements the resolution scaling layer.
Basically, this layer can be used to upsample or downsample feature maps from
spatial domain with nearest neighbor interpolation.
"""
def __init__(sel... | 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... | AsianZeus/Diverse-Facial-Edit | ResolutionScalingLayer | false | 9,404 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
Downsample | import torch
import torch.nn as nn
class Downsample(nn.Module):
def __init__(self, nIn, nOut, stride):
super(Downsample, self).__init__()
self.avg = nn.AvgPool2d(stride)
assert nOut % nIn == 0
self.expand_ratio = nOut // nIn
def forward(self, x):
x = self.avg(x)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Richard456/TRADES | Downsample | false | 9,405 | [
"MIT"
] | 0 | 6093dbd92ca548cc1b98306e168842982b281140 | https://github.com/Richard456/TRADES/tree/6093dbd92ca548cc1b98306e168842982b281140 |
NoiseInjection | import torch
import torch.nn as nn
class NoiseInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, noise=None):
if noise is None:
batch, _, height, width = image.shape
noise = image.ne... | 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... | AsianZeus/Diverse-Facial-Edit | NoiseInjection | false | 9,406 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
TVLoss | import torch
from torch import nn
import torch.utils.data
class TVLoss(nn.Module):
def __init__(self, tv_loss_weight=1):
super(TVLoss, self).__init__()
self.tv_loss_weight = tv_loss_weight
def forward(self, x):
batch_size = x.size()[0]
h_x = x.size()[2]
w_x = 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
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | Prajwal564/SRGAN | TVLoss | false | 9,407 | [
"MIT"
] | 0 | 198b86b0cec4d68737f26b190e4ab04887be4ac3 | https://github.com/Prajwal564/SRGAN/tree/198b86b0cec4d68737f26b190e4ab04887be4ac3 |
SqueezeExcitation | import torch
from torch import Tensor
import torch.nn as nn
from torch.nn import functional as F
class SqueezeExcitation(nn.Module):
def __init__(self, input_c: 'int', expand_c: 'int', squeeze_factor: 'int'=4
):
super(SqueezeExcitation, self).__init__()
squeeze_c = input_c // squeeze_fact... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | NephrenCake/FlameRecognition | SqueezeExcitation | false | 9,408 | [
"MIT"
] | 0 | 3075a345b51c2c855a5cb2decd839065230e1484 | https://github.com/NephrenCake/FlameRecognition/tree/3075a345b51c2c855a5cb2decd839065230e1484 |
EqualLinear | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
class FusedLeakyReLUFunctionBackward(Function):
@... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
import torch.nn as nn
assert_siz... | AsianZeus/Diverse-Facial-Edit | EqualLinear | false | 9,409 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
def __init__(self, state_size, action_size, seed, num_layers=1,
hidden_size=64):
"""
Initialize parameters and build model.
parameters:
state_size : (int) Dimension of each 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
assert_... | RevanMacQueen/DRQN | QNetwork | false | 9,410 | [
"MIT"
] | 0 | 7b8a743935679f65817ad4f41d28c2c155e7a62a | https://github.com/RevanMacQueen/DRQN/tree/7b8a743935679f65817ad4f41d28c2c155e7a62a |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=128,
fc2_units=64):
"""Initialize parameters and build model.
Params
======
state_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
assert_... | ReactiveXYZ-Dev/deep-reinforcement-learning | QNetwork | false | 9,411 | [
"MIT"
] | 0 | 074318b2a73f61d7fee7e0374c739447ee45b6a0 | https://github.com/ReactiveXYZ-Dev/deep-reinforcement-learning/tree/074318b2a73f61d7fee7e0374c739447ee45b6a0 |
GeneratorBlock | import math
import torch
import numpy as np
from torch import nn
from typing import Tuple
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
from typing import Optional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight">... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | Hadryan/nn | GeneratorBlock | false | 9,412 | [
"MIT"
] | 0 | b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d | https://github.com/Hadryan/nn/tree/b10e3dea2c7e1f6569bfdf8e1a48f8d48b5a645d |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
"""
Loss function from https://arxiv.org/abs/1707.03237,
where iou computation is introduced heatmap manner to measure the
diversity bwtween tow heatmaps.
"""
def __init__(self, eps=1e-06):
super(DiceLoss, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | LDOUBLEV/DBNet.pytorch | DiceLoss | false | 9,413 | [
"Apache-2.0"
] | 0 | 206f4a1e5cc3686284476f029a26fc69f610e898 | https://github.com/LDOUBLEV/DBNet.pytorch/tree/206f4a1e5cc3686284476f029a26fc69f610e898 |
Attention | import math
import torch
import torch.nn.functional as F
import torch.utils.data
def restricted_softmax(src, dim: 'int'=-1, margin: 'float'=0.0):
src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0.0)
out = (src - src_max).exp()
out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).e... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MINATILO/pytroch-geometric | Attention | false | 9,414 | [
"MIT"
] | 0 | 706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 | https://github.com/MINATILO/pytroch-geometric/tree/706aba3b4a6477a83a1fb73eb3cf0ee9661b70e4 |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
def make_kernel(k):
k = torch.tensor(k, dtype=torc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.autograd... | AsianZeus/Diverse-Facial-Edit | ModulatedConv2d | false | 9,415 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
SEModule | from torch.nn import Module
import torch
from torch.nn import Conv2d
from torch.nn import ReLU
from torch.nn import Sigmoid
from torch.nn import AdaptiveAvgPool2d
class SEModule(Module):
def __init__(self, channels, reduction):
super(SEModule, self).__init__()
self.avg_pool = AdaptiveAvgPool2d(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.nn import Module
f... | AsianZeus/Diverse-Facial-Edit | SEModule | false | 9,416 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
HSwish | import torch
from torch import nn
import torch.nn.functional as F
class HSwish(nn.Module):
def forward(self, x):
out = x * F.relu6(x + 3, inplace=True) / 6
return out
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | LDOUBLEV/DBNet.pytorch | HSwish | false | 9,417 | [
"Apache-2.0"
] | 0 | 206f4a1e5cc3686284476f029a26fc69f610e898 | https://github.com/LDOUBLEV/DBNet.pytorch/tree/206f4a1e5cc3686284476f029a26fc69f610e898 |
ReluLayer | import torch
import torch.nn as nn
from torchvision.models._utils import IntermediateLayerGetter as IntermediateLayerGetter
from itertools import product as product
class ReluLayer(nn.Module):
"""Relu Layer.
Args:
relu type: type of relu layer, candidates are
- ReLU
- LeakyReL... | 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
from torchvision.models._utils import IntermediateLayerGetter as In... | Cospel/facexlib | ReluLayer | false | 9,418 | [
"MIT"
] | 0 | 2471ddb44b1d61306c6d7fcf56846b9e4aeea4aa | https://github.com/Cospel/facexlib/tree/2471ddb44b1d61306c6d7fcf56846b9e4aeea4aa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.