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 |
|---|---|---|---|---|---|---|---|---|---|---|
NormedConv2d | import torch
import torch.nn as nn
class NormedConv2d(nn.Conv2d):
"""Normalized Conv2d Layer.
Args:
tempeature (float, optional): Tempeature term. Default to 20.
power (int, optional): Power term. Default to 1.0.
eps (float, optional): The minimal value of divisor to
keep... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | FMsunyh/mmdetection | NormedConv2d | false | 13,672 | [
"Apache-2.0"
] | 240 | d3683eb06d1041aa3d55f35ad81d8c37718a4c2d | https://github.com/FMsunyh/mmdetection/tree/d3683eb06d1041aa3d55f35ad81d8c37718a4c2d |
TemperatureTanh | import torch
from torch import Tensor
from torch.functional import Tensor
from torch import nn as nn
class TemperatureTanh(nn.Module):
def __init__(self, temperature: 'float'=1.0) ->None:
"""The hyperbolic tangent with an optional temperature."""
super().__init__()
assert temperature != 0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_... | Felix2048/VLN-CE | TemperatureTanh | false | 13,673 | [
"MIT"
] | 106 | 4ea21f2af0d869ae65dd6677a53e788233f93761 | https://github.com/Felix2048/VLN-CE/tree/4ea21f2af0d869ae65dd6677a53e788233f93761 |
Net | import torch
import torch.nn as tnn
class Net(tnn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = tnn.Conv2d(3, 6, 5)
self.pool = tnn.MaxPool2d(2, 2)
self.conv2 = tnn.Conv2d(6, 16, 5)
self.fc1 = tnn.Linear(16 * 5 * 5, 120)
self.fc2 = tnn.Linea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 tnn
assert... | Exusial/jittor | Net | false | 13,674 | [
"Apache-2.0"
] | 2,571 | eca21d5bba5098bce4f492fa44908677b6e76588 | https://github.com/Exusial/jittor/tree/eca21d5bba5098bce4f492fa44908677b6e76588 |
Attention | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Attention(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
from torch._inductor.runtime.... | FGDBTKD/decaNLP | Attention | false | 13,675 | [
"BSD-3-Clause"
] | 2,361 | ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 | https://github.com/FGDBTKD/decaNLP/tree/ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 |
ChannelNorm | import torch
import torch.nn as nn
class ChannelNorm(nn.Module):
def __init__(self, numFeatures, epsilon=1e-05, affine=True):
super(ChannelNorm, self).__init__()
if affine:
self.weight = nn.parameter.Parameter(torch.Tensor(1,
numFeatures, 1))
self.bias = nn... | 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_... | EyalSel/CPC_audio | ChannelNorm | false | 13,676 | [
"MIT"
] | 260 | b98a1bdf1fe9ea219816db7a6c28115d404a3510 | https://github.com/EyalSel/CPC_audio/tree/b98a1bdf1fe9ea219816db7a6c28115d404a3510 |
Conv | import torch
import torch.nn as nn
class Conv(nn.Module):
"""
Convolution Module
"""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=1, bias=True, w_init='linear'):
"""
:param in_channels: dimension of input
:param out_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 torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | FarisHijazi/klaam | Conv | false | 13,677 | [
"MIT"
] | 119 | 380b3cbf167bd4288cf5f3476e51f0939dff9e2c | https://github.com/FarisHijazi/klaam/tree/380b3cbf167bd4288cf5f3476e51f0939dff9e2c |
LinearFeedforward | import torch
from torch import nn
import torch.utils.data
class Linear(nn.Linear):
def forward(self, x):
size = x.size()
return super().forward(x.contiguous().view(-1, size[-1])).view(*
size[:-1], -1)
class Feedforward(nn.Module):
def __init__(self, d_in, d_out, 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
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | FGDBTKD/decaNLP | LinearFeedforward | false | 13,678 | [
"BSD-3-Clause"
] | 2,361 | ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 | https://github.com/FGDBTKD/decaNLP/tree/ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 |
EncoderImagePrecomp | import torch
import numpy as np
from collections import OrderedDict
import torch.nn as nn
import torch.nn.init
def l2norm(X):
"""L2-normalize columns of X
"""
norm = torch.pow(X, 2).sum(dim=1).sqrt().view(X.size(0), -1)
X = torch.div(X, norm.expand_as(X))
return X
class EncoderImagePrecomp(nn.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 numpy as np
... | ExplorerFreda/VSE-C | EncoderImagePrecomp | false | 13,679 | [
"MIT"
] | 61 | 52d7742adfe017eacd74f36a5953ea2ace9f5fce | https://github.com/ExplorerFreda/VSE-C/tree/52d7742adfe017eacd74f36a5953ea2ace9f5fce |
MultiHead | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Linear(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.... | FGDBTKD/decaNLP | MultiHead | false | 13,680 | [
"BSD-3-Clause"
] | 2,361 | ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 | https://github.com/FGDBTKD/decaNLP/tree/ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 |
NormLoss | import torch
class NormLoss(torch.nn.Module):
"""
Norm penalty on function
parameters:
p - dimension of norm
"""
def __init__(self, p):
super(NormLoss, self).__init__()
self.p = p
def forward(self, beta):
return torch.norm(beta, p=self.p)
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | Filco306/TopologyLayer | NormLoss | false | 13,681 | [
"MIT"
] | 250 | 1d6261017a80cff0ee06bb896ded40777b0989b4 | https://github.com/Filco306/TopologyLayer/tree/1d6261017a80cff0ee06bb896ded40777b0989b4 |
BoundaryDiscriminator | import torch
import torch.nn as nn
class BoundaryDiscriminator(nn.Module):
def __init__(self):
super(BoundaryDiscriminator, self).__init__()
filter_num_list = [64, 128, 256, 512, 1]
self.conv1 = nn.Conv2d(1, filter_num_list[0], kernel_size=4, stride
=2, padding=2, bias=False)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | EmmaW8/BEAL | BoundaryDiscriminator | false | 13,682 | [
"MIT"
] | 95 | 945cad38a354605b8bca5bc01ae1b65848d605e1 | https://github.com/EmmaW8/BEAL/tree/945cad38a354605b8bca5bc01ae1b65848d605e1 |
OutputDiscriminator | import torch
import torch.nn as nn
class OutputDiscriminator(nn.Module):
def __init__(self):
super(OutputDiscriminator, self).__init__()
filter_num_list = [64, 128, 256, 512, 1]
self.conv1 = nn.Conv2d(2, filter_num_list[0], kernel_size=4, stride
=2, padding=2, bias=False)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | EmmaW8/BEAL | OutputDiscriminator | false | 13,683 | [
"MIT"
] | 95 | 945cad38a354605b8bca5bc01ae1b65848d605e1 | https://github.com/EmmaW8/BEAL/tree/945cad38a354605b8bca5bc01ae1b65848d605e1 |
PReLU | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.utils.data
import torch.cuda
from torch.nn import Parameter
import torch.optim
class PReLU(nn.Module):
def __init__(self):
super(PReLU, self).__init__()
self.alpha = Parameter(torch.tensor(0.25))
def for... | 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 torch.nn.parameter import Parameter
import torch.utils.data
im... | Flamexmt/LMA | PReLU | false | 13,684 | [
"MIT"
] | 321 | f6fdec2d17a2d7a7733dd5a5745312bad392cdf3 | https://github.com/Flamexmt/LMA/tree/f6fdec2d17a2d7a7733dd5a5745312bad392cdf3 |
ResidualBlock_noBN | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
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... | EvgeneyZ/TMNet | ResidualBlock_noBN | false | 13,685 | [
"Apache-2.0"
] | 90 | 8a42754747c2fa575e9108c13b5018a884f46099 | https://github.com/EvgeneyZ/TMNet/tree/8a42754747c2fa575e9108c13b5018a884f46099 |
ResBlock | import torch
import torch.nn as nn
def get_same_padding(kernel_size, dilation):
kernel_size = kernel_size + (kernel_size - 1) * (dilation - 1)
padding = (kernel_size - 1) // 2
return padding
class ResBlock(nn.Module):
def __init__(self, inplanes, planes, kernel_size=3, stride=1, dilation=1):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Flemingjp/CDVD-TSP | ResBlock | false | 13,686 | [
"MIT"
] | 232 | a2621476deb9386b1bc02570706f490d582930c8 | https://github.com/Flemingjp/CDVD-TSP/tree/a2621476deb9386b1bc02570706f490d582930c8 |
IIDIsotropicGaussianUVLoss | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class IIDIsotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of iid residuals with isotropic covariance:
$Sigma_i = sigma_i^2 I$
The loss (negative log likelihood) is then:
$1/2 sum_{i=1}^n ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import math... | FluteXu/DW-Research | IIDIsotropicGaussianUVLoss | false | 13,687 | [
"Apache-2.0"
] | 780 | 6b559d2d1d440c07e5936a65cd74a3bc657962dc | https://github.com/FluteXu/DW-Research/tree/6b559d2d1d440c07e5936a65cd74a3bc657962dc |
Swish | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.utils.data
import torch.cuda
from torch.nn import Parameter
import torch.optim
class Swish(nn.Module):
def __init__(self, dim):
super(Swish, self).__init__()
self.betas = Parameter(torch.ones(dim))
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
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.utils.data
import torch.cuda
from torch.nn import Parameter
impo... | Flamexmt/LMA | Swish | false | 13,688 | [
"MIT"
] | 321 | f6fdec2d17a2d7a7733dd5a5745312bad392cdf3 | https://github.com/Flamexmt/LMA/tree/f6fdec2d17a2d7a7733dd5a5745312bad392cdf3 |
Hsigmoid | import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
return F.relu6(x + 3.0, inplace=self.inplace) / 6.0
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards... | FluteXu/DW-Research | Hsigmoid | false | 13,689 | [
"Apache-2.0"
] | 780 | 6b559d2d1d440c07e5936a65cd74a3bc657962dc | https://github.com/FluteXu/DW-Research/tree/6b559d2d1d440c07e5936a65cd74a3bc657962dc |
GlobalAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class GlobalAttention(nn.Module):
"""
Global attention takes a matrix and a query vector. It
then computes a parameterized convex combination of the matrix
based on the input query.
Constructs a unit mapping a quer... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Fenkail/hgr_v2t | GlobalAttention | false | 13,690 | [
"MIT"
] | 190 | d8cc1c18cdaae54fd1878d6dc7b8e9c60d83fcbb | https://github.com/Fenkail/hgr_v2t/tree/d8cc1c18cdaae54fd1878d6dc7b8e9c60d83fcbb |
Decoder | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class Decoder(nn.Module):
""" VAE decoder """
def __init__(self, img_channels, latent_size):
super(Decoder, self).__init__()
self.latent_size = latent_size
self.img_channels = img_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | FabianSchuetze/world-models | Decoder | false | 13,691 | [
"MIT"
] | 440 | d6abd9ce97409734a766eb67ccf0d1967ba9bf0c | https://github.com/FabianSchuetze/world-models/tree/d6abd9ce97409734a766eb67ccf0d1967ba9bf0c |
IndepAnisotropicGaussianUVLoss | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class IndepAnisotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of independent residuals with anisotropic covariances:
$Sigma_i = sigma_i^2 I + r_i r_i^T$
The loss (negative log likelihood) is ... | 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 math... | FluteXu/DW-Research | IndepAnisotropicGaussianUVLoss | false | 13,692 | [
"Apache-2.0"
] | 780 | 6b559d2d1d440c07e5936a65cd74a3bc657962dc | https://github.com/FluteXu/DW-Research/tree/6b559d2d1d440c07e5936a65cd74a3bc657962dc |
Dueling_Critic | import torch
import torch.nn.functional as F
import torch.nn as nn
class Dueling_Critic(nn.Module):
def __init__(self, input_size, output_size, hidden_size):
super().__init__()
self.input_size = input_size
self.output_size = output_size
self.linear1 = nn.Linear(input_size, hidden_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | FlickerNiko/ai_lib | Dueling_Critic | false | 13,693 | [
"MIT"
] | 99 | 7087d4569c9a827d35dd8735b55a080834d31a82 | https://github.com/FlickerNiko/ai_lib/tree/7087d4569c9a827d35dd8735b55a080834d31a82 |
BoundaryEntDiscriminator | import torch
import torch.nn as nn
class BoundaryEntDiscriminator(nn.Module):
def __init__(self):
super(BoundaryEntDiscriminator, self).__init__()
filter_num_list = [64, 128, 256, 512, 1]
self.conv1 = nn.Conv2d(3, filter_num_list[0], kernel_size=4, stride
=2, padding=2, bias=F... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | EmmaW8/BEAL | BoundaryEntDiscriminator | false | 13,694 | [
"MIT"
] | 95 | 945cad38a354605b8bca5bc01ae1b65848d605e1 | https://github.com/EmmaW8/BEAL/tree/945cad38a354605b8bca5bc01ae1b65848d605e1 |
CombineSlices | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
import torch.fft
class CombineSlices(nn.Module):
def __init__(self, slice_dim=2):
super().__init__()
self.slice_dim = slice_dim
def forward(self, x):
return torch.index_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.utils.data
import torch.utils.data.distributed
import torch.optim
import torch.fft
assert_size_stride = to... | Gaskell-1206/fastMRI | CombineSlices | false | 13,695 | [
"MIT"
] | 815 | 1b6d1f9020bc9209afa65ef9b9f2f3fa3348901c | https://github.com/Gaskell-1206/fastMRI/tree/1b6d1f9020bc9209afa65ef9b9f2f3fa3348901c |
AttnGCNLayer | import math
import torch
import torch.nn as nn
import torch.utils.data
class GCNLayer(nn.Module):
def __init__(self, embed_size, dropout=0.0):
super().__init__()
self.embed_size = embed_size
self.ctx_layer = nn.Linear(self.embed_size, self.embed_size, bias=False
)
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.... | Fenkail/hgr_v2t | AttnGCNLayer | false | 13,696 | [
"MIT"
] | 190 | d8cc1c18cdaae54fd1878d6dc7b8e9c60d83fcbb | https://github.com/Fenkail/hgr_v2t/tree/d8cc1c18cdaae54fd1878d6dc7b8e9c60d83fcbb |
Cartesian | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.optim
import torch.fft
class Cartesian(nn.Module):
def forward(self, x):
r, phi = x[..., 0], x[..., 1]
return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1)
def get_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.triton_helpers import math as tl_math
from torch import nn
import torch.utils.data
import torch.utils.data.dist... | Gaskell-1206/fastMRI | Cartesian | false | 13,697 | [
"MIT"
] | 815 | 1b6d1f9020bc9209afa65ef9b9f2f3fa3348901c | https://github.com/Gaskell-1206/fastMRI/tree/1b6d1f9020bc9209afa65ef9b9f2f3fa3348901c |
LandmarkHead | import torch
from itertools import product as product
import torch.nn as nn
class LandmarkHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(LandmarkHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size=
(1, 1), stride=1, padd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from itertools import product as product
import torch.nn as nn
assert_size_strid... | Edward1900/Face-Detector-1MB-with-landmark | LandmarkHead | false | 13,698 | [
"MIT"
] | 907 | 16c16c4efa74b0264e0fd7fe0ddc0160f540a4bf | https://github.com/Edward1900/Face-Detector-1MB-with-landmark/tree/16c16c4efa74b0264e0fd7fe0ddc0160f540a4bf |
TransformerNet | import torch
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding)
self.conv2d = torch.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
from torch._inductor.runtime.... | EdenBD/MultiModalStory-demo | TransformerNet | false | 13,699 | [
"Apache-2.0"
] | 154 | 5e95e2aca766ca7c850e8db4973b8d51dfdba7f8 | https://github.com/EdenBD/MultiModalStory-demo/tree/5e95e2aca766ca7c850e8db4973b8d51dfdba7f8 |
CategoricalActor | import torch
from torch.distributions import Categorical
import torch.nn.functional as F
import torch.nn as nn
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 CategoricalActor(nn.Module):
def __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.... | FlickerNiko/ai_lib | CategoricalActor | false | 13,700 | [
"MIT"
] | 99 | 7087d4569c9a827d35dd8735b55a080834d31a82 | https://github.com/FlickerNiko/ai_lib/tree/7087d4569c9a827d35dd8735b55a080834d31a82 |
ClassHead | import torch
from itertools import product as product
import torch.nn as nn
class ClassHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(ClassHead, self).__init__()
self.num_anchors = num_anchors
self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 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 itertools import product as product
import torch.nn as nn
assert_size_strid... | Edward1900/Face-Detector-1MB-with-landmark | ClassHead | false | 13,701 | [
"MIT"
] | 907 | 16c16c4efa74b0264e0fd7fe0ddc0160f540a4bf | https://github.com/Edward1900/Face-Detector-1MB-with-landmark/tree/16c16c4efa74b0264e0fd7fe0ddc0160f540a4bf |
BboxHead | import torch
from itertools import product as product
import torch.nn as nn
class BboxHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(BboxHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=(
1, 1), stride=1, padding=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 itertools import product as product
import torch.nn as nn
assert_size_strid... | Edward1900/Face-Detector-1MB-with-landmark | BboxHead | false | 13,702 | [
"MIT"
] | 907 | 16c16c4efa74b0264e0fd7fe0ddc0160f540a4bf | https://github.com/Edward1900/Face-Detector-1MB-with-landmark/tree/16c16c4efa74b0264e0fd7fe0ddc0160f540a4bf |
openai_critic | import torch
import torch.nn as nn
class openai_critic(nn.Module):
def __init__(self, obs_shape_n, action_shape_n):
super(openai_critic, self).__init__()
self.LReLU = nn.LeakyReLU(0.01)
self.linear_c1 = nn.Linear(action_shape_n + obs_shape_n, 128)
self.linear_c2 = nn.Linear(128, 6... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | FlickerNiko/ai_lib | openai_critic | false | 13,703 | [
"MIT"
] | 99 | 7087d4569c9a827d35dd8735b55a080834d31a82 | https://github.com/FlickerNiko/ai_lib/tree/7087d4569c9a827d35dd8735b55a080834d31a82 |
eSEModule | import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
return F.relu6(x + 3.0, inplace=self.inplace) / 6.0
c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | FluteXu/DW-Research | eSEModule | false | 13,704 | [
"Apache-2.0"
] | 780 | 6b559d2d1d440c07e5936a65cd74a3bc657962dc | https://github.com/FluteXu/DW-Research/tree/6b559d2d1d440c07e5936a65cd74a3bc657962dc |
Encoder | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
""" VAE encoder """
def __init__(self, img_channels, latent_size):
super(Encoder, self).__init__()
self.latent_size = latent_size
self.img_channels = img_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | FabianSchuetze/world-models | Encoder | false | 13,705 | [
"MIT"
] | 440 | d6abd9ce97409734a766eb67ccf0d1967ba9bf0c | https://github.com/FabianSchuetze/world-models/tree/d6abd9ce97409734a766eb67ccf0d1967ba9bf0c |
ToRGB | from torch.autograd import Function
import torch
from torch import nn
from torch.nn import functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, up_y, down_x, do... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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
from torch import nn
from torch.nn import fu... | G-arj/StyleSwin | ToRGB | false | 13,706 | [
"MIT"
] | 398 | 0c592b3334159613ebe4a33bd6c4ea042dac42d4 | https://github.com/G-arj/StyleSwin/tree/0c592b3334159613ebe4a33bd6c4ea042dac42d4 |
AdaptiveInstanceNorm | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.cuda.amp import custom_fwd
from torch.cuda.amp import custom_bwd
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
if input.device.type == 'cpu':
rest_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.triton_helpers import libdevice
from torch.autograd... | G-arj/StyleSwin | AdaptiveInstanceNorm | false | 13,707 | [
"MIT"
] | 398 | 0c592b3334159613ebe4a33bd6c4ea042dac42d4 | https://github.com/G-arj/StyleSwin/tree/0c592b3334159613ebe4a33bd6c4ea042dac42d4 |
VAE | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class Decoder(nn.Module):
""" VAE decoder """
def __init__(self, img_channels, latent_size):
super(Decoder, self).__init__()
self.latent_size = latent_size
self.img_channels = img_channels
... | 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... | FabianSchuetze/world-models | VAE | false | 13,708 | [
"MIT"
] | 440 | d6abd9ce97409734a766eb67ccf0d1967ba9bf0c | https://github.com/FabianSchuetze/world-models/tree/d6abd9ce97409734a766eb67ccf0d1967ba9bf0c |
FSM | import torch
from torch import Tensor
from torch import nn
from torch.nn import functional as F
class FSM(nn.Module):
def __init__(self, c1, c2):
super().__init__()
self.conv_atten = nn.Conv2d(c1, c1, 1, bias=False)
self.conv = nn.Conv2d(c1, c2, 1, bias=False)
def forward(self, x: 'T... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Genevievekim/semantic-segmentation-1 | FSM | false | 13,709 | [
"BSD-3-Clause"
] | 196 | f28b026e44cff80fe3ca4cac94cea27e4073821b | https://github.com/Genevievekim/semantic-segmentation-1/tree/f28b026e44cff80fe3ca4cac94cea27e4073821b |
Quantization | import torch
import torch.nn as nn
import torch.utils.data
class Quantization(nn.Module):
@staticmethod
def forward(input):
return torch.round(input)
@staticmethod
def backward(grad_output):
grad_input = grad_output.clone()
return grad_input
def get_inputs():
return [to... | 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
assert_size_stride = torch._C._dy... | Geunwoo-Jeon/iclr_17_compression | Quantization | false | 13,710 | [
"MIT"
] | 56 | a28746b1f1c518d91125d8f289d9511cde488c77 | https://github.com/Geunwoo-Jeon/iclr_17_compression/tree/a28746b1f1c518d91125d8f289d9511cde488c77 |
UNet | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.functional import F
from torch.nn import functional as F
class down(nn.Module):
"""
A class for creating neural network blocks containing layers:
Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU
Thi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | CM-BF/FeatureFlow | UNet | false | 13,711 | [
"MIT"
] | 161 | 06642697922f17211e5faa353e24b1a0946885b1 | https://github.com/CM-BF/FeatureFlow/tree/06642697922f17211e5faa353e24b1a0946885b1 |
PA | import torch
from torch import nn
class PA(nn.Module):
def __init__(self, dim):
super().__init__()
self.pa_conv = nn.Conv2d(dim, dim, 3, 1, 1, groups=dim)
def forward(self, x):
return x * self.pa_conv(x).sigmoid()
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Genevievekim/semantic-segmentation-1 | PA | false | 13,712 | [
"BSD-3-Clause"
] | 196 | f28b026e44cff80fe3ca4cac94cea27e4073821b | https://github.com/Genevievekim/semantic-segmentation-1/tree/f28b026e44cff80fe3ca4cac94cea27e4073821b |
BasicBlock_AP | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock_AP(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, stride=1, norm='instancenorm'):
super(BasicBlock_AP, self).__init__()
self.norm = norm
self.stride = stride
self.conv1 = nn.Co... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | GeorgeCazenavette/mtt-distillation | BasicBlock_AP | false | 13,713 | [
"MIT"
] | 105 | e13a65980183fbc33238ca6cbb6cfec819018e2d | https://github.com/GeorgeCazenavette/mtt-distillation/tree/e13a65980183fbc33238ca6cbb6cfec819018e2d |
SqueezeExcitation | import torch
from torch import Tensor
from typing import Optional
from torch import nn
from torch.nn import functional as F
def _make_divisible(v: 'float', divisor: 'int', min_value: 'Optional[int]'=None
) ->int:
"""
This function is taken from the original tf repo.
It ensures that all layers have a c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import Tensor
from... | Genevievekim/semantic-segmentation-1 | SqueezeExcitation | false | 13,714 | [
"BSD-3-Clause"
] | 196 | f28b026e44cff80fe3ca4cac94cea27e4073821b | https://github.com/Genevievekim/semantic-segmentation-1/tree/f28b026e44cff80fe3ca4cac94cea27e4073821b |
GlobalAttention | import torch
import torch.nn as nn
import torch.utils.data
import torch.cuda
import torch.optim
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not all arguments ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Flamexmt/LMA | GlobalAttention | false | 13,715 | [
"MIT"
] | 321 | f6fdec2d17a2d7a7733dd5a5745312bad392cdf3 | https://github.com/Flamexmt/LMA/tree/f6fdec2d17a2d7a7733dd5a5745312bad392cdf3 |
IdfCombination | import torch
from torch import nn
class IdfCombination(nn.Module):
def forward(self, scores, idf):
idf = idf.softmax(dim=1)
return (scores * idf).sum(dim=1)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | Georgetown-IR-Lab/OpenNIR | IdfCombination | false | 13,716 | [
"MIT"
] | 140 | 7d93e8643fe311e3e9c7a0678efe9775fd80485e | https://github.com/Georgetown-IR-Lab/OpenNIR/tree/7d93e8643fe311e3e9c7a0678efe9775fd80485e |
MLP | import torch
from torch import Tensor
from torch import nn
class MLP(nn.Module):
def __init__(self, dim, embed_dim):
super().__init__()
self.proj = nn.Linear(dim, embed_dim)
def forward(self, x: 'Tensor') ->Tensor:
x = x.flatten(2).transpose(1, 2)
x = self.proj(x)
ret... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | Genevievekim/semantic-segmentation-1 | MLP | false | 13,717 | [
"BSD-3-Clause"
] | 196 | f28b026e44cff80fe3ca4cac94cea27e4073821b | https://github.com/Genevievekim/semantic-segmentation-1/tree/f28b026e44cff80fe3ca4cac94cea27e4073821b |
GEGLU | import torch
from torch import nn
import torch.nn.functional as F
class GEGLU(nn.Module):
def forward(self, x):
x, gates = x.chunk(2, dim=-1)
return x * F.gelu(gates)
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Gitsamshi/DALLE-pytorch | GEGLU | false | 13,718 | [
"MIT"
] | 4,025 | 6cfc43158a4615865e97c839133290afcf289824 | https://github.com/Gitsamshi/DALLE-pytorch/tree/6cfc43158a4615865e97c839133290afcf289824 |
DivideMax | import torch
from torch import nn
class DivideMax(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
def forward(self, x):
maxes = x.amax(dim=self.dim, keepdim=True).detach()
return x / maxes
def get_inputs():
return [torch.rand([4, 4, 4, 4, 4])]
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | Gitsamshi/DALLE-pytorch | DivideMax | false | 13,719 | [
"MIT"
] | 4,025 | 6cfc43158a4615865e97c839133290afcf289824 | https://github.com/Gitsamshi/DALLE-pytorch/tree/6cfc43158a4615865e97c839133290afcf289824 |
SumCombination | import torch
from torch import nn
class SumCombination(nn.Module):
def __init__(self, dim_in, normalize=True):
super(SumCombination, self).__init__()
self.conv = nn.Conv1d(dim_in, 1, 1)
self.normalize = normalize
def forward(self, x, qlen):
scores = self.conv(x.permute(0, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Georgetown-IR-Lab/OpenNIR | SumCombination | false | 13,720 | [
"MIT"
] | 140 | 7d93e8643fe311e3e9c7a0678efe9775fd80485e | https://github.com/Georgetown-IR-Lab/OpenNIR/tree/7d93e8643fe311e3e9c7a0678efe9775fd80485e |
MaxPooling | import torch
import torch.nn as nn
class MaxPooling(nn.Module):
def __init__(self):
super(MaxPooling, self).__init__()
self.MIN = -1000000.0
"""
(item, subitem) can be (word, characters), or (sentence, words)
x: num_items x max_subitem_size x input_size
x_mask: num_items x max_... | 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... | GingerNg/SDNet | MaxPooling | false | 13,721 | [
"MIT"
] | 112 | 48ad8cc57c9a02aaad10e34d0c91a174ac68f056 | https://github.com/GingerNg/SDNet/tree/48ad8cc57c9a02aaad10e34d0c91a174ac68f056 |
LinearBlock | import torch
from scipy.stats import truncnorm
def truncated_normal_(tensor, mean=0.0, std=1.0):
values = truncnorm.rvs(-2, 2, size=tensor.shape)
values = mean + std * values
tensor.copy_(torch.from_numpy(values))
return tensor
def fc_init_(module):
if hasattr(module, 'weight') and module.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
from torch._inductor.runtime.... | Brikwerk/learn2learn | LinearBlock | false | 13,722 | [
"MIT"
] | 1,774 | 7997c13c26ec627d13ce77ba98427260df78ada8 | https://github.com/Brikwerk/learn2learn/tree/7997c13c26ec627d13ce77ba98427260df78ada8 |
SumAggregator | import torch
import torch.nn as nn
class SumAggregator(nn.Module):
def __init__(self):
super(SumAggregator, self).__init__()
def forward(self, neighbor):
return torch.sum(neighbor, dim=1)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | GraphNAS/GraphNAS | SumAggregator | false | 13,723 | [
"Apache-2.0"
] | 94 | b4f05bb10b8b96bb9e82344bfae36a23db2431a6 | https://github.com/GraphNAS/GraphNAS/tree/b4f05bb10b8b96bb9e82344bfae36a23db2431a6 |
GDN | from torch.autograd import Function
import torch
import torch.nn as nn
import torch.utils.data
class LowerBound(Function):
@staticmethod
def forward(ctx, inputs, bound):
b = torch.ones_like(inputs) * bound
ctx.save_for_backward(inputs, b)
return torch.max(inputs, b)
@staticmethod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Geunwoo-Jeon/iclr_17_compression | GDN | false | 13,724 | [
"MIT"
] | 56 | a28746b1f1c518d91125d8f289d9511cde488c77 | https://github.com/Geunwoo-Jeon/iclr_17_compression/tree/a28746b1f1c518d91125d8f289d9511cde488c77 |
BitEstimator | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Bitparm(nn.Module):
"""
save params
"""
def __init__(self, channel, final=False):
super(Bitparm, self).__init__()
self.final = final
self.h = nn.Parameter(torch.nn.init.normal_(tor... | 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
import torch.nn.functional as F
import t... | Geunwoo-Jeon/iclr_17_compression | BitEstimator | false | 13,725 | [
"MIT"
] | 56 | a28746b1f1c518d91125d8f289d9511cde488c77 | https://github.com/Geunwoo-Jeon/iclr_17_compression/tree/a28746b1f1c518d91125d8f289d9511cde488c77 |
BCEWithLogitsLossWeighted | import torch
import torch.nn as nn
class WeightedLoss(nn.Module):
def __init__(self):
super(WeightedLoss, self).__init__()
self.weighted = False
def generate_weight_mask(self, mask, to_ignore=None):
""" Generates a weight mask where pixel weights are inversely proportional to
... | 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... | Guangyun-Xu/uois | BCEWithLogitsLossWeighted | false | 13,726 | [
"MIT"
] | 106 | 00069af841dd3ea9a86e6e3a89c3b7222240e6e5 | https://github.com/Guangyun-Xu/uois/tree/00069af841dd3ea9a86e6e3a89c3b7222240e6e5 |
TransformerEncoderLayer | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Linear(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.... | FGDBTKD/decaNLP | TransformerEncoderLayer | false | 13,727 | [
"BSD-3-Clause"
] | 2,361 | ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 | https://github.com/FGDBTKD/decaNLP/tree/ff2d7e18cc226197bb8fe5fe796c4b8bc0395e86 |
AveragePooling | import torch
import torch.nn as nn
class AveragePooling(nn.Module):
def __init__(self):
super(AveragePooling, self).__init__()
"""
(item, subitem) can be (word, characters), or (sentence, words)
x: num_items x max_subitem_size x input_size
x_mask: num_items x max_subitem_size
retu... | 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... | GingerNg/SDNet | AveragePooling | false | 13,728 | [
"MIT"
] | 112 | 48ad8cc57c9a02aaad10e34d0c91a174ac68f056 | https://github.com/GingerNg/SDNet/tree/48ad8cc57c9a02aaad10e34d0c91a174ac68f056 |
CELossWeighted | import torch
import torch.nn as nn
class WeightedLoss(nn.Module):
def __init__(self):
super(WeightedLoss, self).__init__()
self.weighted = False
def generate_weight_mask(self, mask, to_ignore=None):
""" Generates a weight mask where pixel weights are inversely proportional to
... | 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
... | Guangyun-Xu/uois | CELossWeighted | false | 13,729 | [
"MIT"
] | 106 | 00069af841dd3ea9a86e6e3a89c3b7222240e6e5 | https://github.com/Guangyun-Xu/uois/tree/00069af841dd3ea9a86e6e3a89c3b7222240e6e5 |
Conv2d_GN_ReLU | import torch
import torch.nn as nn
class Conv2d_GN_ReLU(nn.Module):
""" Implements a module that performs
conv2d + groupnorm + ReLU +
Assumes kernel size is odd
"""
def __init__(self, in_channels, out_channels, num_groups, ksize=3, stride=1
):
super(Conv2d_GN_ReLU, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Guangyun-Xu/uois | Conv2d_GN_ReLU | false | 13,730 | [
"MIT"
] | 106 | 00069af841dd3ea9a86e6e3a89c3b7222240e6e5 | https://github.com/Guangyun-Xu/uois/tree/00069af841dd3ea9a86e6e3a89c3b7222240e6e5 |
CosAttention | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Parameter
class ConstAttention(nn.Module):
def __init__(self, **kwargs):
super(ConstAttention, self).__init__()
def forward(self, neighbor_vecs, self_vecs):
return 1
class GatAttention(ConstAttention):
... | 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.functional as F
import torch.nn as nn
from torch.nn import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_siz... | GraphNAS/GraphNAS | CosAttention | false | 13,731 | [
"Apache-2.0"
] | 94 | b4f05bb10b8b96bb9e82344bfae36a23db2431a6 | https://github.com/GraphNAS/GraphNAS/tree/b4f05bb10b8b96bb9e82344bfae36a23db2431a6 |
Downsampler | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def bilinear_kernel(size, normalize=False):
"""
Make a 2D bilinear kernel suitable for upsampling/downsampling with
normalize=False/True. The kernel is size x size square.
Take
size: kernel size (square)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.nn.functional as F
assert_... | Global19/revolver | Downsampler | false | 13,732 | [
"BSD-2-Clause"
] | 151 | 200082798d862516de6d9aa18e863a5968127a3f | https://github.com/Global19/revolver/tree/200082798d862516de6d9aa18e863a5968127a3f |
GatAttention | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Parameter
class ConstAttention(nn.Module):
def __init__(self, **kwargs):
super(ConstAttention, self).__init__()
def forward(self, neighbor_vecs, self_vecs):
return 1
class GatAttention(ConstAttention):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = to... | GraphNAS/GraphNAS | GatAttention | false | 13,733 | [
"Apache-2.0"
] | 94 | b4f05bb10b8b96bb9e82344bfae36a23db2431a6 | https://github.com/GraphNAS/GraphNAS/tree/b4f05bb10b8b96bb9e82344bfae36a23db2431a6 |
VAEEncoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class VAEEncoder(nn.Module):
def __init__(self, z_size):
super(VAEEncoder, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 4, stride=2)
self.conv2 = nn.Conv2d(32, 64, 4, stride=2)
self.conv3 = nn.Conv2d(64, 128, 4, ... | 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... | GSSJacky/neural-painters-pytorch | VAEEncoder | false | 13,734 | [
"MIT"
] | 138 | 017b32f1eced4c36e6ae15b73b52b9682994d3e6 | https://github.com/GSSJacky/neural-painters-pytorch/tree/017b32f1eced4c36e6ae15b73b52b9682994d3e6 |
Interpolator | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def bilinear_kernel(size, normalize=False):
"""
Make a 2D bilinear kernel suitable for upsampling/downsampling with
normalize=False/True. The kernel is size x size square.
Take
size: kernel size (square)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Global19/revolver | Interpolator | false | 13,735 | [
"BSD-2-Clause"
] | 151 | 200082798d862516de6d9aa18e863a5968127a3f | https://github.com/Global19/revolver/tree/200082798d862516de6d9aa18e863a5968127a3f |
TransformerEncoderLayer | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
def _normalize(tensor, norm_layer):
"""
Broadcast layer norm
"""
size = tensor.size()
return norm_layer(tensor.view(-1, size[-1])).view(size)
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, 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.... | Guaguago/Persona-Dialogue-Generation | TransformerEncoderLayer | false | 13,736 | [
"MIT"
] | 258 | 0d4526ec8eddff62751a70666e14d72103906f44 | https://github.com/Guaguago/Persona-Dialogue-Generation/tree/0d4526ec8eddff62751a70666e14d72103906f44 |
SpeakNet | import math
import torch
import torch.nn as nn
def xavier_init(module):
"""Xavier initializer for module parameters."""
for parameter in module.parameters():
if len(parameter.data.shape) == 1:
parameter.data.fill_(0)
else:
fan_in = parameter.data.size(0)
fan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Guaguago/Persona-Dialogue-Generation | SpeakNet | false | 13,737 | [
"MIT"
] | 258 | 0d4526ec8eddff62751a70666e14d72103906f44 | https://github.com/Guaguago/Persona-Dialogue-Generation/tree/0d4526ec8eddff62751a70666e14d72103906f44 |
VAEDecoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class VAEDecoder(nn.Module):
def __init__(self, z_size):
super(VAEDecoder, self).__init__()
self.fc = nn.Linear(z_size, 4 * 256)
self.deconv1 = nn.ConvTranspose2d(1024, 128, 5, stride=2)
self.deconv2 = nn.ConvTrans... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | GSSJacky/neural-painters-pytorch | VAEDecoder | false | 13,738 | [
"MIT"
] | 138 | 017b32f1eced4c36e6ae15b73b52b9682994d3e6 | https://github.com/GSSJacky/neural-painters-pytorch/tree/017b32f1eced4c36e6ae15b73b52b9682994d3e6 |
GatSymAttention | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Parameter
class ConstAttention(nn.Module):
def __init__(self, **kwargs):
super(ConstAttention, self).__init__()
def forward(self, neighbor_vecs, self_vecs):
return 1
class GatAttention(ConstAttention):
... | 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.functional as F
import torch.nn as nn
from torch.nn import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_siz... | GraphNAS/GraphNAS | GatSymAttention | false | 13,739 | [
"Apache-2.0"
] | 94 | b4f05bb10b8b96bb9e82344bfae36a23db2431a6 | https://github.com/GraphNAS/GraphNAS/tree/b4f05bb10b8b96bb9e82344bfae36a23db2431a6 |
SVHNConvNet | import torch
from torch import nn
import torch.nn.functional as F
class SVHNConvNet(nn.Module):
def __init__(self):
super(SVHNConvNet, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 5, 1, 2)
self.conv2 = nn.Conv2d(32, 64, 5, 1, 2)
self.conv3 = nn.Conv2d(64, 128, 5, 1, 2)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | Felix-Petersen/algovision | SVHNConvNet | false | 13,740 | [
"MIT"
] | 52 | b1b9596028af62de1c1d2c4e74cbd6168fc3ae3c | https://github.com/Felix-Petersen/algovision/tree/b1b9596028af62de1c1d2c4e74cbd6168fc3ae3c |
CELossWeightedMasked | import torch
import torch.nn as nn
class WeightedLoss(nn.Module):
def __init__(self):
super(WeightedLoss, self).__init__()
self.weighted = False
def generate_weight_mask(self, mask, to_ignore=None):
""" Generates a weight mask where pixel weights are inversely proportional to
... | 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
... | Guangyun-Xu/uois | CELossWeightedMasked | false | 13,741 | [
"MIT"
] | 106 | 00069af841dd3ea9a86e6e3a89c3b7222240e6e5 | https://github.com/Guangyun-Xu/uois/tree/00069af841dd3ea9a86e6e3a89c3b7222240e6e5 |
DistanceWiseRKD | import torch
from torch import nn
import torch.nn.functional as F
def euclidean_distance(pred, squared=False, eps=1e-12):
"""Calculate the Euclidean distance between the two examples in the output
representation space.
Args:
pred (torch.Tensor): The prediction of the teacher or student with
... | 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
import ... | HIT-cwh/mmrazor | DistanceWiseRKD | false | 13,742 | [
"Apache-2.0"
] | 553 | 2dad24044d7f1dad88f20221f8fc071dd40fdd4f | https://github.com/HIT-cwh/mmrazor/tree/2dad24044d7f1dad88f20221f8fc071dd40fdd4f |
KLDivergence | import torch
from torch import nn
import torch.nn.functional as F
class KLDivergence(nn.Module):
"""A measure of how one probability distribution Q is different from a
second, reference probability distribution P.
Args:
tau (float): Temperature coefficient. Defaults to 1.0.
reduction (str... | 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 ... | HIT-cwh/mmrazor | KLDivergence | false | 13,743 | [
"Apache-2.0"
] | 553 | 2dad24044d7f1dad88f20221f8fc071dd40fdd4f | https://github.com/HIT-cwh/mmrazor/tree/2dad24044d7f1dad88f20221f8fc071dd40fdd4f |
Conv2d_GN_ReLUx2 | import torch
import torch.nn as nn
class Conv2d_GN_ReLU(nn.Module):
""" Implements a module that performs
conv2d + groupnorm + ReLU +
Assumes kernel size is odd
"""
def __init__(self, in_channels, out_channels, num_groups, ksize=3, stride=1
):
super(Conv2d_GN_ReLU, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Guangyun-Xu/uois | Conv2d_GN_ReLUx2 | false | 13,744 | [
"MIT"
] | 106 | 00069af841dd3ea9a86e6e3a89c3b7222240e6e5 | https://github.com/Guangyun-Xu/uois/tree/00069af841dd3ea9a86e6e3a89c3b7222240e6e5 |
NullDiscriminator | import torch
import torch.nn as nn
import torch.utils.data
class NullDiscriminator(nn.Module):
def __init__(self):
super(NullDiscriminator, self).__init__()
def forward(self, inputs, y=None):
d = inputs.sum(1, keepdim=True)
return d
def get_inputs():
return [torch.rand([4, 4, 4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | HappyBelief/ContraD | NullDiscriminator | false | 13,745 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
BiDAFAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
def masked_softmax(logits, mask, dim=-1, log_softmax=False):
"""Take the softmax of `logits` over given dimension, and set
entries to 0 wherever `mask` is 0.
Args:
logits (torch.Tensor): Inputs to the softmax function.
mas... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HakobJak/ml-mipt | BiDAFAttention | false | 13,746 | [
"MIT"
] | 440 | ab0cbd5d553e9da309bda54d35b4e93a8eb99696 | https://github.com/HakobJak/ml-mipt/tree/ab0cbd5d553e9da309bda54d35b4e93a8eb99696 |
FusedLeakyReLU | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
return F.leaky_relu(input + bias.view(1, bias.shape[0], *rest_dim),
negative_slope=negative_sl... | 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.functional as F
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_strid... | HappyBelief/ContraD | FusedLeakyReLU | false | 13,747 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
GluMlp | import torch
import torch.nn as nn
import torch.utils.collect_env
class GluMlp(nn.Module):
""" MLP w/ GLU style gating
See: https://arxiv.org/abs/1612.08083, https://arxiv.org/abs/2002.05202
"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.Sigmoid, dro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.collect_env
assert_size_stride = torch.... | HaotianUpenn/scatterbrain | GluMlp | false | 13,748 | [
"Apache-2.0"
] | 49 | c026128d7362ae627641d11d4e5627bc1f400eb1 | https://github.com/HaotianUpenn/scatterbrain/tree/c026128d7362ae627641d11d4e5627bc1f400eb1 |
AngleWiseRKD | import torch
from torch import nn
import torch.nn.functional as F
def angle(pred):
"""Calculate the angle-wise relational potential which measures the angle
formed by the three examples in the output representation space.
Args:
pred (torch.Tensor): The prediction of the teacher or student with
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HIT-cwh/mmrazor | AngleWiseRKD | false | 13,749 | [
"Apache-2.0"
] | 553 | 2dad24044d7f1dad88f20221f8fc071dd40fdd4f | https://github.com/HIT-cwh/mmrazor/tree/2dad24044d7f1dad88f20221f8fc071dd40fdd4f |
Mul | import torch
import torch as ch
class Mul(ch.nn.Module):
def __init__(self, weight):
super(Mul, self).__init__()
self.weight = weight
def forward(self, x):
return x * self.weight
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {'weig... | 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 as ch
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strid... | Hadisalman/ffcv | Mul | false | 13,750 | [
"Apache-2.0"
] | 1,969 | 64bd2b9e9c9fc3779ba13ef958ae479ecfac9c7f | https://github.com/Hadisalman/ffcv/tree/64bd2b9e9c9fc3779ba13ef958ae479ecfac9c7f |
Attention | import torch
import torch.nn.functional as F
from torch import nn
class Attention(nn.Module):
def __init__(self, input_size, hidden_size):
super(Attention, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, 1)
def softmax_mask(self, val, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HIT-SCIR-xuanxuan/OpenKS | Attention | false | 13,751 | [
"Apache-2.0"
] | 88 | a7f2ce0890822113322aad22e98d6c961e63caef | https://github.com/HIT-SCIR-xuanxuan/OpenKS/tree/a7f2ce0890822113322aad22e98d6c961e63caef |
ConvMlp | import torch
import torch.nn as nn
import torch.utils.collect_env
class ConvMlp(nn.Module):
""" MLP using 1x1 convs that keeps spatial dims
"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.ReLU, norm_layer=None, drop=0.0):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | HaotianUpenn/scatterbrain | ConvMlp | false | 13,752 | [
"Apache-2.0"
] | 49 | c026128d7362ae627641d11d4e5627bc1f400eb1 | https://github.com/HaotianUpenn/scatterbrain/tree/c026128d7362ae627641d11d4e5627bc1f400eb1 |
BasicBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1)
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_planes, plan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dyn... | HappyBelief/ContraD | BasicBlock | false | 13,753 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
FullAttention | import math
import torch
import torch.nn as nn
import torch.utils.collect_env
class FullAttention(nn.Module):
"""Implement the scaled dot product attention with softmax.
Arguments
---------
softmax_temp: The temperature to use for the softmax attention.
(default: 1/sqrt(d_key... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HaotianUpenn/scatterbrain | FullAttention | false | 13,754 | [
"Apache-2.0"
] | 49 | c026128d7362ae627641d11d4e5627bc1f400eb1 | https://github.com/HaotianUpenn/scatterbrain/tree/c026128d7362ae627641d11d4e5627bc1f400eb1 |
BayesLinear | from torch.nn import Module
import math
import torch
from torch.nn import Parameter
import torch.nn.functional as F
class BayesLinear(Module):
"""
Applies Bayesian Linear
Arguments:
prior_mu (Float): mean of prior normal distribution.
prior_sigma (Float): sigma of prior normal distributio... | 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.triton_helpers import math... | Harry24k/bayesian-neural-network-pytorch | BayesLinear | false | 13,755 | [
"MIT"
] | 178 | d2272f09e0d08c1abe1f53ce6df56b31494d7020 | https://github.com/Harry24k/bayesian-neural-network-pytorch/tree/d2272f09e0d08c1abe1f53ce6df56b31494d7020 |
ResidualAttentionBlock | import torch
from torch import nn
from collections import OrderedDict
class LayerNorm(nn.LayerNorm):
"""Subclass torch's LayerNorm to handle fp16."""
def forward(self, x: 'torch.Tensor'):
orig_type = x.dtype
ret = super().forward(x.type(torch.float32))
return ret.type(orig_type)
cla... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HIT-SCIR-xuanxuan/OpenKS | ResidualAttentionBlock | false | 13,756 | [
"Apache-2.0"
] | 88 | a7f2ce0890822113322aad22e98d6c961e63caef | https://github.com/HIT-SCIR-xuanxuan/OpenKS/tree/a7f2ce0890822113322aad22e98d6c961e63caef |
EqualLinear | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
return F.leaky_relu(input + bias.view(1, bias.shape[0], *rest_dim),
negative_slope... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn.functional as F
import torch.u... | HappyBelief/ContraD | EqualLinear | false | 13,757 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
GELU | import torch
import torch.nn.functional as F
import torch.utils.model_zoo
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class GELU(torch.nn.Module):
def forward(self, x):
return F.gelu(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.model_zoo
import torch.nn.parallel
import torch.optim
import... | HelenR6/imagenet-r | GELU | false | 13,758 | [
"MIT"
] | 155 | 0bf04f2bf5d60d1098fc9a78f4e8c042e434eb69 | https://github.com/HelenR6/imagenet-r/tree/0bf04f2bf5d60d1098fc9a78f4e8c042e434eb69 |
ConvBnRel | import torch
from torch.autograd.gradcheck import *
import torch.nn as nn
import torch.nn
class ConvBnRel(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
active_unit='relu', same_padding=False, bn=False, reverse=False,
bias=False):
super(ConvBnRel, 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.autograd.gradcheck... | HastingsGreer/mermaid | ConvBnRel | false | 13,759 | [
"Apache-2.0"
] | 120 | bd13c5fc427eb8cd9054973a8eaaeb302078182d | https://github.com/HastingsGreer/mermaid/tree/bd13c5fc427eb8cd9054973a8eaaeb302078182d |
HLoss | import torch
from torch.autograd.gradcheck import *
import torch.nn as nn
import torch.nn
class HLoss(nn.Module):
def __init__(self):
super(HLoss, self).__init__()
def forward(self, x, spacing):
volumeElement = spacing.prod()
b = x * torch.log(x)
b = -1.0 * b.sum() * volumeEl... | 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.autograd.gr... | HastingsGreer/mermaid | HLoss | false | 13,760 | [
"Apache-2.0"
] | 120 | bd13c5fc427eb8cd9054973a8eaaeb302078182d | https://github.com/HastingsGreer/mermaid/tree/bd13c5fc427eb8cd9054973a8eaaeb302078182d |
TinyDiscriminator | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class TinyDiscriminator(nn.Module):
def __init__(self, n_features, n_classes=1, d_hidden=128):
super(TinyDiscriminator, self).__init__()
self.n_features = n_features
self.n_classes = n_classes
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | HappyBelief/ContraD | TinyDiscriminator | false | 13,761 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
UpBlock | import torch
import torch.cuda
import torch.nn as nn
class UpBlock(nn.Module):
def __init__(self, in_, out, scale):
super().__init__()
self.up_conv = nn.Conv2d(in_, out, 1)
self.upsample = nn.UpsamplingNearest2d(scale_factor=scale)
def forward(self, x):
return self.upsample(s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.cuda
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | HalfLemon/kaggle-dstl | UpBlock | false | 13,762 | [
"MIT"
] | 218 | b1d3a518bbbd3503bdf07400841183d2386fd158 | https://github.com/HalfLemon/kaggle-dstl/tree/b1d3a518bbbd3503bdf07400841183d2386fd158 |
Norm | import torch
from torch import 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, x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | HebatallaTarek/Empathy-Mental-Health | Norm | false | 13,763 | [
"BSD-3-Clause"
] | 66 | 16e2a5f93aabd22803bb39805f8e76c8bea0ccf2 | https://github.com/HebatallaTarek/Empathy-Mental-Health/tree/16e2a5f93aabd22803bb39805f8e76c8bea0ccf2 |
GRUCell | import torch
import numpy as np
import torch.nn.functional as F
import torch.utils.data
import torch.nn as nn
class GRUCell(nn.Module):
def __init__(self, input_size, hidden_size, bias=True):
super(GRUCell, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | H4LL/PyGrid | GRUCell | false | 13,764 | [
"Apache-2.0"
] | 69 | 62d5ba6f207498ca365c12ac59dbcd11c1337881 | https://github.com/H4LL/PyGrid/tree/62d5ba6f207498ca365c12ac59dbcd11c1337881 |
LastLevelMaxPool | import torch
import torch.utils.data
from torchvision.transforms import functional as F
from torch import nn
import torch.nn.functional as F
import torchvision.transforms.functional as F
from torch.nn import functional as F
class LastLevelMaxPool(nn.Module):
def forward(self, x):
return [F.max_pool2d(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.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | BorisLestsov/retinamask | LastLevelMaxPool | false | 13,765 | [
"MIT"
] | 706 | 265a65f018c64220bcea946d306fc7b07a692b16 | https://github.com/BorisLestsov/retinamask/tree/265a65f018c64220bcea946d306fc7b07a692b16 |
AdaptiveConcatPool2d | import torch
from torch import nn
from torchvision.models import *
class AdaptiveConcatPool2d(nn.Module):
def __init__(self, sz=None):
super().__init__()
sz = sz or (1, 1)
self.ap = nn.AdaptiveAvgPool2d(sz)
self.mp = nn.AdaptiveMaxPool2d(sz)
def forward(self, x):
retu... | 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 torchvision.models import *
assert_size_stride = torch._C._dyna... | ArcGIS/raster-deep-learning | AdaptiveConcatPool2d | false | 13,766 | [
"Apache-2.0"
] | 154 | 0af006d70c605707bab2bb11ae6393fd65ce8820 | https://github.com/ArcGIS/raster-deep-learning/tree/0af006d70c605707bab2bb11ae6393fd65ce8820 |
UPChannelRPN | import torch
import torch.nn.functional as F
import torch.nn as nn
def xcorr_fast(x, kernel):
"""group conv2d to calculate cross correlation, fast version
"""
batch = kernel.size()[0]
pk = kernel.view(-1, x.size()[1], kernel.size()[2], kernel.size()[3])
px = x.view(1, -1, x.size()[2], x.size()[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
import torch.nn.functional as F
import torch.nn as nn
assert_size_stride = torch... | DansYU/pysot | UPChannelRPN | false | 13,767 | [
"Apache-2.0"
] | 4,318 | 3a43faccbba0280ef499736c82fd195f9c38373d | https://github.com/DansYU/pysot/tree/3a43faccbba0280ef499736c82fd195f9c38373d |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd... | HappyBelief/ContraD | ModulatedConv2d | false | 13,768 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
BayesConv2d | from torch.nn import Module
import math
import torch
from torch.nn import Parameter
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
class _BayesConvNd(Module):
"""
Applies Bayesian Convolution
Arguments:
prior_mu (Float): mean of prior normal distribution.
prior_s... | 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.triton_helpers import math... | Harry24k/bayesian-neural-network-pytorch | BayesConv2d | false | 13,769 | [
"MIT"
] | 178 | d2272f09e0d08c1abe1f53ce6df56b31494d7020 | https://github.com/Harry24k/bayesian-neural-network-pytorch/tree/d2272f09e0d08c1abe1f53ce6df56b31494d7020 |
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/OISR-PyTorch | ChannelPool | false | 13,770 | [
"BSD-2-Clause"
] | 141 | bbe0c88f71fe565a2842df7971b62a9bc5a56c48 | https://github.com/HolmesShuan/OISR-PyTorch/tree/bbe0c88f71fe565a2842df7971b62a9bc5a56c48 |
AttentionPool2d | import torch
import torch.nn.functional as F
from torch import nn
class AttentionPool2d(nn.Module):
def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads:
'int', output_dim: 'int'=None):
super().__init__()
self.positional_embedding = nn.Parameter(torch.randn(spacial_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.... | HIT-SCIR-xuanxuan/OpenKS | AttentionPool2d | false | 13,771 | [
"Apache-2.0"
] | 88 | a7f2ce0890822113322aad22e98d6c961e63caef | https://github.com/HIT-SCIR-xuanxuan/OpenKS/tree/a7f2ce0890822113322aad22e98d6c961e63caef |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.