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 |
|---|---|---|---|---|---|---|---|---|---|---|
SFT_torch | import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.transforms import *
class SFT_torch(nn.Module):
def __init__(self, sigma=0.1, *args, **kwargs):
super(SFT_torch, self).__init__(*args, **kwargs)
self.sigma = sigma
def forward(self, emb_org):
emb_org_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CoinCheung/SFT-ReID | SFT_torch | false | 8,186 | [
"MIT"
] | 22 | 2df67554732393df5a231b7281e12fc3435f1e8c | https://github.com/CoinCheung/SFT-ReID/tree/2df67554732393df5a231b7281e12fc3435f1e8c |
ConvShuffle | import torch
from torch import nn
class ConvShuffle(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, padding=
'same', upscale_factor=2, padding_mode='zeros'):
super(ConvShuffle, self).__init__()
self.upscale_factor = upscale_factor
self.conv = nn.Conv2d(in_ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | GerbenBeintema/deepSI | ConvShuffle | false | 8,187 | [
"BSD-3-Clause"
] | 12 | 580711210398064bb7f01e41d08b7a248a88b35b | https://github.com/GerbenBeintema/deepSI/tree/580711210398064bb7f01e41d08b7a248a88b35b |
MlpNet | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class MlpNet(nn.Module):
"""Implements a simple fully connected mlp network."""
def __init__(self, sa_dim, n_agents, hidden_size, agent_id=0,
agent_shuffle='none'):
super(MlpNet, self).__init__()
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_... | HAXRD/PIC | MlpNet | false | 8,188 | [
"MIT"
] | 28 | 658b4dd6b01e64413d5f8f0107d9167f1bd78546 | https://github.com/HAXRD/PIC/tree/658b4dd6b01e64413d5f8f0107d9167f1bd78546 |
MeanMaxPooling | import torch
from torch import nn
class MeanMaxPooling(nn.Module):
def __init__(self):
super(MeanMaxPooling, self).__init__()
def forward(self, doc_state, entity_mapping, entity_lens):
"""
:param doc_state: N x L x d
:param entity_mapping: N x E x L
:param entity_le... | 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... | HLTCHKUST/MulQG | MeanMaxPooling | false | 8,189 | [
"MIT"
] | 19 | 8e257f2d6c0f03c07ea8a0bf0e8f55b0cde60605 | https://github.com/HLTCHKUST/MulQG/tree/8e257f2d6c0f03c07ea8a0bf0e8f55b0cde60605 |
DownsampleA | import torch
import torch.nn as nn
import torch.utils.data.distributed
class DownsampleA(nn.Module):
def __init__(self, nIn, nOut, stride):
super(DownsampleA, self).__init__()
assert stride == 2
self.avg = nn.AvgPool2d(kernel_size=1, stride=stride)
def forward(self, x):
x = s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda... | HKBU-HPML/gtopkssgd | DownsampleA | false | 8,190 | [
"Apache-2.0"
] | 33 | 6f57343f3749939b0345d36fcb2c24470942aefd | https://github.com/HKBU-HPML/gtopkssgd/tree/6f57343f3749939b0345d36fcb2c24470942aefd |
ResidualBlock_noBN | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, 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.utils.data
impor... | GuoShi28/GCP-Net | ResidualBlock_noBN | false | 8,191 | [
"Apache-2.0"
] | 24 | cef7513fa242343055af64e612429e4384d3c1d7 | https://github.com/GuoShi28/GCP-Net/tree/cef7513fa242343055af64e612429e4384d3c1d7 |
ANN | import torch
import torch.nn as nn
class ANN(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(ANN, self).__init__()
self.i2h = nn.Linear(input_size, hidden_size)
self.h2o = nn.Linear(hidden_size, output_size)
self.softmax = nn.LogSoftmax()
def forwa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | GopikrishnanSasikumar/Rita | ANN | false | 8,192 | [
"BSD-3-Clause"
] | 17 | a9537c863140fc8c212f82b51f3d556e683e5f5a | https://github.com/GopikrishnanSasikumar/Rita/tree/a9537c863140fc8c212f82b51f3d556e683e5f5a |
TripletSemihardLoss | import torch
import torchvision.transforms.functional as F
import torch.nn.functional as F
import torch.utils.model_zoo
def pdist(A, squared=False, eps=0.0001):
prod = torch.mm(A, A.t())
norm = prod.diag().unsqueeze(1).expand_as(prod)
res = (norm + norm.t() - 2 * prod).clamp(min=0)
if squared:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CompVis/metric-learning-divide-and-conquer-improved | TripletSemihardLoss | false | 8,193 | [
"MIT"
] | 11 | 33fe768a54376a090e2d7139898177b06e8903d2 | https://github.com/CompVis/metric-learning-divide-and-conquer-improved/tree/33fe768a54376a090e2d7139898177b06e8903d2 |
FocalLossBinary | import torch
import torch.jit
import torch.nn.functional as F
import torch.nn.functional
import torch.nn
from functools import partial
from torch.nn.modules.loss import _Loss
def reduced_focal_loss(outputs: 'torch.Tensor', targets: 'torch.Tensor',
threshold: 'float'=0.5, gamma: 'float'=2.0, reduction='mean'):
... | 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... | Gitsamshi/nnUNet-1 | FocalLossBinary | false | 8,194 | [
"Apache-2.0"
] | 28 | 5341684211e6d91dab6ad76a7595a95addff23be | https://github.com/Gitsamshi/nnUNet-1/tree/5341684211e6d91dab6ad76a7595a95addff23be |
Maximum | import torch
import torch as th
import torch.nn as nn
def maximum(x, dim=-1, scale_up=False, inplace=False):
if inplace:
x_ = x.clone()
max_x = th.max(x_, dim=dim, keepdim=True)[0]
max_mask = x_ == max_x
x.masked_fill_(max_mask == 0, 0.0)
if scale_up:
x_sum = th... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch as th
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.ass... | HKUST-KnowComp/DualMessagePassing | Maximum | false | 8,195 | [
"MIT"
] | 12 | d29d627be2a8c8f24b52e3db2c383e33a059aaa7 | https://github.com/HKUST-KnowComp/DualMessagePassing/tree/d29d627be2a8c8f24b52e3db2c383e33a059aaa7 |
HuberLoss | import torch
from torch import nn
import torch.utils.data
class HuberLoss(nn.Module):
def __init__(self, delta=1):
super().__init__()
self.huber_loss_delta1 = nn.SmoothL1Loss()
self.delta = delta
def forward(self, x, x_hat):
loss = self.huber_loss_delta1(x / self.delta, x_hat... | 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
i... | Haichao-Zhang/leap | HuberLoss | false | 8,196 | [
"MIT"
] | 36 | 4d75961ff2ff203d4412633cbeb12889de3c79b6 | https://github.com/Haichao-Zhang/leap/tree/4d75961ff2ff203d4412633cbeb12889de3c79b6 |
UpdateFunc | from torch.nn import Module
import torch
import torch.nn as nn
from torch.nn.modules.module import Module
class UpdateFunc(Module):
"""Implements a Message function"""
def __init__(self, sa_dim, n_agents, hidden_size):
super(UpdateFunc, self).__init__()
self.fv = nn.Linear(hidden_size + sa_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.nn as nn
from torch.nn.modules.module i... | HAXRD/PIC | UpdateFunc | false | 8,197 | [
"MIT"
] | 28 | 658b4dd6b01e64413d5f8f0107d9167f1bd78546 | https://github.com/HAXRD/PIC/tree/658b4dd6b01e64413d5f8f0107d9167f1bd78546 |
ResidualAttentionBlock | import torch
import torch.nn as nn
from collections import OrderedDict
class LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-05):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(LayerNorm, self).__init__()
self.weight = nn.P... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | FacePerceiver/FaRL | ResidualAttentionBlock | false | 8,198 | [
"MIT"
] | 23 | 38f1d32f4e63940fae524e9f501b88a947ec09cd | https://github.com/FacePerceiver/FaRL/tree/38f1d32f4e63940fae524e9f501b88a947ec09cd |
maxPool23DUinit | import torch
from torch import nn
import torch.utils.data
import torch.nn.init
class maxPool23DUinit(nn.Module):
def __init__(self, kernel_size, stride, padding=1, dilation=1, nd=2):
super(maxPool23DUinit, self).__init__()
assert nd == 1 or nd == 2 or nd == 3, 'nd is not correctly specified!!!!, ... | 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
import torch.utils.data
import torch.nn.init
assert_size_stride = to... | ForrestPi/Unsupervised-Defect-Segmentation | maxPool23DUinit | false | 8,199 | [
"MIT"
] | 17 | e366ac7c757bb1b45f38ebbc502dfee7ccb72398 | https://github.com/ForrestPi/Unsupervised-Defect-Segmentation/tree/e366ac7c757bb1b45f38ebbc502dfee7ccb72398 |
TripletAllLoss | import torch
import torchvision.transforms.functional as F
import torch.nn.functional as F
import torch.utils.model_zoo
def pdist(A, squared=False, eps=0.0001):
prod = torch.mm(A, A.t())
norm = prod.diag().unsqueeze(1).expand_as(prod)
res = (norm + norm.t() - 2 * prod).clamp(min=0)
if squared:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CompVis/metric-learning-divide-and-conquer-improved | TripletAllLoss | false | 8,200 | [
"MIT"
] | 11 | 33fe768a54376a090e2d7139898177b06e8903d2 | https://github.com/CompVis/metric-learning-divide-and-conquer-improved/tree/33fe768a54376a090e2d7139898177b06e8903d2 |
LRN | import torch
import torch.nn as nn
import torch.utils.data.distributed
class LRN(nn.Module):
def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=True
):
super(LRN, self).__init__()
self.ACROSS_CHANNELS = ACROSS_CHANNELS
if ACROSS_CHANNELS:
self.avera... | 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.utils.data.distributed
assert_size_stride = ... | HKBU-HPML/gtopkssgd | LRN | false | 8,201 | [
"Apache-2.0"
] | 33 | 6f57343f3749939b0345d36fcb2c24470942aefd | https://github.com/HKBU-HPML/gtopkssgd/tree/6f57343f3749939b0345d36fcb2c24470942aefd |
NoiseZ | import torch
from torch import nn
import torch.utils.data
import torch.nn.init
class NoiseZ(nn.Module):
def __init__(self, batchSize):
super(NoiseZ, self).__init__()
self.Z = nn.Parameter(torch.randn(batchSize, 128), requires_grad=True)
def forward(self, input):
out = self.Z * input
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
import torch.nn.init
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_stri... | ForrestPi/Unsupervised-Defect-Segmentation | NoiseZ | false | 8,202 | [
"MIT"
] | 17 | e366ac7c757bb1b45f38ebbc502dfee7ccb72398 | https://github.com/ForrestPi/Unsupervised-Defect-Segmentation/tree/e366ac7c757bb1b45f38ebbc502dfee7ccb72398 |
DiscriminatorLoss | import torch
from torch import nn
import torch.utils.data
import torch.nn.init
class DiscriminatorLoss(nn.Module):
def __init__(self):
super(DiscriminatorLoss, self).__init__()
def forward(self, real_out, fake_out):
d_loss = 1 - real_out + fake_out
return d_loss.mean()
def get_inpu... | 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
import torch.utils.data
import torch.nn.init
assert_size_stride = to... | ForrestPi/Unsupervised-Defect-Segmentation | DiscriminatorLoss | false | 8,203 | [
"MIT"
] | 17 | e366ac7c757bb1b45f38ebbc502dfee7ccb72398 | https://github.com/ForrestPi/Unsupervised-Defect-Segmentation/tree/e366ac7c757bb1b45f38ebbc502dfee7ccb72398 |
LayerNorm | import torch
from torch import nn
import torch.utils.data
class LayerNorm(nn.Module):
"""
Simple 1D LayerNorm.
"""
def __init__(self, features, center=True, scale=False, eps=1e-06):
super().__init__()
self.center = center
self.scale = scale
self.eps = eps
if se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | Haichao-Zhang/leap | LayerNorm | false | 8,204 | [
"MIT"
] | 36 | 4d75961ff2ff203d4412633cbeb12889de3c79b6 | https://github.com/Haichao-Zhang/leap/tree/4d75961ff2ff203d4412633cbeb12889de3c79b6 |
par_start_encoder | import torch
import numpy as np
from torch import nn
class par_start_encoder(nn.Module):
"""A network which makes the initial states a parameter of the network"""
def __init__(self, nx, nsamples):
super(par_start_encoder, self).__init__()
self.start_state = nn.parameter.Parameter(data=torch.a... | 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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | GerbenBeintema/deepSI | par_start_encoder | false | 8,205 | [
"BSD-3-Clause"
] | 12 | 580711210398064bb7f01e41d08b7a248a88b35b | https://github.com/GerbenBeintema/deepSI/tree/580711210398064bb7f01e41d08b7a248a88b35b |
Attn | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.autograd
import torch.nn
class Attn(nn.Module):
"""
Unit attention operation for alternating co-attention.
``https://arxiv.org/pdf/1606.00061.pdf``
.. math::
\\begin{array}{ll}
H = \\tanh(W_x * X + (W_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HCY123902/visdial-gnn | Attn | false | 8,206 | [
"MIT"
] | 44 | c38090c672cdf04a4fabe139f96d944fd82cb123 | https://github.com/HCY123902/visdial-gnn/tree/c38090c672cdf04a4fabe139f96d944fd82cb123 |
DiceLoss | import torch
from torch import nn
import torch.nn.functional as F
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, inputs, targets, smooth=1):
inputs = F.sigmoid(inputs)
inputs = inputs.view(-1)
targets = targets.view(-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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | HealthML/ContIG | DiceLoss | false | 8,207 | [
"Apache-2.0"
] | 10 | 641d76e0e9a5878e456f9729f2b0a81e51764b16 | https://github.com/HealthML/ContIG/tree/641d76e0e9a5878e456f9729f2b0a81e51764b16 |
CAM_Module | from torch.nn import Module
import torch
from torch.nn import Parameter
from torch.nn import Softmax
class CAM_Module(Module):
""" Channel attention module"""
def __init__(self, in_dim):
super(CAM_Module, self).__init__()
self.chanel_in = in_dim
self.gamma = Parameter(torch.zeros(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.... | HUuxiaobin/Face-Super-Resolution-Guided-by-3D-Facial-Priors | CAM_Module | false | 8,208 | [
"MIT"
] | 29 | 987e7c74d33d26cc5e9d1c0e395a06519a31792f | https://github.com/HUuxiaobin/Face-Super-Resolution-Guided-by-3D-Facial-Priors/tree/987e7c74d33d26cc5e9d1c0e395a06519a31792f |
Project3D | import torch
import torch.nn as nn
class Project3D(nn.Module):
"""Layer which projects 3D points into a camera with intrinsics K and at position T
"""
def __init__(self, batch_size, height, width, eps=1e-07):
super(Project3D, self).__init__()
self.batch_size = batch_size
self.heig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | HalleyJiang/PLNet | Project3D | false | 8,209 | [
"MIT"
] | 16 | a02bd5f343b9e4766891fd234e3a338c1eaa26ff | https://github.com/HalleyJiang/PLNet/tree/a02bd5f343b9e4766891fd234e3a338c1eaa26ff |
AsymmetricLossOptimized | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class AsymmetricLossOptimized(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
... | 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 torchv... | Coler1994/robust-loss-mlml | AsymmetricLossOptimized | false | 8,210 | [
"MIT"
] | 15 | a68718eba7efa82c3eca79031eeee444f8eb5fa3 | https://github.com/Coler1994/robust-loss-mlml/tree/a68718eba7efa82c3eca79031eeee444f8eb5fa3 |
unetConvUnit | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.init as init
import torch.nn.init
class conv23DUnit(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=True, dilation=1, nd=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
from torch... | ForrestPi/Unsupervised-Defect-Segmentation | unetConvUnit | false | 8,211 | [
"MIT"
] | 17 | e366ac7c757bb1b45f38ebbc502dfee7ccb72398 | https://github.com/ForrestPi/Unsupervised-Defect-Segmentation/tree/e366ac7c757bb1b45f38ebbc502dfee7ccb72398 |
TAE_decoder | import torch
import torch.nn as nn
class TAE_decoder(nn.Module):
"""
Class for temporal autoencoder decoder.
filter_1 : filter size of the first convolution layer
filter_lstm : hidden size of the lstm.
"""
def __init__(self, n_hidden=64, pooling=8):
super().__init__()
self.poo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | HamzaG737/Deep-temporal-clustering---Pytorch | TAE_decoder | false | 8,212 | [
"MIT"
] | 12 | 5ee423d833e655e73b6ba2f1c13be5f1b83f92d2 | https://github.com/HamzaG737/Deep-temporal-clustering---Pytorch/tree/5ee423d833e655e73b6ba2f1c13be5f1b83f92d2 |
Encoder4 | import torch
import torch.nn as nn
class Encoder4(nn.Module):
def __init__(self, model=None, fixed=False):
super(Encoder4, self).__init__()
self.fixed = fixed
self.conv0 = nn.Conv2d(3, 3, 1, 1, 0)
self.conv11 = nn.Conv2d(3, 64, 3, 1, 0)
self.conv12 = nn.Conv2d(64, 64, 3, 1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | EndyWon/Texture-Reformer | Encoder4 | false | 8,214 | [
"MIT"
] | 11 | f84f95accb3574c7b759a7f03c0b0b4e150314b5 | https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5 |
MultiHeadAttn | import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttn(nn.Module):
def __init__(self, n_head, d_model, d_head, dropout, dropatt=0,
pre_lnorm=False):
super(MultiHeadAttn, self).__init__()
self.n_head = n_head
self.d_model = d_model
self.d_hea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HKUST-KnowComp/NeuralSubIsoCnt | MultiHeadAttn | false | 8,215 | [
"MIT"
] | 28 | 7d1deef8e49af90122ea0ad099dec1de390927b6 | https://github.com/HKUST-KnowComp/NeuralSubIsoCnt/tree/7d1deef8e49af90122ea0ad099dec1de390927b6 |
GatedMultiHeadAttn | import torch
import torch.nn as nn
import torch.nn.functional as F
class GatedMultiHeadAttn(nn.Module):
def __init__(self, query_dim, key_dim, value_dim, hidden_dim, num_head,
dropatt=0.0, act_func='softmax', add_zero_attn=False, pre_lnorm=
False, post_lnorm=False):
super(GatedMultiHeadAt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HKUST-KnowComp/BMGF-RoBERTa | GatedMultiHeadAttn | false | 8,216 | [
"MIT"
] | 16 | 8e9eebd7e9fb6cc2492131fc8eaa5b5b29d999fd | https://github.com/HKUST-KnowComp/BMGF-RoBERTa/tree/8e9eebd7e9fb6cc2492131fc8eaa5b5b29d999fd |
PairwiseNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class PairwiseNetwork(nn.Module):
def __init__(self, hidden_size):
super().__init__()
self.fc1 = nn.Linear(hidden_size, 2 * hidden_size)
self.fc2 = nn.Linear(2 * hidden_size, hidden_size)
self.fc3 = nn.Linear(hidde... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | HardiRathod/table-linker | PairwiseNetwork | false | 8,217 | [
"MIT"
] | 21 | 5d0542608cdba72b0d7d8afc58c27f27b8a59192 | https://github.com/HardiRathod/table-linker/tree/5d0542608cdba72b0d7d8afc58c27f27b8a59192 |
SANet | import torch
import torch.nn as nn
def calc_mean_std(feat, eps=1e-05):
size = feat.size()
assert len(size) == 4
N, C = size[:2]
feat_var = feat.view(N, C, -1).var(dim=2) + eps
feat_std = feat_var.sqrt().view(N, C, 1, 1)
feat_mean = feat.view(N, C, -1).mean(dim=2).view(N, C, 1, 1)
return fe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HalbertCH/IEContraAST | SANet | false | 8,218 | [
"MIT"
] | 39 | 50ee949f5302a7e4a3cae3226610c03462093c21 | https://github.com/HalbertCH/IEContraAST/tree/50ee949f5302a7e4a3cae3226610c03462093c21 |
residualUnit | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.init as init
import torch.nn.init
class conv23DUnit(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=True, dilation=1, nd=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ForrestPi/Unsupervised-Defect-Segmentation | residualUnit | false | 8,219 | [
"MIT"
] | 17 | e366ac7c757bb1b45f38ebbc502dfee7ccb72398 | https://github.com/ForrestPi/Unsupervised-Defect-Segmentation/tree/e366ac7c757bb1b45f38ebbc502dfee7ccb72398 |
Encoder5 | import torch
import numpy as np
import torch.nn as nn
class Encoder5(nn.Module):
def __init__(self, model=None, fixed=False):
super(Encoder5, self).__init__()
self.fixed = fixed
self.conv0 = nn.Conv2d(3, 3, 1, 1, 0)
self.conv0.weight = nn.Parameter(torch.from_numpy(np.array([[[[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.... | EndyWon/Texture-Reformer | Encoder5 | false | 8,220 | [
"MIT"
] | 11 | f84f95accb3574c7b759a7f03c0b0b4e150314b5 | https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5 |
convTranspose23DUnit | import torch
import numpy as np
from torch import nn
import torch.utils.data
import torch.nn.init as init
import torch.nn.init
class convTranspose23DUnit(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, output_padding=0, groups=1, bias=True, dilation=1, nd=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
import numpy as np
from torch import nn
import torch.utils.data
import torch.nn.... | ForrestPi/Unsupervised-Defect-Segmentation | convTranspose23DUnit | false | 8,221 | [
"MIT"
] | 17 | e366ac7c757bb1b45f38ebbc502dfee7ccb72398 | https://github.com/ForrestPi/Unsupervised-Defect-Segmentation/tree/e366ac7c757bb1b45f38ebbc502dfee7ccb72398 |
ConvBlock | import torch
import torch.nn as nn
class Conv3x3(nn.Module):
"""Layer to pad and convolve input
"""
def __init__(self, in_channels, out_channels, bias=True):
super(Conv3x3, self).__init__()
self.pad = nn.ZeroPad2d(1)
self.conv = nn.Conv2d(int(in_channels), int(out_channels), 3, bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | HalleyJiang/UniFuse-Unidirectional-Fusion | ConvBlock | false | 8,222 | [
"MIT"
] | 30 | 27a4441fe3d3031d1c9f3eb2d72a3624407d19fc | https://github.com/HalleyJiang/UniFuse-Unidirectional-Fusion/tree/27a4441fe3d3031d1c9f3eb2d72a3624407d19fc |
NodeMaxpool3by3 | import torch
import torch.nn as nn
import torch.cuda
class NodeMaxpool3by3(nn.Module):
def __init__(self):
super(NodeMaxpool3by3, self).__init__()
self.maxpool = nn.MaxPool2d(kernel_size=3, stride=1, padding=1)
def init_weights(self):
pass
def forward(self, x):
return se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.cuda
assert_size_stride = torch._C._dynamo.guards.asse... | HanseulJo/COMBO_NKmodel | NodeMaxpool3by3 | false | 8,223 | [
"BSD-2-Clause-FreeBSD"
] | 38 | 6dcee4c39d4cf200f44677925712ce57255d1489 | https://github.com/HanseulJo/COMBO_NKmodel/tree/6dcee4c39d4cf200f44677925712ce57255d1489 |
dnn_generator | import torch
import torch.nn as nn
import torch.nn.functional as F
class dnn_generator(nn.Module):
def weight_init(self):
nn.init.xavier_uniform_(self.fc1.weight)
nn.init.xavier_uniform_(self.fc2.weight)
nn.init.xavier_uniform_(self.fc3.weight)
nn.init.xavier_uniform_(self.out.wei... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Harshitmalaviya/whisper-to-normal-speech-conversion | dnn_generator | false | 8,224 | [
"MIT"
] | 23 | a6d411b27a3c5cc4ad12e3968350b22d88b9b4d9 | https://github.com/Harshitmalaviya/whisper-to-normal-speech-conversion/tree/a6d411b27a3c5cc4ad12e3968350b22d88b9b4d9 |
CircleLoss | import torch
from torch import Tensor
import torch.nn as nn
class CircleLoss(nn.Module):
def __init__(self, m: 'float', gamma: 'float') ->None:
super(CircleLoss, self).__init__()
self.m = m
self.gamma = gamma
self.soft_plus = nn.Softplus()
def forward(self, sp: 'Tensor', sn: ... | 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... | HaochengWan/PVT | CircleLoss | false | 8,225 | [
"MIT"
] | 27 | 95818d303ee63084f044a057344b2049d1fa4492 | https://github.com/HaochengWan/PVT/tree/95818d303ee63084f044a057344b2049d1fa4492 |
Decoder5 | import torch
import torch.nn as nn
class Decoder5(nn.Module):
def __init__(self, model=None, fixed=False):
super(Decoder5, self).__init__()
self.fixed = fixed
self.conv51 = nn.Conv2d(512, 512, 3, 1, 0)
self.conv44 = nn.Conv2d(512, 512, 3, 1, 0)
self.conv43 = nn.Conv2d(512,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EndyWon/Texture-Reformer | Decoder5 | false | 8,226 | [
"MIT"
] | 11 | f84f95accb3574c7b759a7f03c0b0b4e150314b5 | https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5 |
Swish | import torch
import torch.utils.data
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
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.utils.data
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
assert_size_stride = to... | Het-Shah/Monk_Object_Detection | Swish | false | 8,227 | [
"Apache-2.0"
] | 15 | 1d7a07193ea3455221caa41d07c33c81d50c6b3f | https://github.com/Het-Shah/Monk_Object_Detection/tree/1d7a07193ea3455221caa41d07c33c81d50c6b3f |
BackprojectDepth | import torch
import torch.nn as nn
class BackprojectDepth(nn.Module):
"""Layer to transform a depth image into a point cloud
"""
def __init__(self, batch_size, height, width):
super(BackprojectDepth, self).__init__()
self.batch_size = batch_size
self.height = height
self.w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | HalleyJiang/PLNet | BackprojectDepth | false | 8,228 | [
"MIT"
] | 16 | a02bd5f343b9e4766891fd234e3a338c1eaa26ff | https://github.com/HalleyJiang/PLNet/tree/a02bd5f343b9e4766891fd234e3a338c1eaa26ff |
AlterCoAttn | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.autograd
import torch.nn
class Attn(nn.Module):
"""
Unit attention operation for alternating co-attention.
``https://arxiv.org/pdf/1606.00061.pdf``
.. math::
\\begin{array}{ll}
H = \\tanh(W_x * X + (W_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HCY123902/visdial-gnn | AlterCoAttn | false | 8,229 | [
"MIT"
] | 44 | c38090c672cdf04a4fabe139f96d944fd82cb123 | https://github.com/HCY123902/visdial-gnn/tree/c38090c672cdf04a4fabe139f96d944fd82cb123 |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def init_linear_wt(linear):
nn.init.xavier_uniform_(linear.weight)
if linear.bias is not None:
n = linear.bias.size(0)
start, end = n // 4, n // 2
linear.bias.data.fill_(0.0)
linear.bias.data[start: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.... | HLTCHKUST/sentiment-lookahead | Attention | false | 8,230 | [
"MIT"
] | 13 | 1c076b7c5c31b0f7c454720377db4e733838ebb2 | https://github.com/HLTCHKUST/sentiment-lookahead/tree/1c076b7c5c31b0f7c454720377db4e733838ebb2 |
ResidualBlock | import torch
import torch.nn.functional as F
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.channels = channels
self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
self.conv2 = nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | HuangCongQing/pytorch | ResidualBlock | false | 8,231 | [
"MIT"
] | 12 | 2b2b01d74b45cbe4e467da229798609e79cec97c | https://github.com/HuangCongQing/pytorch/tree/2b2b01d74b45cbe4e467da229798609e79cec97c |
ScaleNorm | import torch
from torch import nn
from torch.nn import Parameter
class ScaleNorm(nn.Module):
"""ScaleNorm"""
def __init__(self, scale, eps=1e-05):
super(ScaleNorm, self).__init__()
self.scale = Parameter(torch.tensor(scale))
self.eps = eps
def forward(self, x):
norm = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | HerbertMcSnout/transformers_with_trees | ScaleNorm | false | 8,232 | [
"MIT"
] | 18 | 1afa6d4ad45207c9b2762600a9c227d721fbc825 | https://github.com/HerbertMcSnout/transformers_with_trees/tree/1afa6d4ad45207c9b2762600a9c227d721fbc825 |
JointsMSELoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class JointsMSELoss(nn.Module):
def __init__(self, use_target_weight):
super(JointsMSELoss, self).__init__()
self.criterion = nn.MSELoss(reduction='mean')
... | 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.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
assert_size_st... | HowieMa/TransFusion-Pose | JointsMSELoss | false | 8,233 | [
"MIT"
] | 17 | b66ee5bafdc12a971088f9d54233408249e067db | https://github.com/HowieMa/TransFusion-Pose/tree/b66ee5bafdc12a971088f9d54233408249e067db |
WBCEDiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def dice_loss(pred, target, smooth=1e-08):
iflat = pred.view(-1)
tflat = target.view(-1)
intersection = (iflat * tflat).sum()
return 1 - (2.0 * intersection + smooth) / (iflat.sum() + tflat.sum() +
smooth)
def weighted_binary... | 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
... | Hhhhhhhhhhao/change_detection | WBCEDiceLoss | false | 8,234 | [
"MIT"
] | 11 | 13b87c02166cc98d39d8be240a07abcf12893fe3 | https://github.com/Hhhhhhhhhhao/change_detection/tree/13b87c02166cc98d39d8be240a07abcf12893fe3 |
Norm | import torch
import torch.nn as nn
class Norm(nn.Module):
def __init__(self, d_model, eps=1e-06):
super().__init__()
self.size = d_model
self.alpha = nn.Parameter(torch.ones(self.size))
self.bias = nn.Parameter(torch.zeros(self.size))
self.eps = eps
def forward(self, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Hyunseung-Kim/molGCT | Norm | false | 8,236 | [
"Apache-2.0"
] | 10 | 5a2604337cf0a9d3c725295ccb7c8ea4b0144636 | https://github.com/Hyunseung-Kim/molGCT/tree/5a2604337cf0a9d3c725295ccb7c8ea4b0144636 |
InceptionA | import torch
import torch.nn.functional as F
import torch.nn as nn
class InceptionA(nn.Module):
def __init__(self, in_channels):
super(InceptionA, self).__init__()
self.branch1x1 = nn.Conv2d(in_channels, 16, kernel_size=1)
self.branch5x5_1 = nn.Conv2d(in_channels, 16, kernel_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | HuangCongQing/pytorch | InceptionA | false | 8,237 | [
"MIT"
] | 12 | 2b2b01d74b45cbe4e467da229798609e79cec97c | https://github.com/HuangCongQing/pytorch/tree/2b2b01d74b45cbe4e467da229798609e79cec97c |
Concat | import torch
import torch.nn as nn
class Concat(nn.Module):
def __init__(self, channels, **kwargs):
super(Concat, self).__init__()
self.conv = nn.Conv2d(channels * 2, channels, 1, bias=False)
self.relu = nn.ReLU(inplace=True)
def forward(self, equi_feat, c2e_feat):
x = 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 import triton_helpers
import torch.nn as nn
assert_... | HalleyJiang/UniFuse-Unidirectional-Fusion | Concat | false | 8,238 | [
"MIT"
] | 30 | 27a4441fe3d3031d1c9f3eb2d72a3624407d19fc | https://github.com/HalleyJiang/UniFuse-Unidirectional-Fusion/tree/27a4441fe3d3031d1c9f3eb2d72a3624407d19fc |
AveragePoolingLayer | import torch
import torch.nn as nn
from torch.nn import functional as F
class AveragePoolingLayer(nn.Module):
"""Implements the average pooling layer.
Basically, this layer can be used to downsample feature maps from spatial
domain.
"""
def __init__(self, scale_factor=2):
super().__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Hsintien-Ng/idinvert_pytorch-reproduced | AveragePoolingLayer | false | 8,239 | [
"MIT"
] | 20 | cf3302510573138cf16202add06feae7c93624ea | https://github.com/Hsintien-Ng/idinvert_pytorch-reproduced/tree/cf3302510573138cf16202add06feae7c93624ea |
CoAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class CoAttention(nn.Module):
"""
CoAttention encoder
in Dynamic Coattention Networks For Question Answering (https://arxiv.org/abs/1611.01604)
check the Figure 2 in paper
* Args:
embed_dim: the number of input embedd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | GMDennis/claf | CoAttention | false | 8,240 | [
"MIT"
] | 10 | d1e064e593127e5d654f000f5506c5ae1caab5ce | https://github.com/GMDennis/claf/tree/d1e064e593127e5d654f000f5506c5ae1caab5ce |
ClassificationModel | import torch
import torch.utils.data
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
class ClassificationModel(nn.Module):
def __init__(self, num_features_in, num_anchors=9, num_classes=80,
prior=0.01, feature_size=256):
super(ClassificationModel, 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.utils.data
impor... | Het-Shah/Monk_Object_Detection | ClassificationModel | false | 8,241 | [
"Apache-2.0"
] | 15 | 1d7a07193ea3455221caa41d07c33c81d50c6b3f | https://github.com/Het-Shah/Monk_Object_Detection/tree/1d7a07193ea3455221caa41d07c33c81d50c6b3f |
Temporal_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class Temporal_Attention(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, groups=1, bias=False, refinement=False):
super(Temporal_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.triton_helpers import math as tl_math
import torch.... | Herrccc/DR-TANet | Temporal_Attention | false | 8,242 | [
"MIT"
] | 12 | 37cc3929833d61451b2fa4a92ccd4286cfc4fd34 | https://github.com/Herrccc/DR-TANet/tree/37cc3929833d61451b2fa4a92ccd4286cfc4fd34 |
MultiHeadAttn | import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttn(nn.Module):
def __init__(self, query_dim, key_dim, value_dim, hidden_dim, num_head,
dropatt=0.0, act_func='softmax', add_zero_attn=False, pre_lnorm=
False, post_lnorm=False):
super(MultiHeadAttn, self).... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HKUST-KnowComp/BMGF-RoBERTa | MultiHeadAttn | false | 8,243 | [
"MIT"
] | 16 | 8e9eebd7e9fb6cc2492131fc8eaa5b5b29d999fd | https://github.com/HKUST-KnowComp/BMGF-RoBERTa/tree/8e9eebd7e9fb6cc2492131fc8eaa5b5b29d999fd |
UpConvNorm | import torch
import torch.nn as nn
def pixel_shuffle(input, scale_factor):
batch_size, channels, in_height, in_width = input.size()
out_channels = int(int(channels / scale_factor) / scale_factor)
out_height = int(in_height * scale_factor)
out_width = int(in_width * scale_factor)
if scale_factor >=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Hubert482/cainapp | UpConvNorm | false | 8,244 | [
"MIT"
] | 18 | 7a74a9b186ee358168c8f050e445fbe9f91f9c47 | https://github.com/Hubert482/cainapp/tree/7a74a9b186ee358168c8f050e445fbe9f91f9c47 |
tofp16 | import torch
import torch.nn as nn
import torch.nn.parallel
class tofp16(nn.Module):
def __init__(self):
super(tofp16, self).__init__()
def forward(self, input):
return input.half()
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
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C... | HuaijiaLin/AGSS-VOS | tofp16 | false | 8,245 | [
"MIT"
] | 11 | e9272365aa45bf098316d7111238fe0ab8df8a17 | https://github.com/HuaijiaLin/AGSS-VOS/tree/e9272365aa45bf098316d7111238fe0ab8df8a17 |
RegressionModel | import torch
import torch.utils.data
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
class RegressionModel(nn.Module):
def __init__(self, num_features_in, num_anchors=9, feature_size=256):
super(RegressionModel, self).__init__()
self.conv1 = 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.utils.data
impor... | Het-Shah/Monk_Object_Detection | RegressionModel | false | 8,246 | [
"Apache-2.0"
] | 15 | 1d7a07193ea3455221caa41d07c33c81d50c6b3f | https://github.com/Het-Shah/Monk_Object_Detection/tree/1d7a07193ea3455221caa41d07c33c81d50c6b3f |
SpatialAttentionLayer | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data.distributed
class SpatialAttentionLayer(nn.Module):
def __init__(self, spatial_size):
super(SpatialAttentionLayer, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPoo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HolmesShuan/Compact-Global-Descriptor | SpatialAttentionLayer | false | 8,247 | [
"BSD-2-Clause"
] | 24 | 715601bd7fce76596db960f7dc480241d443fa66 | https://github.com/HolmesShuan/Compact-Global-Descriptor/tree/715601bd7fce76596db960f7dc480241d443fa66 |
FeedForward | import torch
import torch.nn.functional as F
import torch.nn as nn
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff=2048, dropout=0.1):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linear(d_ff, d_mo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Hyunseung-Kim/molGCT | FeedForward | false | 8,248 | [
"Apache-2.0"
] | 10 | 5a2604337cf0a9d3c725295ccb7c8ea4b0144636 | https://github.com/Hyunseung-Kim/molGCT/tree/5a2604337cf0a9d3c725295ccb7c8ea4b0144636 |
MultiHeadAttention | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.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.... | Hyunseung-Kim/molGCT | MultiHeadAttention | false | 8,249 | [
"Apache-2.0"
] | 10 | 5a2604337cf0a9d3c725295ccb7c8ea4b0144636 | https://github.com/Hyunseung-Kim/molGCT/tree/5a2604337cf0a9d3c725295ccb7c8ea4b0144636 |
GC | import torch
import torch.nn as nn
import torch.nn.parallel
class GC(nn.Module):
def __init__(self, inplanes, planes, kh=7, kw=7):
super(GC, self).__init__()
self.conv_l1 = nn.Conv2d(inplanes, 256, kernel_size=(kh, 1),
padding=(int(kh / 2), 0))
self.conv_l2 = nn.Conv2d(256, pl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
assert_size_stride = torch._C._dy... | HuaijiaLin/AGSS-VOS | GC | false | 8,250 | [
"MIT"
] | 11 | e9272365aa45bf098316d7111238fe0ab8df8a17 | https://github.com/HuaijiaLin/AGSS-VOS/tree/e9272365aa45bf098316d7111238fe0ab8df8a17 |
ChannelPool | import torch
import torch.nn as nn
import torch.utils.model_zoo
class ChannelPool(nn.Module):
def forward(self, x):
return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1)
.unsqueeze(1)), 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.model_zoo
assert_size_stride = torch._C._dynamo.... | HolmesShuan/AIM2020-Real-Super-Resolution | ChannelPool | false | 8,251 | [
"BSD-2-Clause"
] | 19 | 0ea4d7db0f4f7ed488cc162b90bb08fc02082106 | https://github.com/HolmesShuan/AIM2020-Real-Super-Resolution/tree/0ea4d7db0f4f7ed488cc162b90bb08fc02082106 |
FirstBlock | import torch
import numpy as np
import torch.nn as nn
class BatchNormLayer(nn.Module):
"""Implements batch normalization layer."""
def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon
=1e-05):
"""Initializes with basic settings.
Args:
channels: Number of channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | Hsintien-Ng/idinvert_pytorch-reproduced | FirstBlock | false | 8,252 | [
"MIT"
] | 20 | cf3302510573138cf16202add06feae7c93624ea | https://github.com/Hsintien-Ng/idinvert_pytorch-reproduced/tree/cf3302510573138cf16202add06feae7c93624ea |
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.eps = epsilon
def forward(self, x):
if x.ndim != 4:
raise ValueError(
f'The... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Hsintien-Ng/idinvert_pytorch-reproduced | InstanceNormLayer | false | 8,253 | [
"MIT"
] | 20 | cf3302510573138cf16202add06feae7c93624ea | https://github.com/Hsintien-Ng/idinvert_pytorch-reproduced/tree/cf3302510573138cf16202add06feae7c93624ea |
ClipL1 | import torch
import torch.nn as nn
import torch.utils.model_zoo
class ClipL1(nn.Module):
def __init__(self, clip_min=0.0, clip_max=10.0):
super(ClipL1, self).__init__()
self.clip_max = clip_max
self.clip_min = clip_min
def forward(self, sr, hr):
loss = torch.mean(torch.clamp(... | 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
... | HolmesShuan/AIM2020-Real-Super-Resolution | ClipL1 | false | 8,254 | [
"BSD-2-Clause"
] | 19 | 0ea4d7db0f4f7ed488cc162b90bb08fc02082106 | https://github.com/HolmesShuan/AIM2020-Real-Super-Resolution/tree/0ea4d7db0f4f7ed488cc162b90bb08fc02082106 |
CosineSimilarity | import torch
import torch.nn as nn
import torch.nn.functional as F
class CosineSimilarity(nn.Module):
def __init__(self, dim=-1):
super(CosineSimilarity, self).__init__()
self.m = nn.CosineSimilarity(dim=dim)
def forward(self, i, j):
i = F.normalize(i, p=2, dim=-1)
j = F.norm... | 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... | IBM/aihn-ucsd | CosineSimilarity | false | 8,255 | [
"Apache-2.0"
] | 20 | 6c6a56d11c704b529a31868418e350e9760ff9d9 | https://github.com/IBM/aihn-ucsd/tree/6c6a56d11c704b529a31868418e350e9760ff9d9 |
TemporalPooling | import torch
import torch.nn as nn
import torch.distributions
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class TemporalPooling(nn.Module):
def __init__(self, frames, kernel_size=3, stride=2, mode='avg'):
"""
Parameters
--------... | 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.distributions
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data... | IBM/AdaMML | TemporalPooling | false | 8,256 | [
"Apache-2.0"
] | 32 | be50c02188e6b31ca3a25f285b1b538c137d3d5c | https://github.com/IBM/AdaMML/tree/be50c02188e6b31ca3a25f285b1b538c137d3d5c |
LastBlock | import torch
import numpy as np
import torch.nn as nn
class BatchNormLayer(nn.Module):
"""Implements batch normalization layer."""
def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon
=1e-05):
"""Initializes with basic settings.
Args:
channels: Number of channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | Hsintien-Ng/idinvert_pytorch-reproduced | LastBlock | false | 8,257 | [
"MIT"
] | 20 | cf3302510573138cf16202add06feae7c93624ea | https://github.com/Hsintien-Ng/idinvert_pytorch-reproduced/tree/cf3302510573138cf16202add06feae7c93624ea |
Refine | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
class Refine(nn.Module):
def __init__(self, inplanes, planes, scale_factor=2):
super(Refine, self).__init__()
self.convFS1 = nn.Conv2d(inplanes, planes, kernel_size=3, padding=1)
self.convFS2 = 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
import ... | HuaijiaLin/AGSS-VOS | Refine | false | 8,258 | [
"MIT"
] | 11 | e9272365aa45bf098316d7111238fe0ab8df8a17 | https://github.com/HuaijiaLin/AGSS-VOS/tree/e9272365aa45bf098316d7111238fe0ab8df8a17 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, 1)
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
import torch.nn as nn
assert_... | HzcIrving/DLRL_PlayGround | Critic | false | 8,259 | [
"MIT"
] | 27 | 0db9a4bdb87130d1d26aea1591ef74cbe6aaa43b | https://github.com/HzcIrving/DLRL_PlayGround/tree/0db9a4bdb87130d1d26aea1591ef74cbe6aaa43b |
partCE | import torch
import torch.nn as nn
import torch.utils.data
class partCE(nn.Module):
def __init__(self, if_average=False):
super(partCE, self).__init__()
self.crit = nn.CrossEntropyLoss(size_average=if_average)
self.maximum_score = 100000
def forward(self, scores, target):
par... | 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
... | INK-USC/shifted-label-distribution | partCE | false | 8,260 | [
"Apache-2.0"
] | 37 | 3cf2b7ced3b2e18234db405f6014f049c4830d71 | https://github.com/INK-USC/shifted-label-distribution/tree/3cf2b7ced3b2e18234db405f6014f049c4830d71 |
one_conv | import torch
from torch import nn
class one_conv(nn.Module):
def __init__(self, G0, G):
super(one_conv, self).__init__()
self.conv = nn.Conv2d(G0, G, kernel_size=3, stride=1, padding=1,
bias=True)
self.relu = nn.LeakyReLU(0.1, inplace=True)
def forward(self, x):
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Holmes-Alan/RefVAE | one_conv | false | 8,261 | [
"MIT"
] | 13 | 836b8f1168f1b0f923b609a48e202ace7806f79c | https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c |
ConvBlock | import torch
from torch import nn
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size, stride,
padding, bias=True):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_size, kernel_size,
stride, padding, bias=b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Holmes-Alan/RefVAE | ConvBlock | false | 8,262 | [
"MIT"
] | 13 | 836b8f1168f1b0f923b609a48e202ace7806f79c | https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c |
BilinearMap | import torch
import torch as th
import torch.nn as nn
from torch.nn.parameter import Parameter
class BilinearMap(nn.Module):
def __init__(self, nunits):
super(BilinearMap, self).__init__()
self.map = Parameter(th.Tensor(nunits, nunits))
self.nunits = nunits
self.reset_parameters()... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 as th
import torch.nn as nn
from torch.nn.parameter import Paramete... | IBM/aihn-ucsd | BilinearMap | false | 8,263 | [
"Apache-2.0"
] | 20 | 6c6a56d11c704b529a31868418e350e9760ff9d9 | https://github.com/IBM/aihn-ucsd/tree/6c6a56d11c704b529a31868418e350e9760ff9d9 |
ResnetBlock | import torch
class ResnetBlock(torch.nn.Module):
def __init__(self, num_filter, kernel_size=3, stride=1, padding=1, bias
=True):
super(ResnetBlock, self).__init__()
self.conv1 = torch.nn.Conv2d(num_filter, num_filter, kernel_size,
stride, padding, bias=bias)
self.conv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | Holmes-Alan/RefVAE | ResnetBlock | false | 8,264 | [
"MIT"
] | 13 | 836b8f1168f1b0f923b609a48e202ace7806f79c | https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c |
dnn | import torch
import torch.nn as nn
import torch.nn.functional as F
class dnn(nn.Module):
def weight_init(self):
nn.init.xavier_uniform_(self.fc1.weight)
nn.init.xavier_uniform_(self.fc2.weight)
nn.init.xavier_uniform_(self.fc3.weight)
nn.init.xavier_uniform_(self.out.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 import triton_helpers
import torch.nn as nn
assert_... | Harshitmalaviya/whisper-to-normal-speech-conversion | dnn | false | 8,265 | [
"MIT"
] | 23 | a6d411b27a3c5cc4ad12e3968350b22d88b9b4d9 | https://github.com/Harshitmalaviya/whisper-to-normal-speech-conversion/tree/a6d411b27a3c5cc4ad12e3968350b22d88b9b4d9 |
TVLoss | import torch
class TVLoss(torch.nn.Module):
def __init__(self):
super(TVLoss, self).__init__()
def forward(self, x):
x.size()[0]
h_x = x.size()[2]
w_x = x.size()[3]
self._tensor_size(x[:, :, 1:, :])
self._tensor_size(x[:, :, :, 1:])
h_tv = torch.pow(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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Holmes-Alan/RefVAE | TVLoss | false | 8,266 | [
"MIT"
] | 13 | 836b8f1168f1b0f923b609a48e202ace7806f79c | https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c |
EncoderLayer | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.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.... | Hyunseung-Kim/molGCT | EncoderLayer | false | 8,267 | [
"Apache-2.0"
] | 10 | 5a2604337cf0a9d3c725295ccb7c8ea4b0144636 | https://github.com/Hyunseung-Kim/molGCT/tree/5a2604337cf0a9d3c725295ccb7c8ea4b0144636 |
ConvRelu | import torch
import torch.utils.data
import torch.nn as nn
import torch.backends.cudnn
class ConvRelu(nn.Module):
"""3x3 convolution followed by ReLU activation building block.
"""
def __init__(self, num_in, num_out):
"""Creates a `ConvReLU` building block.
Args:
num_in: number... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Iceofsky/Roofpedia | ConvRelu | false | 8,268 | [
"MIT"
] | 16 | 933dd3ff6e77ace78be6d2a23ac6692281475073 | https://github.com/Iceofsky/Roofpedia/tree/933dd3ff6e77ace78be6d2a23ac6692281475073 |
OutPutBlock | import torch
import torch.nn as nn
class OutPutBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutPutBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns // 2, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | HiLab-git/WSL4MIS | OutPutBlock | false | 8,269 | [
"MIT"
] | 29 | 9683e7c7409b95c0ac2169fe7964f6ca04c80d9a | https://github.com/HiLab-git/WSL4MIS/tree/9683e7c7409b95c0ac2169fe7964f6ca04c80d9a |
VAE | import torch
import torch.nn as nn
import torch.nn.functional as F
class VAE(nn.Module):
def __init__(self, state_dim, action_dim, latent_dim, max_action, device):
super(VAE, self).__init__()
self.e1 = nn.Linear(state_dim + action_dim, 750)
self.e2 = nn.Linear(750, 750)
self.mean ... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | HzcIrving/DLRL_PlayGround | VAE | false | 8,270 | [
"MIT"
] | 27 | 0db9a4bdb87130d1d26aea1591ef74cbe6aaa43b | https://github.com/HzcIrving/DLRL_PlayGround/tree/0db9a4bdb87130d1d26aea1591ef74cbe6aaa43b |
CRF | import torch
import torch.nn as nn
import torch.nn.init
import torch.nn.functional as F
class CRF(nn.Module):
"""
Conditional Random Field Module
Parameters
----------
hidden_dim : ``int``, required.
the dimension of the input features.
tagset_size : ``int``, required.
the siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | INK-USC/ConNet | CRF | false | 8,271 | [
"MIT"
] | 11 | adb299f160556004561df302c19578200bd3835b | https://github.com/INK-USC/ConNet/tree/adb299f160556004561df302c19578200bd3835b |
CGD | import torch
import torch.nn as nn
import torch.utils.model_zoo
class CGD(nn.Module):
def __init__(self, in_channels, bias=True, nonlinear=True):
super(CGD, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPool2d(1)
self.softmax = nn.Softmax(d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HolmesShuan/AIM2020-Real-Super-Resolution | CGD | false | 8,272 | [
"BSD-2-Clause"
] | 19 | 0ea4d7db0f4f7ed488cc162b90bb08fc02082106 | https://github.com/HolmesShuan/AIM2020-Real-Super-Resolution/tree/0ea4d7db0f4f7ed488cc162b90bb08fc02082106 |
_ImpalaResBlock | import torch
from torch import nn
class _ImpalaResBlock(nn.Module):
def __init__(self, n_channels: 'int'):
super().__init__()
self.n_channels = n_channels
kernel_size = 3
padding = 1
self.relu = nn.ReLU()
self.relu_inplace = nn.ReLU()
self.conv1 = 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
from torch import nn
assert_s... | IBM/vsrl-framework | _ImpalaResBlock | false | 8,273 | [
"MIT"
] | 44 | 42e0853bffb5efbb66cd97178aff9e10ad18c5a9 | https://github.com/IBM/vsrl-framework/tree/42e0853bffb5efbb66cd97178aff9e10ad18c5a9 |
MlpNetM | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class MlpNetM(nn.Module):
"""Implements a simple fully connected mlp network."""
def __init__(self, sa_dim, n_agents, hidden_size, agent_id=0,
agent_shuffle='none'):
super(MlpNetM, self).__init__()
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_... | HAXRD/PIC | MlpNetM | false | 8,274 | [
"MIT"
] | 28 | 658b4dd6b01e64413d5f8f0107d9167f1bd78546 | https://github.com/HAXRD/PIC/tree/658b4dd6b01e64413d5f8f0107d9167f1bd78546 |
predicates | import torch
import torch.nn as nn
import torch.nn.functional as func
class predicates(nn.Module):
def __init__(self, num_predicates, body_len):
"""
Use these to express a choice amongst predicates. For use when
learning rules.
Parameters:
----------
num_predicat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IBM/LOA | predicates | false | 8,275 | [
"MIT"
] | 12 | 9cd402c814f1d9c8b4de52ee18a3cb7ec2c6d07a | https://github.com/IBM/LOA/tree/9cd402c814f1d9c8b4de52ee18a3cb7ec2c6d07a |
ConcatBlock | import torch
import torch.nn as nn
class ConcatBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(ConcatBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns, kernel_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | HiLab-git/WSL4MIS | ConcatBlock | false | 8,276 | [
"MIT"
] | 29 | 9683e7c7409b95c0ac2169fe7964f6ca04c80d9a | https://github.com/HiLab-git/WSL4MIS/tree/9683e7c7409b95c0ac2169fe7964f6ca04c80d9a |
predicates1 | import torch
import torch.nn as nn
import torch.nn.functional as func
class predicates1(nn.Module):
def __init__(self, num_predicates, body_len):
super().__init__()
self.weights = nn.Parameter(torch.zeros(body_len, num_predicates).
uniform_(0.0, 0.1))
self.beta = nn.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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | IBM/LOA | predicates1 | false | 8,277 | [
"MIT"
] | 12 | 9cd402c814f1d9c8b4de52ee18a3cb7ec2c6d07a | https://github.com/IBM/LOA/tree/9cd402c814f1d9c8b4de52ee18a3cb7ec2c6d07a |
qd | import torch
import torch.nn as nn
class qd(nn.Module):
def __init__(self, d_dim, zd_dim):
super(qd, self).__init__()
self.fc1 = nn.Linear(zd_dim, d_dim)
self.activation = nn.LeakyReLU(inplace=True)
torch.nn.init.xavier_uniform_(self.fc1.weight)
self.fc1.bias.data.zero_()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | IamWangYunKai/DG-TrajGen | qd | false | 8,278 | [
"MIT"
] | 31 | 0a8aab7e1c05111a5afe43d53801c55942e9ff56 | https://github.com/IamWangYunKai/DG-TrajGen/tree/0a8aab7e1c05111a5afe43d53801c55942e9ff56 |
GramMatrix | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn
class GramMatrix(nn.Module):
def forward(self, input):
b, c, h, w = input.size()
F = input.view(b, c, h * w)
G = torch.bmm(F, F.transpose(1, 2))
G.div_(h * w)
return G
def get_inputs():
return... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
import torch.nn
assert_size_stride... | IceClear/MW-GAN | GramMatrix | false | 8,279 | [
"MIT"
] | 36 | acb962468c984681c4a21f7b5c14588ca8f58c00 | https://github.com/IceClear/MW-GAN/tree/acb962468c984681c4a21f7b5c14588ca8f58c00 |
MLSTM_cell | import torch
import torch.nn as nn
from torch.autograd import Variable
class MLSTM_cell(nn.Module):
def __init__(self, input_size, hidden_size, K, output_size):
super(MLSTM_cell, self).__init__()
self.hidden_size = hidden_size
self.K = K
self.output_size = output_size
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Gladys-Zhao/mRNN-mLSTM | MLSTM_cell | false | 8,280 | [
"BSD-3-Clause"
] | 15 | 23499f237ea8b0f68c96f756fbf0f4028836e64c | https://github.com/Gladys-Zhao/mRNN-mLSTM/tree/23499f237ea8b0f68c96f756fbf0f4028836e64c |
EuclideanDistance | import torch
import torch as th
import torch.nn as nn
class EuclideanDistance(nn.Module):
def __init__(self):
super(EuclideanDistance, self).__init__()
self.m = nn.Sigmoid()
def forward(self, i, j):
i_norm = self.m(i)
j_norm = self.m(j)
return th.sqrt(th.sum((i_norm -... | 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_... | IBM/aihn-ucsd | EuclideanDistance | false | 8,281 | [
"Apache-2.0"
] | 20 | 6c6a56d11c704b529a31868418e350e9760ff9d9 | https://github.com/IBM/aihn-ucsd/tree/6c6a56d11c704b529a31868418e350e9760ff9d9 |
DownBlock | import torch
from torch import nn
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size, stride,
padding, bias=True):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_size, kernel_size,
stride, padding, bias=b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Holmes-Alan/RefVAE | DownBlock | false | 8,282 | [
"MIT"
] | 13 | 836b8f1168f1b0f923b609a48e202ace7806f79c | https://github.com/Holmes-Alan/RefVAE/tree/836b8f1168f1b0f923b609a48e202ace7806f79c |
MumfordShah_Loss | import torch
import torch.nn as nn
class MumfordShah_Loss(nn.Module):
def levelsetLoss(self, output, target, penalty='l1'):
outshape = output.shape
tarshape = target.shape
self.penalty = penalty
loss = 0.0
for ich in range(tarshape[1]):
target_ = torch.unsqueez... | 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
... | HiLab-git/WSL4MIS | MumfordShah_Loss | false | 8,283 | [
"MIT"
] | 29 | 9683e7c7409b95c0ac2169fe7964f6ca04c80d9a | https://github.com/HiLab-git/WSL4MIS/tree/9683e7c7409b95c0ac2169fe7964f6ca04c80d9a |
DecoderBlock | import torch
import torch.utils.data
import torch.nn as nn
import torch.backends.cudnn
class ConvRelu(nn.Module):
"""3x3 convolution followed by ReLU activation building block.
"""
def __init__(self, num_in, num_out):
"""Creates a `ConvReLU` building block.
Args:
num_in: number... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Iceofsky/Roofpedia | DecoderBlock | false | 8,284 | [
"MIT"
] | 16 | 933dd3ff6e77ace78be6d2a23ac6692281475073 | https://github.com/Iceofsky/Roofpedia/tree/933dd3ff6e77ace78be6d2a23ac6692281475073 |
_ImpalaBlock | import torch
from torch import nn
class _ImpalaResBlock(nn.Module):
def __init__(self, n_channels: 'int'):
super().__init__()
self.n_channels = n_channels
kernel_size = 3
padding = 1
self.relu = nn.ReLU()
self.relu_inplace = nn.ReLU()
self.conv1 = 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
from torch import nn
assert_s... | IBM/vsrl-framework | _ImpalaBlock | false | 8,285 | [
"MIT"
] | 44 | 42e0853bffb5efbb66cd97178aff9e10ad18c5a9 | https://github.com/IBM/vsrl-framework/tree/42e0853bffb5efbb66cd97178aff9e10ad18c5a9 |
C51ValueNetwork | import torch
import numpy as np
import torch.nn as nn
class C51ValueNetwork(nn.Module):
"""Critic - return Q value from given states and actions. """
def __init__(self, num_states, num_actions, hidden_size, v_min, v_max,
num_atoms, device='cuda'):
"""
Args:
num_states (int... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | HzcIrving/DLRL_PlayGround | C51ValueNetwork | false | 8,286 | [
"MIT"
] | 27 | 0db9a4bdb87130d1d26aea1591ef74cbe6aaa43b | https://github.com/HzcIrving/DLRL_PlayGround/tree/0db9a4bdb87130d1d26aea1591ef74cbe6aaa43b |
NormalizeColorSpace | import torch
from torch import nn
from typing import *
class NormalizeColorSpace(nn.Module):
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
x = x.clamp(0.0, 255.0)
return x / 255.0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.as... | IntelLabs/OSCAR | NormalizeColorSpace | false | 8,287 | [
"BSD-3-Clause"
] | 13 | 25d1dea35727379117e11b7238b5a0d1ed19acad | https://github.com/IntelLabs/OSCAR/tree/25d1dea35727379117e11b7238b5a0d1ed19acad |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.