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 |
|---|---|---|---|---|---|---|---|---|---|---|
Critic | import torch
import torch.nn as nn
class Critic(nn.Module):
def __init__(self, observation_size, action_size):
super().__init__()
self.fc1 = nn.Linear(observation_size + action_size, 256)
self.fc2 = nn.Linear(256, 256)
self.fc3 = nn.Linear(256, 1)
def forward(self, x, action)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | SeanNobel/d4rl-pybullet | Critic | false | 14,379 | [
"MIT"
] | 130 | 9f2f56c63bb7a80ebcbc4217cd7689e446aafd41 | https://github.com/SeanNobel/d4rl-pybullet/tree/9f2f56c63bb7a80ebcbc4217cd7689e446aafd41 |
HardSwish | import torch
import torch.nn as nn
class HardSwish(nn.Module):
def __init__(self, inplace=False):
super(HardSwish, self).__init__()
self.act = nn.ReLU6(inplace)
"""forward"""
def forward(self, x):
return x * self.act(x + 3) / 6
def get_inputs():
return [torch.rand([4, 4, 4,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | SegmentationBLWX/sssegmentation | HardSwish | false | 14,380 | [
"MIT"
] | 411 | 0b2e3ff5abd7b97e15ac8daf63ea214688c26541 | https://github.com/SegmentationBLWX/sssegmentation/tree/0b2e3ff5abd7b97e15ac8daf63ea214688c26541 |
EqualizedConv2d | import math
import torch
import torch.nn as nn
import torch.utils.cpp_extension
@torch.no_grad()
def scaling_init(tensor, scale=1, dist='u'):
fan_in, fan_out = nn.init._calculate_fan_in_and_fan_out(tensor)
scale /= (fan_in + fan_out) / 2
if dist == 'n':
std = math.sqrt(scale)
return tensor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.utils.cpp_extension
assert_size_s... | STomoya/animeface | EqualizedConv2d | false | 14,381 | [
"MIT"
] | 61 | 37b3cd26097d7874559d4c152e41e5712b7a1a42 | https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42 |
MinusRbfHSIC | import torch
import torch.nn as nn
import torch.utils.data
class HSIC(nn.Module):
"""Base class for the finite sample estimator of Hilbert-Schmidt Independence Criterion (HSIC)
..math:: HSIC (X, Y) := || C_{x, y} ||^2_{HS}, where HSIC (X, Y) = 0 iif X and Y are independent.
Empirically, we use the finite... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | SanghyukChun/rebias | MinusRbfHSIC | false | 14,382 | [
"MIT"
] | 129 | 6a4f6abdd68e080a08737d93a3c4b43e0f0ce055 | https://github.com/SanghyukChun/rebias/tree/6a4f6abdd68e080a08737d93a3c4b43e0f0ce055 |
HardSigmoid | import torch
import torch.nn as nn
class HardSigmoid(nn.Module):
def __init__(self, bias=1.0, divisor=2.0, min_value=0.0, max_value=1.0):
super(HardSigmoid, self).__init__()
assert divisor != 0, 'divisor is not allowed to be equal to zero'
self.bias = bias
self.divisor = divisor
... | 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... | SegmentationBLWX/sssegmentation | HardSigmoid | false | 14,383 | [
"MIT"
] | 411 | 0b2e3ff5abd7b97e15ac8daf63ea214688c26541 | https://github.com/SegmentationBLWX/sssegmentation/tree/0b2e3ff5abd7b97e15ac8daf63ea214688c26541 |
FromRGB | import math
import torch
import torch.nn as nn
import torch.utils.cpp_extension
@torch.no_grad()
def scaling_init(tensor, scale=1, dist='u'):
fan_in, fan_out = nn.init._calculate_fan_in_and_fan_out(tensor)
scale /= (fan_in + fan_out) / 2
if dist == 'n':
std = math.sqrt(scale)
return tensor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.utils.cpp_extension
assert_size_s... | STomoya/animeface | FromRGB | false | 14,384 | [
"MIT"
] | 61 | 37b3cd26097d7874559d4c152e41e5712b7a1a42 | https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42 |
Attention | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.onnx
import torch.nn.parallel
class Attention(nn.Module):
def __init__(self, dim):
super(Attention, self).__init__()
self.linear_out = nn.Linear(dim * 2, dim)
self.mask = None
def set_mask(self, mask):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Samteymoori/pepper | Attention | false | 14,385 | [
"MIT"
] | 155 | 734d226de47a855952e3b58145c1fcfbe221d3b4 | https://github.com/Samteymoori/pepper/tree/734d226de47a855952e3b58145c1fcfbe221d3b4 |
Mnist_NN | import torch
import torch.nn as nn
import torch.nn.functional as F
class Mnist_NN(nn.Module):
def __init__(self):
super().__init__()
self.lin1 = nn.Linear(784, 512, bias=True)
self.lin2 = nn.Linear(512, 256, bias=True)
self.lin3 = nn.Linear(256, 10, bias=True)
def forward(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_... | Sara-Rajaee/Deep_learning_explorations | Mnist_NN | false | 14,386 | [
"MIT"
] | 154 | d0c527f1cde61eea90bda01b073c5ac24565ebf1 | https://github.com/Sara-Rajaee/Deep_learning_explorations/tree/d0c527f1cde61eea90bda01b073c5ac24565ebf1 |
ResNetBlock | import torch
from torch import nn
import torch.utils.data
import torch.nn.parallel
import torch.utils.data.distributed
class ResNetBlock(nn.Module):
def __init__(self, in_channel, out_channel, stride, downsample, pad,
dilation):
super(ResNetBlock, self).__init__()
self.conv1 = nn.Conv2d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
import torch.nn.parallel
import tor... | Sarah20187/X-StereoLab | ResNetBlock | false | 14,387 | [
"MIT"
] | 192 | 9ae8c1413307e7df91b14a7f31e8a95f9e5754f9 | https://github.com/Sarah20187/X-StereoLab/tree/9ae8c1413307e7df91b14a7f31e8a95f9e5754f9 |
SpatialGatherModule | import torch
import torch.nn.functional as F
import torch.nn as nn
class SpatialGatherModule(nn.Module):
def __init__(self, scale=1, **kwargs):
super(SpatialGatherModule, self).__init__()
self.scale = scale
"""forward"""
def forward(self, features, probs):
batch_size, num_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | SegmentationBLWX/sssegmentation | SpatialGatherModule | false | 14,388 | [
"MIT"
] | 411 | 0b2e3ff5abd7b97e15ac8daf63ea214688c26541 | https://github.com/SegmentationBLWX/sssegmentation/tree/0b2e3ff5abd7b97e15ac8daf63ea214688c26541 |
HardSigmoid | import torch
import torch.nn as nn
class HardSigmoid(nn.Module):
"""Implements the Had Mish activation module from `"H-Mish" <https://github.com/digantamisra98/H-Mish>`_
This activation is computed as follows:
.. math::
f(x) = \\frac{x}{2} \\cdot \\min(2, \\max(0, x + 2))
"""
def __init__... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | SevenMoGod/movenet.pytorch | HardSigmoid | false | 14,389 | [
"MIT"
] | 87 | 95ec8535245228aa4335243e68722810e50bcaf8 | https://github.com/SevenMoGod/movenet.pytorch/tree/95ec8535245228aa4335243e68722810e50bcaf8 |
ChannelAttentionModule | import torch
import torch.nn.functional as F
import torch.nn as nn
class Scale(nn.Module):
def __init__(self, scale=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float))
"""forward"""
def forward(self, x):
return x * self.scale
cl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SegmentationBLWX/sssegmentation | ChannelAttentionModule | false | 14,390 | [
"MIT"
] | 411 | 0b2e3ff5abd7b97e15ac8daf63ea214688c26541 | https://github.com/SegmentationBLWX/sssegmentation/tree/0b2e3ff5abd7b97e15ac8daf63ea214688c26541 |
FeatureWiseAffine | import torch
class BaseModule(torch.nn.Module):
def __init__(self):
super(BaseModule, self).__init__()
@property
def nparams(self):
return sum(p.numel() for p in self.parameters() if p.requires_grad)
class FeatureWiseAffine(BaseModule):
def __init__(self):
super(FeatureWis... | 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... | Seungwoo0326/WaveGrad2-1 | FeatureWiseAffine | false | 14,391 | [
"MIT"
] | 45 | 3b202201348449b89353f28bce1596ca7939a810 | https://github.com/Seungwoo0326/WaveGrad2-1/tree/3b202201348449b89353f28bce1596ca7939a810 |
MyLinear | import torch
from torch import nn
class MyLinear(nn.Module):
def __init__(self, inp, outp):
super(MyLinear, self).__init__()
self.w = nn.Parameter(torch.randn(outp, inp))
self.b = nn.Parameter(torch.randn(outp))
def forward(self, x):
x = x @ self.w.t() + self.b
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Shadowalker1995/Tutorial-Resource | MyLinear | false | 14,392 | [
"Apache-2.0"
] | 362 | 71fe3d521cf9971f708fa9978e9c685c0dda6ba6 | https://github.com/Shadowalker1995/Tutorial-Resource/tree/71fe3d521cf9971f708fa9978e9c685c0dda6ba6 |
GLU | import torch
import torch.nn as nn
class GLU(nn.Module):
def __init__(self):
super(GLU, self).__init__()
def forward(self, x):
nc = x.size(1)
assert nc % 2 == 0, 'channels dont divide 2!'
nc = int(nc / 2)
return x[:, :nc] * torch.sigmoid(x[:, nc:])
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | SeungyounShin/c3-gan | GLU | false | 14,393 | [
"BSD-2-Clause"
] | 105 | 1fae645674c896b4bcb93e910034519f470a6a96 | https://github.com/SeungyounShin/c3-gan/tree/1fae645674c896b4bcb93e910034519f470a6a96 |
D_UpBlock | import torch
import torch.utils.data
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torchvision.transforms import *
assert_size_stride ... | RyanMoussouni/iSeeBetter | D_UpBlock | false | 14,394 | [
"MIT"
] | 327 | af193ae0852f8e477fcd6875dce874eb5092a24a | https://github.com/RyanMoussouni/iSeeBetter/tree/af193ae0852f8e477fcd6875dce874eb5092a24a |
JointBoneLoss | import torch
class JointBoneLoss(torch.nn.Module):
def __init__(self, joint_num):
super(JointBoneLoss, self).__init__()
id_i, id_j = [], []
for i in range(joint_num):
for j in range(i + 1, joint_num):
id_i.append(i)
id_j.append(j)
self.i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_strid... | SevenMoGod/movenet.pytorch | JointBoneLoss | false | 14,395 | [
"MIT"
] | 87 | 95ec8535245228aa4335243e68722810e50bcaf8 | https://github.com/SevenMoGod/movenet.pytorch/tree/95ec8535245228aa4335243e68722810e50bcaf8 |
GCN | import math
import torch
from torch import nn
from torch.nn import functional as F
class GraphConvolution(nn.Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, out_features, bias=True):
super(GraphConvolution, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Shadowalker1995/Tutorial-Resource | GCN | false | 14,396 | [
"Apache-2.0"
] | 362 | 71fe3d521cf9971f708fa9978e9c685c0dda6ba6 | https://github.com/Shadowalker1995/Tutorial-Resource/tree/71fe3d521cf9971f708fa9978e9c685c0dda6ba6 |
TensorPermute | import torch
import torch.utils.data
class TensorPermute(torch.nn.Module):
"""
Convert a torch.FloatTensor of shape (NUM_IMAGES x CHANNELS x HEIGHT x WIDTH) to
a torch.FloatTensor of shape (CHANNELS x NUM_IMAGES x HEIGHT x WIDTH).
"""
def forward(self, tensor):
return tensor.permute(1, 0,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | SheffieldAI/pykale | TensorPermute | false | 14,397 | [
"MIT"
] | 324 | be7670941fb06835883c80477b26702d407017db | https://github.com/SheffieldAI/pykale/tree/be7670941fb06835883c80477b26702d407017db |
PredictionHead | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class PredictionHead(nn.Module):
"""
Simple classification prediction-head block to plug ontop of the 4D
output of a CNN.
Args:
num_classes: the number of different classes that can be predicted.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SheffieldAI/pykale | PredictionHead | false | 14,398 | [
"MIT"
] | 324 | be7670941fb06835883c80477b26702d407017db | https://github.com/SheffieldAI/pykale/tree/be7670941fb06835883c80477b26702d407017db |
SReLU | import torch
import torch.nn as nn
import torch.utils.data
class SReLU(nn.Module):
"""Shifted ReLU"""
def __init__(self, nc):
super(SReLU, self).__init__()
self.srelu_bias = nn.Parameter(torch.Tensor(1, nc, 1, 1))
self.srelu_relu = nn.ReLU(inplace=True)
nn.init.constant_(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 import triton_helpers
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | SheffieldAI/pykale | SReLU | false | 14,399 | [
"MIT"
] | 324 | be7670941fb06835883c80477b26702d407017db | https://github.com/SheffieldAI/pykale/tree/be7670941fb06835883c80477b26702d407017db |
GHMIoU | import torch
import torch.nn.functional as F
import torch.nn as nn
class GHMIoU(nn.Module):
"""GHM IoU prediction loss
Details of the theorem can be viewed in the paper
"Gradient Harmonized Single-stage Detector".
https://arxiv.org/abs/1811.05181
Args:
bins (int): Number of the unit regi... | 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
... | ShegnkaiWu/IoU-aware-single-stage-object-detector-for-accurate-localization | GHMIoU | false | 14,400 | [
"Apache-2.0"
] | 62 | 67b8955eb59137590dbadc6aac45529ae9459e4a | https://github.com/ShegnkaiWu/IoU-aware-single-stage-object-detector-for-accurate-localization/tree/67b8955eb59137590dbadc6aac45529ae9459e4a |
ZoneOutBiLSTM | import torch
import torch.nn as nn
class LinearNorm(nn.Module):
""" LinearNorm Projection """
def __init__(self, in_features, out_features, bias=False):
super(LinearNorm, self).__init__()
self.linear = nn.Linear(in_features, out_features, bias)
nn.init.xavier_uniform_(self.linear.weig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Seungwoo0326/WaveGrad2-1 | ZoneOutBiLSTM | false | 14,401 | [
"MIT"
] | 45 | 3b202201348449b89353f28bce1596ca7939a810 | https://github.com/Seungwoo0326/WaveGrad2-1/tree/3b202201348449b89353f28bce1596ca7939a810 |
ConvNet | import torch
import torch.nn as nn
from torch.nn import functional as F
class ConvNet(nn.Module):
"""LeNet++ as described in the Center Loss paper."""
def __init__(self, num_classes):
super(ConvNet, self).__init__()
self.conv1_1 = nn.Conv2d(1, 32, 5, stride=1, padding=2)
self.prelu1_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_... | SJHBXShub/Center_Loss | ConvNet | false | 14,402 | [
"MIT"
] | 813 | 4097709144cf4cfc04d91ac1462ebf346b9f0448 | https://github.com/SJHBXShub/Center_Loss/tree/4097709144cf4cfc04d91ac1462ebf346b9f0448 |
VideoBoringModel | import torch
import torch.nn as nn
import torch.utils.data
class VideoBoringModel(nn.Module):
def __init__(self, in_channel):
super().__init__()
self.avg_pool3d = nn.AdaptiveAvgPool3d(1)
self.fc = nn.Linear(in_channel, 1024)
def forward(self, x):
x = self.avg_pool3d(x).squeez... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | SheffieldAI/pykale | VideoBoringModel | false | 14,403 | [
"MIT"
] | 324 | be7670941fb06835883c80477b26702d407017db | https://github.com/SheffieldAI/pykale/tree/be7670941fb06835883c80477b26702d407017db |
Discriminator2 | import torch
import torch.nn as nn
import torch.utils.data
class Discriminator2(nn.Module):
def __init__(self, n_h):
super(Discriminator2, self).__init__()
self.f_k = nn.Bilinear(n_h, n_h, 1)
for m in self.modules():
self.weights_init(m)
def weights_init(self, m):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | Shen-Lab/GraphCL | Discriminator2 | false | 14,404 | [
"MIT"
] | 275 | 1d43f79d7f33f8133f9d4b4b8254d8aaeb09a615 | https://github.com/Shen-Lab/GraphCL/tree/1d43f79d7f33f8133f9d4b4b8254d8aaeb09a615 |
rec_attention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def batch_product(iput, mat2):
result = None
for i in range(iput.size()[0]):
op = torch.mm(iput[i], mat2)
op = op.unsqueeze(0)
if result is None:
result = op
else:
result = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Luma-1994/lama | rec_attention | false | 14,405 | [
"MIT"
] | 137 | 60d802e2e4cce789f03eea11b038212ba5f7fd1b | https://github.com/Luma-1994/lama/tree/60d802e2e4cce789f03eea11b038212ba5f7fd1b |
SpanClassifier | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
class SpanClassifier(nn.Module):
def __init__(self, hidden_size: 'int', dropout_rate: 'float'):
super(SpanClassifier, self).__init__()
self.start_proj = nn.Linear(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 math
import ... | ShannonAI/dice_loss_for_NLP | SpanClassifier | false | 14,406 | [
"Apache-2.0"
] | 143 | d437bb999185535df46fdb74d1f2f57161331b44 | https://github.com/ShannonAI/dice_loss_for_NLP/tree/d437bb999185535df46fdb74d1f2f57161331b44 |
QuadricLinearLoss | import torch
import torch.nn as nn
class QuadricLinearLoss(nn.Module):
def __init__(self, clip_delta):
super(QuadricLinearLoss, self).__init__()
self.clip_delta = clip_delta
def forward(self, y_pred, y_true, weights):
td_error = y_true - y_pred
td_error_abs = torch.abs(td_err... | 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
... | Shmuma/Run-Skeleton-Run | QuadricLinearLoss | false | 14,407 | [
"MIT"
] | 92 | a953e6c524a444b6a99a54ef5b2886a57de0d185 | https://github.com/Shmuma/Run-Skeleton-Run/tree/a953e6c524a444b6a99a54ef5b2886a57de0d185 |
Discriminator | import torch
import torch.nn as nn
import torch.utils.data
class Discriminator(nn.Module):
def __init__(self, n_h):
super(Discriminator, self).__init__()
self.f_k = nn.Bilinear(n_h, n_h, 1)
for m in self.modules():
self.weights_init(m)
def weights_init(self, m):
i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | Shen-Lab/GraphCL | Discriminator | false | 14,408 | [
"MIT"
] | 275 | 1d43f79d7f33f8133f9d4b4b8254d8aaeb09a615 | https://github.com/Shen-Lab/GraphCL/tree/1d43f79d7f33f8133f9d4b4b8254d8aaeb09a615 |
MNISTDecoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class MNISTDecoder(nn.Module):
"""
MNIST decoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of a fully
connected layer of 128 units with ReLU activation followed by a convolutional block. The con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | SeldonIO/alibi | MNISTDecoder | false | 14,409 | [
"ECL-2.0",
"Apache-2.0"
] | 1,570 | a94b6e3cf6f47aaca560f6d4841e91a62439fa3b | https://github.com/SeldonIO/alibi/tree/a94b6e3cf6f47aaca560f6d4841e91a62439fa3b |
CumulativeMagSpectralNorm | import torch
import torch.nn as nn
class CumulativeMagSpectralNorm(nn.Module):
def __init__(self, cumulative=False, use_mid_freq_mu=False):
"""
Args:
cumulative: 是否采用累积的方式计算 mu
use_mid_freq_mu: 仅采用中心频率的 mu 来代替全局 mu
Notes:
先算均值再累加 等同于 先累加再算均值
... | 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... | ShkarupaDC/FullSubNet | CumulativeMagSpectralNorm | false | 14,410 | [
"MIT"
] | 219 | 2aef8b656376a42fbf519e0020636a893b56c4f8 | https://github.com/ShkarupaDC/FullSubNet/tree/2aef8b656376a42fbf519e0020636a893b56c4f8 |
My_loss | import torch
import torch.utils.data
import torch._utils
import torch.nn.parallel
import torch.optim
from torch.autograd import Variable as Variable
class My_loss(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, y):
cccs = 0
for i in range(x.size(-1)):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch._utils
import torch.nn.parallel
import tor... | Shelly-Lee/ICCV-2021-Competition-Valence-Arousal-Challenge | My_loss | false | 14,411 | [
"MIT"
] | 58 | b3816ef4d4ba7b98c2f9ddd0dd3942d7a666777a | https://github.com/Shelly-Lee/ICCV-2021-Competition-Valence-Arousal-Challenge/tree/b3816ef4d4ba7b98c2f9ddd0dd3942d7a666777a |
UnaryBlock | import torch
import torch.utils.data
import torch.nn as nn
from torch.nn.parameter import Parameter
class BatchNormBlock(nn.Module):
def __init__(self, in_dim, use_bn, bn_momentum):
"""
Initialize a batch normalization block. If network does not use batch normalization, replace with biases.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | ShengyuH/PredateOverlap | UnaryBlock | false | 14,412 | [
"MIT"
] | 153 | 770c3063399f08b3836935212ab4c84d355b4704 | https://github.com/ShengyuH/PredateOverlap/tree/770c3063399f08b3836935212ab4c84d355b4704 |
LinearNet | import torch
import torch.nn as nn
from collections import OrderedDict
from itertools import tee
def pairwise(iterable):
"""s -> (s0,s1), (s1,s2), (s2, s3), ..."""
a, b = tee(iterable)
next(b, None)
return zip(a, b)
class LayerNorm(nn.Module):
def __init__(self, features, eps=1e-06):
su... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Shmuma/Run-Skeleton-Run | LinearNet | false | 14,413 | [
"MIT"
] | 92 | a953e6c524a444b6a99a54ef5b2886a57de0d185 | https://github.com/Shmuma/Run-Skeleton-Run/tree/a953e6c524a444b6a99a54ef5b2886a57de0d185 |
FastRNNCell | import torch
import torch.nn as nn
import torch.onnx
from itertools import product as product
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML | FastRNNCell | false | 14,414 | [
"MIT"
] | 719 | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | https://github.com/Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML/tree/ef9f8a77f096acbdeb941014791f8eda1c1bc35b |
ProtoNN | import torch
import numpy as np
import torch.nn as nn
import torch.onnx
from itertools import product as product
class ProtoNN(nn.Module):
def __init__(self, inputDimension, projectionDimension, numPrototypes,
numOutputLabels, gamma, W=None, B=None, Z=None):
"""
Forward computation graph ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 numpy ... | Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML | ProtoNN | false | 14,415 | [
"MIT"
] | 719 | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | https://github.com/Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML/tree/ef9f8a77f096acbdeb941014791f8eda1c1bc35b |
FastGRNNCell | import torch
import torch.nn as nn
import torch.onnx
from itertools import product as product
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML | FastGRNNCell | false | 14,416 | [
"MIT"
] | 719 | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | https://github.com/Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML/tree/ef9f8a77f096acbdeb941014791f8eda1c1bc35b |
UGRNNLRCell | import torch
import torch.nn as nn
import torch.onnx
from itertools import product as product
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML | UGRNNLRCell | false | 14,417 | [
"MIT"
] | 719 | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | https://github.com/Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML/tree/ef9f8a77f096acbdeb941014791f8eda1c1bc35b |
SSIM | import torch
import torch.nn as nn
class SSIM(nn.Module):
"""Layer to compute the SSIM loss between a pair of images
"""
def __init__(self):
super(SSIM, self).__init__()
self.mu_x_pool = nn.AvgPool2d(3, 1)
self.mu_y_pool = nn.AvgPool2d(3, 1)
self.sig_x_pool = nn.AvgPool2d(... | 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
... | Siddharth-Shrivastava7/DANNet | SSIM | false | 14,418 | [
"Apache-2.0"
] | 61 | 8db10056a4e445d24fc899505923615457cae5b7 | https://github.com/Siddharth-Shrivastava7/DANNet/tree/8db10056a4e445d24fc899505923615457cae5b7 |
LanguageModelCriterion | import torch
import torch.nn as nn
from torch.autograd import *
class LanguageModelCriterion(nn.Module):
def __init__(self):
super(LanguageModelCriterion, self).__init__()
def forward(self, input, target, mask):
target = target[:, :input.size(1)]
mask = mask[:, :input.size(1)]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | SikandarBakht/Sub-GC | LanguageModelCriterion | false | 14,419 | [
"MIT"
] | 71 | 5b89aff766df0b11446cf970fb285004ebfef672 | https://github.com/SikandarBakht/Sub-GC/tree/5b89aff766df0b11446cf970fb285004ebfef672 |
PairwiseRankingLoss | import torch
import torch.nn as nn
class PairwiseRankingLoss(nn.Module):
"""
Pairwise ranking loss
"""
def __init__(self, margin):
super(PairwiseRankingLoss, self).__init__()
self.margin = margin
def forward(self, anchor1, anchor2, img_sentc, sent_imgc):
cost_sent = torch... | 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... | SilanHe/e-SNLI | PairwiseRankingLoss | false | 14,420 | [
"MIT"
] | 125 | 1c38981f50f931e45cf06146e693c588bc89b78d | https://github.com/SilanHe/e-SNLI/tree/1c38981f50f931e45cf06146e693c588bc89b78d |
SPPModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class SPPModule(nn.Module):
def __init__(self, num_levels, pool_type='max_pool'):
super(SPPModule, self).__init__()
self.num_levels = num_levels
self.pool_type = pool_type
def forward(self, x):
_bs, _c, _h, _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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ShuangXieIrene/ssds.pytorch | SPPModule | false | 14,421 | [
"MIT"
] | 661 | b5ec682a42c923afe964205b21448e9f141d55bc | https://github.com/ShuangXieIrene/ssds.pytorch/tree/b5ec682a42c923afe964205b21448e9f141d55bc |
GRULRCell | import torch
import torch.nn as nn
import torch.onnx
from itertools import product as product
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML | GRULRCell | false | 14,422 | [
"MIT"
] | 719 | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | https://github.com/Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML/tree/ef9f8a77f096acbdeb941014791f8eda1c1bc35b |
NTM | from _paritybench_helpers import _mock_config
import logging
import torch
import numpy as np
from torch.nn import functional as F
import torch.utils.data
import torch.nn as nn
class NTM(nn.Module):
def __init__(self, opt, hidden_dim=500, l1_strength=0.001):
super(NTM, self).__init__()
self.input_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Nullius-2020/TAKG-Paddle | NTM | false | 14,423 | [
"MIT"
] | 130 | 7ebb5c4cdd1d2c68b1ca4a518b73c5e815fc5812 | https://github.com/Nullius-2020/TAKG-Paddle/tree/7ebb5c4cdd1d2c68b1ca4a518b73c5e815fc5812 |
BertPSIHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class BertPSIHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
self.decoder = nn.Linear(conf... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | Sologa/awesome-align | BertPSIHead | false | 14,424 | [
"BSD-3-Clause"
] | 173 | 62eaae7eac9bac06c10627fac6cc942c07a50e64 | https://github.com/Sologa/awesome-align/tree/62eaae7eac9bac06c10627fac6cc942c07a50e64 |
Net | import torch
from torch import nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(2048, 2048, kernel_size=1)
def forward(self, x):
x = F.relu(self.conv1(x))
return x
def get_inputs():
return [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._inductor.runtime import triton_helpers
from torch import nn
assert_s... | ReyhaneAskari/pytorch_experiments | Net | false | 14,425 | [
"MIT"
] | 60 | 43d2efbc08c9dd6275530c4bf49c68772f8afb75 | https://github.com/ReyhaneAskari/pytorch_experiments/tree/43d2efbc08c9dd6275530c4bf49c68772f8afb75 |
FCDiscriminator | import torch
import torch.nn as nn
class FCDiscriminator(nn.Module):
def __init__(self, num_classes, ndf=64):
super(FCDiscriminator, self).__init__()
self.conv1 = nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2,
padding=1)
self.conv2 = nn.Conv2d(ndf, ndf * 2, kernel_size=4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Siddharth-Shrivastava7/DANNet | FCDiscriminator | false | 14,426 | [
"Apache-2.0"
] | 61 | 8db10056a4e445d24fc899505923615457cae5b7 | https://github.com/Siddharth-Shrivastava7/DANNet/tree/8db10056a4e445d24fc899505923615457cae5b7 |
TranspConv3DBlock | import torch
import torch.nn as nn
class TranspConv3DBlock(nn.Module):
def __init__(self, in_planes, out_planes):
super().__init__()
self.block = nn.ConvTranspose3d(in_planes, out_planes, kernel_size=
2, stride=2, padding=0, output_padding=0)
def forward(self, x):
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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Siyuan89/self-attention-cv | TranspConv3DBlock | false | 14,427 | [
"MIT"
] | 759 | b39cde2fb68e05351bf3bc8048f4af13bbab256a | https://github.com/Siyuan89/self-attention-cv/tree/b39cde2fb68e05351bf3bc8048f4af13bbab256a |
Entmax15 | from torch.autograd import Function
import torch
from torch import nn
def _make_ix_like(X, dim):
d = X.size(dim)
rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype)
view = [1] * X.dim()
view[0] = -1
return rho.view(view).transpose(0, dim)
def _roll_last(X, dim):
if dim == -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._inductor.runtime.triton_helpers import libdevice
from torch.autograd import F... | Sologa/awesome-align | Entmax15 | false | 14,428 | [
"BSD-3-Clause"
] | 173 | 62eaae7eac9bac06c10627fac6cc942c07a50e64 | https://github.com/Sologa/awesome-align/tree/62eaae7eac9bac06c10627fac6cc942c07a50e64 |
CustomSoftplus | import torch
import torch.nn as nn
import torch.utils.data
class Softplus(torch.autograd.Function):
@staticmethod
def forward(ctx, i):
result = torch.log(1 + torch.exp(i))
ctx.save_for_backward(i)
return result
@staticmethod
def backward(ctx, grad_output):
return grad... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch.... | SortAnon/BVAE-TTS | CustomSoftplus | false | 14,429 | [
"MIT"
] | 138 | 69c2ee0c8bf30fe6133cfa8be68a36916f15bcff | https://github.com/SortAnon/BVAE-TTS/tree/69c2ee0c8bf30fe6133cfa8be68a36916f15bcff |
Sparsemax | from torch.autograd import Function
import torch
from torch import nn
def _make_ix_like(X, dim):
d = X.size(dim)
rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype)
view = [1] * X.dim()
view[0] = -1
return rho.view(view).transpose(0, dim)
def _roll_last(X, dim):
if dim == -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.autograd import Function
from torch import nn
assert_size_stride = torch._C._d... | Sologa/awesome-align | Sparsemax | false | 14,430 | [
"BSD-3-Clause"
] | 173 | 62eaae7eac9bac06c10627fac6cc942c07a50e64 | https://github.com/Sologa/awesome-align/tree/62eaae7eac9bac06c10627fac6cc942c07a50e64 |
ResNetClassifier | import torch
from torch import nn
class ResNetClassifier(nn.Module):
def __init__(self, n_class, len_feature):
super().__init__()
self.len_feature = len_feature
self.classifier = nn.Linear(self.len_feature, n_class)
def forward(self, x):
x = x.view(x.size(0), x.size(1), -1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Starrah/THU-SuperMoon | ResNetClassifier | false | 14,431 | [
"MIT"
] | 64 | 1e6b8ccc207f789fb8426806251cc3d4e1cca35a | https://github.com/Starrah/THU-SuperMoon/tree/1e6b8ccc207f789fb8426806251cc3d4e1cca35a |
CoreNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class CoreNetwork(nn.Module):
"""The core network.
An RNN that maintains an internal state by integrating
information extracted from the history of past observations.
It encodes the agent's knowledge of the environment through
a 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_... | SmirnovKol/recurrent-visual-attention | CoreNetwork | false | 14,432 | [
"MIT"
] | 463 | 4cb8d9e768ae35f38439278bb8a7b4d6b253a537 | https://github.com/SmirnovKol/recurrent-visual-attention/tree/4cb8d9e768ae35f38439278bb8a7b4d6b253a537 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
'The hidden size (%... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Sologa/awesome-align | BertSelfAttention | false | 14,433 | [
"BSD-3-Clause"
] | 173 | 62eaae7eac9bac06c10627fac6cc942c07a50e64 | https://github.com/Sologa/awesome-align/tree/62eaae7eac9bac06c10627fac6cc942c07a50e64 |
UpsampleNet | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
class UpsampleNet(nn.Module):
def __init__(self, input_size, output_size, upsample_factor):
super(UpsampleNet, self).__init__()
self.input_size = input_size
self.output_size = output_size
self.upsample_facto... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | SolomidHero/EA-SVC | UpsampleNet | false | 14,434 | [
"MIT"
] | 88 | 23a0a9d9c0e9670dd7c777d56b00883d84c23237 | https://github.com/SolomidHero/EA-SVC/tree/23a0a9d9c0e9670dd7c777d56b00883d84c23237 |
BasicModulationBlock | import torch
class BaseModule(torch.nn.Module):
def __init__(self):
super(BaseModule, self).__init__()
@property
def nparams(self):
return sum(p.numel() for p in self.parameters() if p.requires_grad)
class Conv1dWithInitialization(BaseModule):
def __init__(self, **kwargs):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Seungwoo0326/WaveGrad2-1 | BasicModulationBlock | false | 14,435 | [
"MIT"
] | 45 | 3b202201348449b89353f28bce1596ca7939a810 | https://github.com/Seungwoo0326/WaveGrad2-1/tree/3b202201348449b89353f28bce1596ca7939a810 |
LocationNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
class LocationNetwork(nn.Module):
"""The location network.
Uses the internal state `h_t` of the core network to
produce the location coordinates `l_t` for the next
time step.
Concretely, fee... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SmirnovKol/recurrent-visual-attention | LocationNetwork | false | 14,436 | [
"MIT"
] | 463 | 4cb8d9e768ae35f38439278bb8a7b4d6b253a537 | https://github.com/SmirnovKol/recurrent-visual-attention/tree/4cb8d9e768ae35f38439278bb8a7b4d6b253a537 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.data
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SofanHe/UnilmChatchitRobot | BertSelfAttention | false | 14,437 | [
"Apache-2.0"
] | 115 | 7232d01326ed04ae17cbeb73ce681f30b4391933 | https://github.com/SofanHe/UnilmChatchitRobot/tree/7232d01326ed04ae17cbeb73ce681f30b4391933 |
SeparableConvBlock | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from itertools import product as product
from math import sqrt as sqrt
class Conv2dSamePadding(torch.nn.Conv2d):
"""
A wrapper around :class:`torch.nn.Conv2d` to support "SAME" padding mode and more features.
"""
def __i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.utils.data
import torch.nn.functional as F
from itertoo... | StevenGrove/DynamicHead | SeparableConvBlock | false | 14,438 | [
"Apache-2.0"
] | 69 | d62aa84e1d1c6a0c74d46258ad77b11413c10bef | https://github.com/StevenGrove/DynamicHead/tree/d62aa84e1d1c6a0c74d46258ad77b11413c10bef |
CategoricalAccuracy | import torch
class _Metric(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor'):
raise NotImplementedError()
class Accuracy(_Metric):
def __init__(self):
super().__init__()
def forward(self, input: 'torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | Stillerman/MusicTransformer-pytorch | CategoricalAccuracy | false | 14,439 | [
"MIT"
] | 170 | 73abb7cab271beba042b7b6fc06a6a9aaee82e8c | https://github.com/Stillerman/MusicTransformer-pytorch/tree/73abb7cab271beba042b7b6fc06a6a9aaee82e8c |
BCEFocalLoss | import torch
from torch import nn
import torch.nn.functional as F
class BCEFocalLoss(nn.Module):
def __init__(self, alpha=-1, gamma=2.0, reduction='mean'):
super(BCEFocalLoss, self).__init__()
self.alpha = alpha
self.gamma = gamma
self.reduction = reduction
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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | Stochastic-Adventure/ClinicalTransformerRelationExtraction | BCEFocalLoss | false | 14,440 | [
"MIT"
] | 78 | eef956bbfbd64b008014ef7cac5f818087816725 | https://github.com/Stochastic-Adventure/ClinicalTransformerRelationExtraction/tree/eef956bbfbd64b008014ef7cac5f818087816725 |
SingleHead | import torch
import torch.nn as nn
import torch.utils.data
from itertools import product as product
from math import sqrt as sqrt
class SingleHead(nn.Module):
"""
Single head used in CenterNet Head.
"""
def __init__(self, in_channel, out_channel, bias_fill=False, bias_value=0):
super(SingleHe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | StevenGrove/DynamicHead | SingleHead | false | 14,441 | [
"Apache-2.0"
] | 69 | d62aa84e1d1c6a0c74d46258ad77b11413c10bef | https://github.com/StevenGrove/DynamicHead/tree/d62aa84e1d1c6a0c74d46258ad77b11413c10bef |
ConvLSTMCell | import torch
from torch.autograd import Variable
import torch.nn as nn
class ConvLSTMCell(nn.Module):
def __init__(self, input_channels, hidden_channels, kernel_size, bias=True
):
super(ConvLSTMCell, self).__init__()
assert hidden_channels % 2 == 0
self.input_channels = input_chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | Starboy-at-earth/DMRA | ConvLSTMCell | false | 14,442 | [
"MIT"
] | 84 | 596cc6106ab5f1f03deb60a7f4bb0c2ad1029a83 | https://github.com/Starboy-at-earth/DMRA/tree/596cc6106ab5f1f03deb60a7f4bb0c2ad1029a83 |
ILN | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class ILN(nn.Module):
def __init__(self, num_features, eps=1e-05):
super(ILN, self).__init__()
self.eps = eps
self.rho = Parameter(torch.Tensor(1, num_features, 1, 1))
self.gamma = Parameter(torch.Tensor(1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from torch.nn.parameter import Parameter
assert_size_stri... | SubZero12556/Cats2dogs_ONNX | ILN | false | 14,443 | [
"MIT"
] | 2,519 | 52a6a60d519e23b02f0847f0fa9f9ead89ca5f4e | https://github.com/SubZero12556/Cats2dogs_ONNX/tree/52a6a60d519e23b02f0847f0fa9f9ead89ca5f4e |
ResidualBlock | import torch
import torch.utils.data
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, in_channels, out_channels, hidden_dim):
super().__init__()
self.fc_0 = nn.Conv1d(in_channels, hidden_dim, 1)
self.fc_1 = nn.Conv1d(hidden_dim, out_channels, 1)
self.activa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | StructuralNeurobiologyLab/LightConvPoint | ResidualBlock | false | 14,444 | [
"Apache-2.0"
] | 58 | 3f353f45e9e910fa390a74520dfd478e3e88f104 | https://github.com/StructuralNeurobiologyLab/LightConvPoint/tree/3f353f45e9e910fa390a74520dfd478e3e88f104 |
SplAtConv2d | from torch.autograd import Function
from torch.nn import Module
import logging
import torch
import torch.utils.data
import torch.distributed as dist
from torch import nn
import torch.nn.functional as F
from torch.autograd.function import Function
from torch.autograd import Function
from torch.nn.modules.utils import _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.... | Shun14/detectron2-ResNeSt | SplAtConv2d | false | 14,445 | [
"Apache-2.0"
] | 344 | cda53a237199da3bbe7526d41c41b9d8df4c4814 | https://github.com/Shun14/detectron2-ResNeSt/tree/cda53a237199da3bbe7526d41c41b9d8df4c4814 |
Net | import torch
from torch.nn import functional as F
class Net(torch.nn.Module):
def __init__(self, n_feature, n_hidden, n_output):
super(Net, self).__init__()
self.hidden = torch.nn.Linear(n_feature, n_hidden)
self.hidden_two = torch.nn.Linear(n_hidden, n_hidden)
self.hidden_3 = tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | SunHaozhe/modular-metalearning | Net | false | 14,446 | [
"MIT"
] | 70 | c94dd18c6d105f18667d4de7bb4c81fa538a541c | https://github.com/SunHaozhe/modular-metalearning/tree/c94dd18c6d105f18667d4de7bb4c81fa538a541c |
VarifocalLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | 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... | Sundrops/mmdetection | VarifocalLoss | false | 14,447 | [
"Apache-2.0"
] | 549 | d3cf38d91c454b1a6881e8c36c1e4a66dc5521b8 | https://github.com/Sundrops/mmdetection/tree/d3cf38d91c454b1a6881e8c36c1e4a66dc5521b8 |
ContextPooler | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
def get_mask(input, local_context):
if not isinstance(local_context, DropoutContext):
dropout = local_context
mask = None
else:
dropout = local_context.dropout
dropout *= local_context.s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | Stochastic-Adventure/ClinicalTransformerRelationExtraction | ContextPooler | false | 14,448 | [
"MIT"
] | 78 | eef956bbfbd64b008014ef7cac5f818087816725 | https://github.com/Stochastic-Adventure/ClinicalTransformerRelationExtraction/tree/eef956bbfbd64b008014ef7cac5f818087816725 |
MockAccuracy | import torch
class _Metric(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor'):
raise NotImplementedError()
class Accuracy(_Metric):
def __init__(self):
super().__init__()
def forward(self, input: 'torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Stillerman/MusicTransformer-pytorch | MockAccuracy | false | 14,449 | [
"MIT"
] | 170 | 73abb7cab271beba042b7b6fc06a6a9aaee82e8c | https://github.com/Stillerman/MusicTransformer-pytorch/tree/73abb7cab271beba042b7b6fc06a6a9aaee82e8c |
ConvolutionBlock | import torch
class BaseModule(torch.nn.Module):
def __init__(self):
super(BaseModule, self).__init__()
@property
def nparams(self):
return sum(p.numel() for p in self.parameters() if p.requires_grad)
class Conv1dWithInitialization(BaseModule):
def __init__(self, **kwargs):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Seungwoo0326/WaveGrad2-1 | ConvolutionBlock | false | 14,450 | [
"MIT"
] | 45 | 3b202201348449b89353f28bce1596ca7939a810 | https://github.com/Seungwoo0326/WaveGrad2-1/tree/3b202201348449b89353f28bce1596ca7939a810 |
ClassificationCircleLoss | import torch
import torch.nn as nn
import torch.utils.data
from typing import Tuple
from torch.nn.functional import cross_entropy
from itertools import product as product
from math import sqrt as sqrt
class ClassificationCircleLoss(nn.Module):
"""Circle loss for class-level labels as described in the paper
`"... | 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
... | StevenGrove/DynamicHead | ClassificationCircleLoss | false | 14,451 | [
"Apache-2.0"
] | 69 | d62aa84e1d1c6a0c74d46258ad77b11413c10bef | https://github.com/StevenGrove/DynamicHead/tree/d62aa84e1d1c6a0c74d46258ad77b11413c10bef |
SoftmaxLayer | import torch
import torch.nn as nn
class SoftmaxLayer(nn.Module):
""" Naive softmax-layer """
def __init__(self, output_dim, n_class):
"""
:param output_dim: int
:param n_class: int
"""
super(SoftmaxLayer, self).__init__()
self.hidden2tag = nn.Linear(output_dim, n_class)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Sy-Zhang/ELMoForManyLangs | SoftmaxLayer | false | 14,452 | [
"MIT"
] | 1,414 | f82bf0fef80df617e39d34baa3e46d9857e94e65 | https://github.com/Sy-Zhang/ELMoForManyLangs/tree/f82bf0fef80df617e39d34baa3e46d9857e94e65 |
disparityregression | from _paritybench_helpers import _mock_config
import torch
import numpy as np
from torch import nn
import torch.utils.data
from torch.autograd import Variable
import torch.nn.parallel
import torch.utils.data.distributed
class disparityregression(nn.Module):
def __init__(self, maxdisp, cfg):
super(dispari... | 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
import torch.utils.data
from torch.autograd import Variable
import torch.nn.parallel
import torch.ut... | Sarah20187/X-StereoLab | disparityregression | false | 14,453 | [
"MIT"
] | 192 | 9ae8c1413307e7df91b14a7f31e8a95f9e5754f9 | https://github.com/Sarah20187/X-StereoLab/tree/9ae8c1413307e7df91b14a7f31e8a95f9e5754f9 |
RGBBlock | import torch
import torch.nn.functional as F
import torch.nn as nn
class Conv2DMod(nn.Module):
def __init__(self, in_chan, out_chan, kernel, demod=True, stride=1,
dilation=1, **kwargs):
super().__init__()
self.filters = out_chan
self.demod = demod
self.kernel = kernel
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | SongweiGe/DoodlerGAN | RGBBlock | false | 14,454 | [
"MIT"
] | 92 | d435d9b3c0579937cd3c22aa2051960ceb921785 | https://github.com/SongweiGe/DoodlerGAN/tree/d435d9b3c0579937cd3c22aa2051960ceb921785 |
SpatialGate | import math
import torch
import torch.nn as nn
import torch.utils.data
from itertools import product as product
from math import sqrt as sqrt
class SpatialGate(nn.Module):
def __init__(self, in_channels: 'int', num_groups: 'int'=1, kernel_size:
'int'=1, padding: 'int'=0, stride: 'int'=1, gate_activation:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | StevenGrove/DynamicHead | SpatialGate | false | 14,455 | [
"Apache-2.0"
] | 69 | d62aa84e1d1c6a0c74d46258ad77b11413c10bef | https://github.com/StevenGrove/DynamicHead/tree/d62aa84e1d1c6a0c74d46258ad77b11413c10bef |
VAE_Kl_Loss | import torch
import torch.nn as nn
import torch.nn.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
class VAE_Kl_Loss(nn.Module):
def __init__(self, if_print=False):
super(VAE_Kl_Loss, self).__init__()
self.if_print = if_print
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.nn.functional
import torch.nn.parallel... | TPCD/LifelongReID | VAE_Kl_Loss | false | 14,456 | [
"MIT"
] | 63 | cb33f9c29fe398e7546db345fab1c338dda8252f | https://github.com/TPCD/LifelongReID/tree/cb33f9c29fe398e7546db345fab1c338dda8252f |
CategoricalSampler | import torch
import torch.nn as nn
class Sampler(nn.Module):
""" args; logits: (batch, n_nodes)
return; next_node: (batch, 1)
TopKSampler <=> greedy; sample one with biggest probability
CategoricalSampler <=> sampling; randomly sample one from possible distribution based on probability
"""
def __init_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | TSLNIHAOGIT/VRP_DRL_MHA | CategoricalSampler | false | 14,457 | [
"MIT"
] | 55 | 6a59918ffb815fbdab4d75cb78130fc638c64d69 | https://github.com/TSLNIHAOGIT/VRP_DRL_MHA/tree/6a59918ffb815fbdab4d75cb78130fc638c64d69 |
Pointnet | import torch
import torch.utils.data
import torch.nn as nn
class Pointnet(nn.Module):
def __init__(self, in_channels, out_channels, hidden_dim, segmentation=
False):
super().__init__()
self.fc_in = nn.Conv1d(in_channels, 2 * hidden_dim, 1)
self.fc_0 = nn.Conv1d(2 * hidden_dim, hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | StructuralNeurobiologyLab/LightConvPoint | Pointnet | false | 14,458 | [
"Apache-2.0"
] | 58 | 3f353f45e9e910fa390a74520dfd478e3e88f104 | https://github.com/StructuralNeurobiologyLab/LightConvPoint/tree/3f353f45e9e910fa390a74520dfd478e3e88f104 |
ConvPlus | import torch
import torch.nn as nn
class ConvPlus(nn.Module):
def __init__(self, c1, c2, k=3, s=1, g=1, bias=True):
super(ConvPlus, self).__init__()
self.cv1 = nn.Conv2d(c1, c2, (k, 1), s, (k // 2, 0), groups=g, bias
=bias)
self.cv2 = nn.Conv2d(c1, c2, (1, k), s, (0, k // 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 torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Syencil/mobile-yolov5-pruning-distillation | ConvPlus | false | 14,459 | [
"MIT"
] | 554 | 5d52454bb397ae49677b5da398e4192abc681325 | https://github.com/Syencil/mobile-yolov5-pruning-distillation/tree/5d52454bb397ae49677b5da398e4192abc681325 |
attentionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import MultiheadAttention
from itertools import product as product
class attentionLayer(nn.Module):
def __init__(self, d_model, nhead, dropout=0.1):
super(attentionLayer, self).__init__()
self.self_attn = MultiheadAt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | TaoRuijie/TalkNet_ASD | attentionLayer | false | 14,460 | [
"MIT"
] | 79 | 4a2bc4859ee192ab450eaf63937a799212f2b021 | https://github.com/TaoRuijie/TalkNet_ASD/tree/4a2bc4859ee192ab450eaf63937a799212f2b021 |
GlobalLayerNorm | import torch
import torch.nn as nn
from itertools import product as product
class GlobalLayerNorm(nn.Module):
def __init__(self, channel_size):
super(GlobalLayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.Tensor(1, channel_size, 1))
self.beta = nn.Parameter(torch.Tensor(1, chan... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from itertools import product as product
assert_size_stri... | TaoRuijie/TalkNet_ASD | GlobalLayerNorm | false | 14,461 | [
"MIT"
] | 79 | 4a2bc4859ee192ab450eaf63937a799212f2b021 | https://github.com/TaoRuijie/TalkNet_ASD/tree/4a2bc4859ee192ab450eaf63937a799212f2b021 |
adaILN | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class adaILN(nn.Module):
def __init__(self, num_features, eps=1e-05):
super(adaILN, self).__init__()
self.eps = eps
self.rho = Parameter(torch.Tensor(1, num_features, 1, 1))
self.rho.data.fill_(0.9)
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.triton_helpers import libdevice
import torch.nn as nn
from torch.nn.parameter import Parameter
assert_size_stri... | SubZero12556/Cats2dogs_ONNX | adaILN | false | 14,462 | [
"MIT"
] | 2,519 | 52a6a60d519e23b02f0847f0fa9f9ead89ca5f4e | https://github.com/SubZero12556/Cats2dogs_ONNX/tree/52a6a60d519e23b02f0847f0fa9f9ead89ca5f4e |
Unit1D | import torch
import torch.nn as nn
import torch.nn.functional as F
class Unit1D(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=1, stride
=1, padding='same', activation_fn=F.relu, use_bias=True):
super(Unit1D, self).__init__()
self.conv1d = nn.Conv1d(in_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.nn as nn
import ... | TencentYoutuResearch/ActionDetection-AFSD | Unit1D | false | 14,463 | [
"BSD-3-Clause"
] | 112 | ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 | https://github.com/TencentYoutuResearch/ActionDetection-AFSD/tree/ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 |
ScaleExp | import torch
import torch.nn as nn
class ScaleExp(nn.Module):
def __init__(self, init_value=1.0):
super(ScaleExp, self).__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
return torch.exp(input * self.scale)
def get_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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | TencentYoutuResearch/ActionDetection-AFSD | ScaleExp | false | 14,464 | [
"BSD-3-Clause"
] | 112 | ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 | https://github.com/TencentYoutuResearch/ActionDetection-AFSD/tree/ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 |
GAT | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=False
):
super(GraphAt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | StrangeTcy/Q-BERT | GAT | false | 14,465 | [
"MIT"
] | 57 | 4e4cd4ddda3036d4bf7d878641592462189245d4 | https://github.com/StrangeTcy/Q-BERT/tree/4e4cd4ddda3036d4bf7d878641592462189245d4 |
Unit3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class Unit3D(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1),
stride=(1, 1, 1), padding='spatial_valid', activation_fn=F.relu,
use_batch_norm=False, use_bias=False):
"""Initializes Unit3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | TencentYoutuResearch/ActionDetection-AFSD | Unit3D | false | 14,466 | [
"BSD-3-Clause"
] | 112 | ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 | https://github.com/TencentYoutuResearch/ActionDetection-AFSD/tree/ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 |
ResidualPointnet | import torch
import torch.utils.data
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, in_channels, out_channels, hidden_dim):
super().__init__()
self.fc_0 = nn.Conv1d(in_channels, hidden_dim, 1)
self.fc_1 = nn.Conv1d(hidden_dim, out_channels, 1)
self.activa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | StructuralNeurobiologyLab/LightConvPoint | ResidualPointnet | false | 14,467 | [
"Apache-2.0"
] | 58 | 3f353f45e9e910fa390a74520dfd478e3e88f104 | https://github.com/StructuralNeurobiologyLab/LightConvPoint/tree/3f353f45e9e910fa390a74520dfd478e3e88f104 |
GroupedChannelNorm | import torch
import torch.utils.data
import torch
import torch.nn as nn
class GroupedChannelNorm(nn.Module):
def __init__(self, num_groups):
super().__init__()
self.num_groups = num_groups
def forward(self, x):
shape = list(x.shape)
new_shape = [shape[0], self.num_groups, sha... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride =... | Theomat/colorization-av-enseirb-2020 | GroupedChannelNorm | false | 14,468 | [
"Apache-2.0"
] | 1,422 | c54c2388ea39a62289fa2f1c51b4757bf55d3c4f | https://github.com/Theomat/colorization-av-enseirb-2020/tree/c54c2388ea39a62289fa2f1c51b4757bf55d3c4f |
TransposedConv1d | import torch
import torch.nn as nn
import torch.nn.functional as F
class TransposedConv1d(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=3, stride
=2, padding=1, output_padding=1, activation_fn=F.relu,
use_batch_norm=False, use_bias=True):
super(TransposedConv1d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | TencentYoutuResearch/ActionDetection-AFSD | TransposedConv1d | false | 14,469 | [
"BSD-3-Clause"
] | 112 | ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 | https://github.com/TencentYoutuResearch/ActionDetection-AFSD/tree/ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 |
PoolingF | import torch
import torch.utils.data
import torch
import torch.nn as nn
class Normalize(nn.Module):
def __init__(self, power=2):
super(Normalize, self).__init__()
self.power = power
def forward(self, x):
norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power)
out ... | 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.utils.data
impo... | Theomat/colorization-av-enseirb-2020 | PoolingF | false | 14,470 | [
"Apache-2.0"
] | 1,422 | c54c2388ea39a62289fa2f1c51b4757bf55d3c4f | https://github.com/Theomat/colorization-av-enseirb-2020/tree/c54c2388ea39a62289fa2f1c51b4757bf55d3c4f |
TransposedConv3d | import torch
import torch.nn as nn
import torch.nn.functional as F
class TransposedConv3d(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=(3, 3, 3),
stride=(2, 1, 1), padding=(1, 1, 1), output_padding=(1, 0, 0),
activation_fn=F.relu, use_batch_norm=False, use_bias=True):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | TencentYoutuResearch/ActionDetection-AFSD | TransposedConv3d | false | 14,471 | [
"BSD-3-Clause"
] | 112 | ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 | https://github.com/TencentYoutuResearch/ActionDetection-AFSD/tree/ed86a0df91e58baa7d78c796ed29cff82b1f3fa6 |
SM | import torch
from torch import nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class SM(nn.Module):
def __init__(self, k=3, s=1):
super(SM, self).__init__()
self.avg = nn.AvgPool2d(k, stride=s, padding=autopad(k))
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | TarikToha/NWPU-Crowd-Sample-Code-for-Localization | SM | false | 14,472 | [
"MIT"
] | 132 | 0e348b99ea41d4469eff2a78a75648454128d49a | https://github.com/TarikToha/NWPU-Crowd-Sample-Code-for-Localization/tree/0e348b99ea41d4469eff2a78a75648454128d49a |
SpatialConv3D | import torch
import torch.nn as nn
class SpatialConv3D(nn.Module):
"""
Apply 3D conv. over an input signal composed of several input planes with distinct spatial and time axes, by performing 3D convolution over the spatiotemporal axes
rrgs:
in_channels (int): number of channels in the input tenso... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Tencent/DVQA | SpatialConv3D | false | 14,473 | [
"BSD-3-Clause"
] | 408 | 21727333a6b41d54ad1a8beca1fcbe00a69ed347 | https://github.com/Tencent/DVQA/tree/21727333a6b41d54ad1a8beca1fcbe00a69ed347 |
ModulatedConv2d | import math
import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if len(k.shape) == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input, kernel, up_x, u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | Theomat/colorization-av-enseirb-2020 | ModulatedConv2d | false | 14,474 | [
"Apache-2.0"
] | 1,422 | c54c2388ea39a62289fa2f1c51b4757bf55d3c4f | https://github.com/Theomat/colorization-av-enseirb-2020/tree/c54c2388ea39a62289fa2f1c51b4757bf55d3c4f |
TokenEmbedding | import torch
import torch.nn as nn
class TokenEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model,
kernel_size=3, pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | TheaperDeng/Informer2020 | TokenEmbedding | false | 14,475 | [
"Apache-2.0"
] | 2,296 | 90e080593e9c345f5f9676359bb3d1618e9aa735 | https://github.com/TheaperDeng/Informer2020/tree/90e080593e9c345f5f9676359bb3d1618e9aa735 |
Normalize | import torch
import torch.utils.data
import torch
import torch.nn as nn
class Normalize(nn.Module):
def __init__(self, power=2):
super(Normalize, self).__init__()
self.power = power
def forward(self, x):
norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power)
out ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride =... | Theomat/colorization-av-enseirb-2020 | Normalize | false | 14,476 | [
"Apache-2.0"
] | 1,422 | c54c2388ea39a62289fa2f1c51b4757bf55d3c4f | https://github.com/Theomat/colorization-av-enseirb-2020/tree/c54c2388ea39a62289fa2f1c51b4757bf55d3c4f |
Linear3D | import math
import torch
import torch as th
from torch.nn import Parameter
def functional_linear3d(input, weight, bias=None):
"""
Apply a linear transformation to the incoming data: :math:`y = xA^T + b`.
Shape:
- Input: :math:`(N, *, in\\_features)` where `*` means any number of
additio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 as th
from torch.nn import Parameter
assert_size_stride... | TheSignPainter/CausalDiscoveryToolbox | Linear3D | false | 14,477 | [
"MIT"
] | 528 | 33eae18184905e505be978b08003b9477bf38e0c | https://github.com/TheSignPainter/CausalDiscoveryToolbox/tree/33eae18184905e505be978b08003b9477bf38e0c |
TemporalEmbedding | import math
import torch
import torch.nn as nn
class FixedEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(FixedEmbedding, self).__init__()
w = torch.zeros(c_in, d_model).float()
w.require_grad = False
position = torch.arange(0, c_in).float().unsqueeze(1)
div... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | TheaperDeng/Informer2020 | TemporalEmbedding | false | 14,478 | [
"Apache-2.0"
] | 2,296 | 90e080593e9c345f5f9676359bb3d1618e9aa735 | https://github.com/TheaperDeng/Informer2020/tree/90e080593e9c345f5f9676359bb3d1618e9aa735 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.