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 |
|---|---|---|---|---|---|---|---|---|---|---|
MultiplyLuminance | import torch
class MultiplyLuminance(torch.nn.Module):
def __init__(self):
super(MultiplyLuminance, self).__init__()
def forward(self, color, luminance):
return color * (1 + luminance)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | qway/nerfmeshes | MultiplyLuminance | false | 16,301 | [
"MIT"
] | 113 | d983dcbbcfec1337c9f2040969213c6d1ea0c39e | https://github.com/qway/nerfmeshes/tree/d983dcbbcfec1337c9f2040969213c6d1ea0c39e |
AGELU | import math
import torch
import torch.utils.data
import torch.cuda
import torch.utils.checkpoint
def agelu(x):
SQRT_M2_PI = math.sqrt(2 / math.pi)
COEFF = 0.044715
return 0.5 * x * (1.0 + torch.tanh(SQRT_M2_PI * (x + COEFF * torch.pow(
x, 3))))
class AGELU(torch.nn.Module):
def forward(self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.utils.data
import torch.cuda
import torch.utils.checkp... | quanpn90/NMTGMinor | AGELU | false | 16,302 | [
"MIT"
] | 75 | 0e5f989c8bc01c6c8dc3a8c1ce7c05bfd884b796 | https://github.com/quanpn90/NMTGMinor/tree/0e5f989c8bc01c6c8dc3a8c1ce7c05bfd884b796 |
CoSirenModule | import math
import torch
class CoSirenModule(torch.nn.Module):
def __init__(self, in_features, out_features, weight_multiplier=1.0):
super(CoSirenModule, self).__init__()
self.linear = torch.nn.Linear(in_features, out_features // 2)
init_bounds = math.sqrt(24 / in_features) * weight_multi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
a... | qway/nerfmeshes | CoSirenModule | false | 16,303 | [
"MIT"
] | 113 | d983dcbbcfec1337c9f2040969213c6d1ea0c39e | https://github.com/qway/nerfmeshes/tree/d983dcbbcfec1337c9f2040969213c6d1ea0c39e |
DistillLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DistillLoss(nn.Module):
def __init__(self, alpha, temperature, k=None):
super(DistillLoss, self).__init__()
self.alpha = alpha
self.start_alpha = alpha
self.temperature = temperature
self.kl_loss = 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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | qinjian623/pytorch_toys | DistillLoss | false | 16,304 | [
"MIT"
] | 56 | 7f4761bddc65282ea31a2d0f9eb146772276dd7c | https://github.com/qinjian623/pytorch_toys/tree/7f4761bddc65282ea31a2d0f9eb146772276dd7c |
Connect2Model | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class Connect2Model(nn.Module):
def __init__(self, board_size, action_size, device):
super(Connect2Model, self).__init__()
self.device = device
self.size = board_size
self.action_size = action_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | quangchiem139/AlphaZeroSimple | Connect2Model | false | 16,305 | [
"MIT"
] | 76 | 1b1096cc4b2aded6337a90035aee56b370ea1d3a | https://github.com/quangchiem139/AlphaZeroSimple/tree/1b1096cc4b2aded6337a90035aee56b370ea1d3a |
SimpleSpatialEmbedding | import torch
class SimpleSpatialEmbedding(torch.nn.Module):
def __init__(self, in_features, out_features, weight_multiplier=1.0):
super(SimpleSpatialEmbedding, self).__init__()
self.b = torch.zeros((in_features, out_features))
self.b.normal_(0, weight_multiplier)
self.b = torch.nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_s... | qway/nerfmeshes | SimpleSpatialEmbedding | false | 16,306 | [
"MIT"
] | 113 | d983dcbbcfec1337c9f2040969213c6d1ea0c39e | https://github.com/qway/nerfmeshes/tree/d983dcbbcfec1337c9f2040969213c6d1ea0c39e |
SkipModule | import torch
class SkipModule(torch.nn.Module):
def __init__(self, in_features, out_features, activation=torch.nn.ReLU()):
super(SkipModule, self).__init__()
self.linear1 = torch.nn.Linear(in_features, out_features, activation)
self.linear2 = torch.nn.Linear(out_features, out_features, ac... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | qway/nerfmeshes | SkipModule | false | 16,307 | [
"MIT"
] | 113 | d983dcbbcfec1337c9f2040969213c6d1ea0c39e | https://github.com/qway/nerfmeshes/tree/d983dcbbcfec1337c9f2040969213c6d1ea0c39e |
SimpleEmbed | import math
import torch
import torch.nn as nn
class SimpleEmbed(nn.Module):
def __init__(self, d_feat, embed_dim):
super(SimpleEmbed, self).__init__()
self.d_feat = d_feat
self.embed_dim = embed_dim
self.proj = nn.Linear(d_feat, embed_dim)
def forward(self, x):
x = x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | rainwangphy/AutoDL-Projects | SimpleEmbed | false | 16,308 | [
"MIT"
] | 923 | 1a40948255ac3c16ee529d94144a39bf26e89bfa | https://github.com/rainwangphy/AutoDL-Projects/tree/1a40948255ac3c16ee529d94144a39bf26e89bfa |
Embbed2 | import torch
class Embbed2(torch.nn.Module):
def __init__(self, in_features, out_features, weight_multiplier=1.0):
super(Embbed2, self).__init__()
self.b = 2.0 ** torch.linspace(0, weight_multiplier, out_features //
in_features) - 1
self.b = torch.nn.Parameter(torch.reshape(to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_s... | qway/nerfmeshes | Embbed2 | false | 16,309 | [
"MIT"
] | 113 | d983dcbbcfec1337c9f2040969213c6d1ea0c39e | https://github.com/qway/nerfmeshes/tree/d983dcbbcfec1337c9f2040969213c6d1ea0c39e |
SpatialEmbedding | import torch
class SpatialEmbedding(torch.nn.Module):
def __init__(self, in_features, out_features, weight_multiplier=1.0):
super(SpatialEmbedding, self).__init__()
self.b = torch.zeros((in_features, out_features))
self.b.normal_(0, weight_multiplier)
self.b = torch.nn.Parameter(2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_s... | qway/nerfmeshes | SpatialEmbedding | false | 16,310 | [
"MIT"
] | 113 | d983dcbbcfec1337c9f2040969213c6d1ea0c39e | https://github.com/qway/nerfmeshes/tree/d983dcbbcfec1337c9f2040969213c6d1ea0c39e |
PotCoSirenModule | import torch
class PotCoSirenModule(torch.nn.Module):
def __init__(self, in_features, out_features, weight_multiplier=1.0):
super(PotCoSirenModule, self).__init__()
self.linear = torch.nn.Linear(in_features, out_features // 2)
torch.nn.init.uniform_(self.linear.weight, a=-weight_multiplie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_s... | qway/nerfmeshes | PotCoSirenModule | false | 16,311 | [
"MIT"
] | 113 | d983dcbbcfec1337c9f2040969213c6d1ea0c39e | https://github.com/qway/nerfmeshes/tree/d983dcbbcfec1337c9f2040969213c6d1ea0c39e |
Attention | import math
import torch
from torch import nn
class Attention(nn.Module):
"""A generic attention module for a decoder in seq2seq"""
def __init__(self, dim, use_tanh=False, C=10):
super(Attention, self).__init__()
self.use_tanh = use_tanh
self.project_query = nn.Linear(dim, 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
import math
from to... | rdjdejong/attention-learn-to-route | Attention | false | 16,312 | [
"MIT"
] | 540 | 3b6bbdad677a36df53eabad98b48f436be298ac8 | https://github.com/rdjdejong/attention-learn-to-route/tree/3b6bbdad677a36df53eabad98b48f436be298ac8 |
RandomShiftsAug | import torch
import torch.nn as nn
import torch.nn.functional as F
class RandomShiftsAug(nn.Module):
def __init__(self, pad):
super().__init__()
self.pad = pad
def forward(self, x):
x = x.float()
n, _c, h, w = x.size()
assert h == w
padding = tuple([self.pad] ... | import torch
from torch import device
import triton
import triton.language 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._d... | rajeswar18/url_benchmark | RandomShiftsAug | false | 16,313 | [
"MIT"
] | 180 | 2fdfd82a9067222106ef7627f71b1e1ae5d70a85 | https://github.com/rajeswar18/url_benchmark/tree/2fdfd82a9067222106ef7627f71b1e1ae5d70a85 |
L2Norm | import torch
import torch.nn as nn
import torch.nn.init
import torch.nn
class L2Norm(nn.Module):
def __init__(self):
super(L2Norm, self).__init__()
self.eps = 1e-10
def forward(self, x):
norm = torch.sqrt(torch.abs(torch.sum(x * x, dim=1)) + self.eps)
x = x / norm.unsqueeze(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, math as tl_math
import torch.nn as nn
import torch.nn.init
import torch.nn
ass... | rdguez-mariano/affnet | L2Norm | false | 16,314 | [
"MIT"
] | 211 | a3f0bb32d9001d1daf024f38d29867f37816ea78 | https://github.com/rdguez-mariano/affnet/tree/a3f0bb32d9001d1daf024f38d29867f37816ea78 |
GlobalAttention | import torch
import torch.nn as nn
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 have the same value: ' + str(args)
class Bottle(nn.Module):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rajasagashe/coarse2fine | GlobalAttention | false | 16,315 | [
"MIT"
] | 164 | d6c51a3073df9018e32c95c257c68b0d69d9aa46 | https://github.com/rajasagashe/coarse2fine/tree/d6c51a3073df9018e32c95c257c68b0d69d9aa46 |
LearnableTimeDepWeightedCost | import torch
import torch.utils.data
class LearnableTimeDepWeightedCost(torch.nn.Module):
def __init__(self, time_horizon, dim=9, weights=None):
super(LearnableTimeDepWeightedCost, self).__init__()
if weights is None:
self.weights = torch.nn.Parameter(0.01 * torch.ones([
... | 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_... | ricklentz/LearningToLearn | LearnableTimeDepWeightedCost | false | 16,317 | [
"MIT"
] | 76 | fa32b98b40402fa15982b450ed09d9d3735ec924 | https://github.com/ricklentz/LearningToLearn/tree/fa32b98b40402fa15982b450ed09d9d3735ec924 |
CmapPafHeadAttention | import torch
import torch.utils.data
import torch.nn
import torch.optim
class UpsampleCBR(torch.nn.Sequential):
def __init__(self, input_channels, output_channels, count=1, num_flat=0):
layers = []
for i in range(count):
if i == 0:
inch = input_channels
els... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | quantd2/trt_pose | CmapPafHeadAttention | false | 16,318 | [
"MIT"
] | 738 | 44c5e826977f20c8dad2d9725313a18cb2189853 | https://github.com/quantd2/trt_pose/tree/44c5e826977f20c8dad2d9725313a18cb2189853 |
MultiHeadAttention | import math
import torch
import numpy as np
from torch import nn
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, input_dim, embed_dim, val_dim=None, key_dim
=None):
super(MultiHeadAttention, self).__init__()
if val_dim is None:
val_dim = embed_dim // n_heads
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rdjdejong/attention-learn-to-route | MultiHeadAttention | false | 16,319 | [
"MIT"
] | 540 | 3b6bbdad677a36df53eabad98b48f436be298ac8 | https://github.com/rdjdejong/attention-learn-to-route/tree/3b6bbdad677a36df53eabad98b48f436be298ac8 |
LocalNorm2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init
import torch.nn
class LocalNorm2d(nn.Module):
def __init__(self, kernel_size=33):
super(LocalNorm2d, self).__init__()
self.ks = kernel_size
self.pool = nn.AvgPool2d(kernel_size=self.ks, stride=1, paddi... | 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... | rdguez-mariano/affnet | LocalNorm2d | false | 16,320 | [
"MIT"
] | 211 | a3f0bb32d9001d1daf024f38d29867f37816ea78 | https://github.com/rdguez-mariano/affnet/tree/a3f0bb32d9001d1daf024f38d29867f37816ea78 |
HessianResp | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init
import torch.nn
class HessianResp(nn.Module):
def __init__(self):
super(HessianResp, self).__init__()
self.gx = nn.Conv2d(1, 1, kernel_size=(1, 3), bias=False)
self.gx.weight.data = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | rdguez-mariano/affnet | HessianResp | false | 16,321 | [
"MIT"
] | 211 | a3f0bb32d9001d1daf024f38d29867f37816ea78 | https://github.com/rdguez-mariano/affnet/tree/a3f0bb32d9001d1daf024f38d29867f37816ea78 |
Conv2dBlock | import torch
import torch.nn.functional as F
import torch.nn as nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mom... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ricklentz/Seg-Uncertainty | Conv2dBlock | false | 16,322 | [
"MIT"
] | 298 | 82fd7056cccb265b3fc3e8a90338866661cab230 | https://github.com/ricklentz/Seg-Uncertainty/tree/82fd7056cccb265b3fc3e8a90338866661cab230 |
Conv2DBlock | import torch
import torch.nn as nn
def act_layer(act):
if act == 'relu':
return nn.ReLU()
elif act == 'lrelu':
return nn.LeakyReLU(LRELU_SLOPE)
elif act == 'elu':
return nn.ELU()
elif act == 'tanh':
return nn.Tanh()
elif act == 'prelu':
return nn.PReLU()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | rll-research/ARM | Conv2DBlock | false | 16,323 | [
"BSD-3-Clause"
] | 46 | 7a51e00fabdcdbd8ad2b235266c66115e79deeb0 | https://github.com/rll-research/ARM/tree/7a51e00fabdcdbd8ad2b235266c66115e79deeb0 |
ReGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | robburdon/pytorch_tabular | ReGLU | false | 16,324 | [
"MIT"
] | 560 | 9bf75f22c6e1b3033ad699713e77c283d55f3555 | https://github.com/robburdon/pytorch_tabular/tree/9bf75f22c6e1b3033ad699713e77c283d55f3555 |
SwiGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | robburdon/pytorch_tabular | SwiGLU | false | 16,325 | [
"MIT"
] | 560 | 9bf75f22c6e1b3033ad699713e77c283d55f3555 | https://github.com/robburdon/pytorch_tabular/tree/9bf75f22c6e1b3033ad699713e77c283d55f3555 |
SA_block_def | import torch
import torch.nn as nn
class SA_block_def(nn.Module):
"""Self-Attention block with dot product for point/voxel/pillar context.
"""
def __init__(self, inplanes, planes, groups=4):
super().__init__()
self.groups = groups
self.t = nn.Conv1d(inplanes, planes, kernel_size=1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | reinforcementdriving/SA-Det3D | SA_block_def | false | 16,326 | [
"MIT"
] | 134 | 682cbf5a3023bd580632435d1e4e0acb0ae08ab8 | https://github.com/reinforcementdriving/SA-Det3D/tree/682cbf5a3023bd580632435d1e4e0acb0ae08ab8 |
SA_block | import torch
import torch.nn as nn
class SA_block(nn.Module):
"""Self-Attention block with dot product for point/voxel/pillar context.
A part of the code is from MLCVNet (CVPR 2020).
"""
def __init__(self, inplanes, planes, groups=4):
super().__init__()
self.groups = groups
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | reinforcementdriving/SA-Det3D | SA_block | false | 16,327 | [
"MIT"
] | 134 | 682cbf5a3023bd580632435d1e4e0acb0ae08ab8 | https://github.com/reinforcementdriving/SA-Det3D/tree/682cbf5a3023bd580632435d1e4e0acb0ae08ab8 |
Conv3DBlock | import torch
import torch.nn as nn
from typing import Union
def act_layer(act):
if act == 'relu':
return nn.ReLU()
elif act == 'lrelu':
return nn.LeakyReLU(LRELU_SLOPE)
elif act == 'elu':
return nn.ELU()
elif act == 'tanh':
return nn.Tanh()
elif act == 'prelu':
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 typing import Union
assert_size_stride = torch._C._dy... | rll-research/ARM | Conv3DBlock | false | 16,328 | [
"BSD-3-Clause"
] | 46 | 7a51e00fabdcdbd8ad2b235266c66115e79deeb0 | https://github.com/rll-research/ARM/tree/7a51e00fabdcdbd8ad2b235266c66115e79deeb0 |
rpn_head | import torch
class rpn_head(torch.nn.Module):
def __init__(self, in_channels=1024, out_channels=1024, n_anchors=15):
super(rpn_head, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.sigmoid = torch.nn.Sigmoid()
self.conv_rpn = torch.nn.Conv2d(in_channels, out_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
assert_size_stride = torch._C... | peckjon/detectorch | rpn_head | false | 16,329 | [
"Apache-2.0"
] | 627 | 69d31250d79a72b12b7419638ef59163f833bbba | https://github.com/peckjon/detectorch/tree/69d31250d79a72b12b7419638ef59163f833bbba |
AttentionLoss | import torch
from torch import nn
class AttentionLoss(nn.Module):
def __init__(self, beta=4, gamma=0.5):
super(AttentionLoss, self).__init__()
self.beta = beta
self.gamma = gamma
def forward(self, pred, gt):
num_pos = torch.sum(gt)
num_neg = torch.sum(1 - gt)
... | 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 ... | robtu328/TextBPN | AttentionLoss | false | 16,330 | [
"MIT"
] | 49 | 225844770e0107817be9fb86d53f873fa3eb07ae | https://github.com/robtu328/TextBPN/tree/225844770e0107817be9fb86d53f873fa3eb07ae |
L2Norm | import torch
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self, n_channels, scale):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
... | 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 math import sqrt as sqrt
from itertools import produ... | robtu328/TextDetCorner | L2Norm | false | 16,331 | [
"Python-2.0",
"OLDAP-2.7"
] | 331 | f37ef0e1d2068c5fbd643855acd21787a2c122c5 | https://github.com/robtu328/TextDetCorner/tree/f37ef0e1d2068c5fbd643855acd21787a2c122c5 |
GEGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | robburdon/pytorch_tabular | GEGLU | false | 16,332 | [
"MIT"
] | 560 | 9bf75f22c6e1b3033ad699713e77c283d55f3555 | https://github.com/robburdon/pytorch_tabular/tree/9bf75f22c6e1b3033ad699713e77c283d55f3555 |
Mnist_CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class Mnist_CNN(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | rgommers/tutorials | Mnist_CNN | false | 16,333 | [
"BSD-3-Clause"
] | 6,424 | 9341570d4d8ed2c77371eac3b8520f7038d731ee | https://github.com/rgommers/tutorials/tree/9341570d4d8ed2c77371eac3b8520f7038d731ee |
CoxPHLossSorted | import torch
from torch import Tensor
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\in R_i} h_j})^d$,
where... | 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 Tens... | rohanshad/pycox | CoxPHLossSorted | false | 16,334 | [
"BSD-2-Clause"
] | 449 | 5483489d21f3441e53f78f9f8898ce607f41c632 | https://github.com/rohanshad/pycox/tree/5483489d21f3441e53f78f9f8898ce607f41c632 |
CoxPHLoss | import torch
from torch import Tensor
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\in R_i} h_j})^d$,
where... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_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 ... | rohanshad/pycox | CoxPHLoss | false | 16,335 | [
"BSD-2-Clause"
] | 449 | 5483489d21f3441e53f78f9f8898ce607f41c632 | https://github.com/rohanshad/pycox/tree/5483489d21f3441e53f78f9f8898ce607f41c632 |
MergeBlok | import torch
from torch import nn
import torch.nn.functional as F
class MergeBlok(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.conv1x1 = nn.Conv2d(in_channels, out_channels, kernel_size=1,
stride=1, padding=0)
self.conv3x3 = nn.Conv2d(out_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | robtu328/TextBPN | MergeBlok | false | 16,336 | [
"MIT"
] | 49 | 225844770e0107817be9fb86d53f873fa3eb07ae | https://github.com/robtu328/TextBPN/tree/225844770e0107817be9fb86d53f873fa3eb07ae |
PatchMerge | import torch
from torch import nn
def patchify(input, size):
batch, height, width, dim = input.shape
return input.view(batch, height // size, size, width // size, size, dim
).permute(0, 1, 3, 2, 4, 5).reshape(batch, height // size, width //
size, -1)
class PatchMerge(nn.Module):
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
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | rosinality/vision-transformers-pytorch | PatchMerge | false | 16,337 | [
"MIT"
] | 77 | b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f | https://github.com/rosinality/vision-transformers-pytorch/tree/b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f |
UpBlok | import torch
from torch import nn
import torch.nn.functional as F
class UpBlok(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.conv1x1 = nn.Conv2d(in_channels, out_channels, kernel_size=1,
stride=1, padding=0)
self.conv3x3 = nn.Conv2d(out_cha... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | robtu328/TextBPN | UpBlok | false | 16,338 | [
"MIT"
] | 49 | 225844770e0107817be9fb86d53f873fa3eb07ae | https://github.com/robtu328/TextBPN/tree/225844770e0107817be9fb86d53f873fa3eb07ae |
LMCriterion | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch.autograd import Variable
class LMCriterion(nn.Module):
def __init__(self):
super(LMCriterion, self).__init__()
def forward(self, input, target):
logprob_select = torch.gather(input, 1, target)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | roma-ghewari/visDial.pytorch | LMCriterion | false | 16,339 | [
"MIT"
] | 123 | 03fe6e679170d54a985b6402f07fea4a5fb4dd73 | https://github.com/roma-ghewari/visDial.pytorch/tree/03fe6e679170d54a985b6402f07fea4a5fb4dd73 |
PositionalEncodingGenerator | import torch
from torch import nn
class PositionalEncodingGenerator(nn.Module):
def __init__(self, dim):
super().__init__()
self.proj = nn.Conv2d(dim, dim, 3, padding=1, bias=False, groups=dim)
def forward(self, input):
out = input.permute(0, 3, 1, 2)
out = self.proj(out) + o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | rosinality/vision-transformers-pytorch | PositionalEncodingGenerator | false | 16,340 | [
"MIT"
] | 77 | b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f | https://github.com/rosinality/vision-transformers-pytorch/tree/b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f |
SILogLoss | import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn
class SILogLoss(nn.Module):
def __init__(self):
super(SILogLoss, self).__init__()
self.name = 'SILog'
def forward(self, input, target, mask=None, interpolate=True):
if interpolate:
inpu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | rosivbus/aphantasia | SILogLoss | false | 16,341 | [
"MIT"
] | 579 | e739f21721222c3ea99aff3324f293fa5c5dd36d | https://github.com/rosivbus/aphantasia/tree/e739f21721222c3ea99aff3324f293fa5c5dd36d |
gumbel_sampler | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
class gumbel_sampler(nn.Module):
def __init__(self):
super(gumbel_sampler, self).__init__()
def forward(self, input, noise, temperature=0.5):
eps = 1e-20
noise.data.add... | 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
... | roma-ghewari/visDial.pytorch | gumbel_sampler | false | 16,342 | [
"MIT"
] | 123 | 03fe6e679170d54a985b6402f07fea4a5fb4dd73 | https://github.com/roma-ghewari/visDial.pytorch/tree/03fe6e679170d54a985b6402f07fea4a5fb4dd73 |
MultiHeadedAttention | import math
import torch
from torch import nn
class MultiHeadedAttention(nn.Module):
def __init__(self, dim, n_head, bias=True, dropout=0):
super().__init__()
self.dim_head = dim // n_head
self.n_head = n_head
self.qkv = nn.Linear(dim, dim * 3, bias=bias)
self.dropout = 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.... | rosinality/vision-transformers-pytorch | MultiHeadedAttention | false | 16,343 | [
"MIT"
] | 77 | b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f | https://github.com/rosinality/vision-transformers-pytorch/tree/b884b5da79900c96e4ce17fbb575cf1c5cb3cd5f |
ConvWithBatchNorm | import torch
from torch import nn
class ConvWithBatchNorm(nn.Module):
def __init__(self, in_channels, out_channels, spacetime_ndim,
kernel_size=3, normalization=None, activation='ReLU'):
super(ConvWithBatchNorm, self).__init__()
self.in_channels = in_channels
self.out_channels = o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | royerloic/aydin | ConvWithBatchNorm | false | 16,344 | [
"BSD-3-Clause"
] | 78 | f9c61a24030891d008c318b250da5faec69fcd7d | https://github.com/royerloic/aydin/tree/f9c61a24030891d008c318b250da5faec69fcd7d |
BasicConvBlock | import torch
from torch import nn
import torch.nn.functional as F
class BasicConvBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(BasicConvBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3,
padding=1)
self.conv2 = 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.triton_helpers import libdevice
from torch import n... | royerloic/aydin | BasicConvBlock | false | 16,345 | [
"BSD-3-Clause"
] | 78 | f9c61a24030891d008c318b250da5faec69fcd7d | https://github.com/royerloic/aydin/tree/f9c61a24030891d008c318b250da5faec69fcd7d |
DotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class DotProductAttention(nn.Module):
"""
Dot product attention.
Given a set of vector values, and a vector query, attention is a technique
to compute a weighted sum of the values, dependent on the query.
NOTE: Here we use the term... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rupeshshrestha123/end2end-asr-pytorch | DotProductAttention | false | 16,346 | [
"MIT"
] | 250 | 8aada8f7cbe90e1d0b05d505042d9e42b8e4dd52 | https://github.com/rupeshshrestha123/end2end-asr-pytorch/tree/8aada8f7cbe90e1d0b05d505042d9e42b8e4dd52 |
Attention | import math
import torch
from torch import nn
from torch.nn import functional as F
class Attention(nn.Module):
def __init__(self, hidden_size):
super(Attention, self).__init__()
self.hidden_size = hidden_size
self.attn = nn.Linear(self.hidden_size * 2, hidden_size)
self.v = nn.Par... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ronak-44/smiles-transformer | Attention | false | 16,347 | [
"MIT"
] | 154 | 8965ca6211da721a8b708d1b3fa567b1bfd907cf | https://github.com/ronak-44/smiles-transformer/tree/8965ca6211da721a8b708d1b3fa567b1bfd907cf |
CPAMDec | from torch.nn import Module
import torch
from torchvision.datasets import *
from torch.nn import Conv2d
from torch.nn import Parameter
from torch.nn import Linear
from torch.nn import Softmax
from torchvision.transforms import *
class CPAMDec(Module):
"""
CPAM decoding module
"""
def __init__(self, i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ruijieren98/DANet | CPAMDec | false | 16,348 | [
"MIT"
] | 2,190 | e38d61e371179833c08888fd5a1ee444cf5bd875 | https://github.com/ruijieren98/DANet/tree/e38d61e371179833c08888fd5a1ee444cf5bd875 |
ShiftedSoftplus | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.tensorboard
class ShiftedSoftplus(nn.Module):
def __init__(self):
super().__init__()
self.shift = torch.log(torch.tensor(2.0)).item()
def forward(self, x):
return F.softplus(x) - self.shift
def ge... | 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.utils.tensorboard
assert_si... | hengwei-chan/3D_SBDD | ShiftedSoftplus | false | 16,349 | [
"MIT"
] | 67 | eda6d51aaf01ef25581a46920a25161678fab76d | https://github.com/hengwei-chan/3D_SBDD/tree/eda6d51aaf01ef25581a46920a25161678fab76d |
CausalConv1d | import torch
import torch.nn as nn
import torch.utils.data
import torch
class CausalConv1d(nn.Module):
"""A 1D causal convolution layer.
Input: (B, D_in, T), where B is the minibatch size, D_in is the number of
dimensions per step, and T is the number of steps.
Output: (B, D_out, T), where B is 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
import torch.nn as nn
import torch.utils.data
import torch
assert_size_stride = ... | sagelywizard/snail | CausalConv1d | false | 16,350 | [
"MIT"
] | 100 | 1c64787aa970c82f65c3c9d253531d1c2b1bee08 | https://github.com/sagelywizard/snail/tree/1c64787aa970c82f65c3c9d253531d1c2b1bee08 |
softCE | import torch
import torch.nn as nn
import torch.nn.init
class softCE(nn.Module):
"""
The objective function for the distant supervised typing.
Parameters
----------
if_average : ``bool``, optional, (default = True).
Whether to average over batches or not.
"""
def __init__(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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | s-tatsu/AutoNER | softCE | false | 16,351 | [
"Apache-2.0"
] | 446 | 75f8d092a5bf83fabf4ac4e879fab9120bbcd083 | https://github.com/s-tatsu/AutoNER/tree/75f8d092a5bf83fabf4ac4e879fab9120bbcd083 |
AttnConnector | import torch
import torch.nn.functional as F
import torch.nn as nn
class AttnConnector(nn.Module):
def __init__(self, rnn_cell, query_size, key_size, content_size,
output_size, attn_size):
super(AttnConnector, self).__init__()
self.query_embed = nn.Linear(query_size, attn_size)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ruinunca/NeuralDialog-ZSDG | AttnConnector | false | 16,352 | [
"Apache-2.0"
] | 132 | c20359541036ea876a126d1c7c172b820476dcb2 | https://github.com/ruinunca/NeuralDialog-ZSDG/tree/c20359541036ea876a126d1c7c172b820476dcb2 |
DenseBlock | import torch
import torch.nn as nn
import torch.utils.data
import torch
import torch.nn.functional as F
class CausalConv1d(nn.Module):
"""A 1D causal convolution layer.
Input: (B, D_in, T), where B is the minibatch size, D_in is the number of
dimensions per step, and T is the number of steps.
Out... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | sagelywizard/snail | DenseBlock | false | 16,353 | [
"MIT"
] | 100 | 1c64787aa970c82f65c3c9d253531d1c2b1bee08 | https://github.com/sagelywizard/snail/tree/1c64787aa970c82f65c3c9d253531d1c2b1bee08 |
ConvBlock | import torch
from torch import nn
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout=False, norm=None,
residual=True, activation='leakyrelu', in_place_activation=True,
transpose=False, reflectpad=True):
super(ConvBlock, self).__init__()
self.dropout ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch im... | royerloic/aydin | ConvBlock | false | 16,354 | [
"BSD-3-Clause"
] | 78 | f9c61a24030891d008c318b250da5faec69fcd7d | https://github.com/royerloic/aydin/tree/f9c61a24030891d008c318b250da5faec69fcd7d |
Normalize | import torch
from torchvision.datasets import *
import torch.nn.functional as F
import torch.nn as nn
from torchvision.transforms import *
class Normalize(nn.Module):
"""Performs :math:`L_p` normalization of inputs over specified dimension.
Does:
.. math::
v = \\frac{v}{\\max(\\lVert v \\rVert_p... | 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 torchvision.datasets im... | ruijieren98/DANet | Normalize | false | 16,355 | [
"MIT"
] | 2,190 | e38d61e371179833c08888fd5a1ee444cf5bd875 | https://github.com/ruijieren98/DANet/tree/e38d61e371179833c08888fd5a1ee444cf5bd875 |
CausalConv2d | import torch
from torch import nn
class WNConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True, activation=None):
super().__init__()
self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel,
kernel_size, stride=st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | sajjad2014/vq-vae-2-pytorch | CausalConv2d | false | 16,356 | [
"MIT"
] | 1,007 | ef5f67c46f93624163776caec9e0d95063910eca | https://github.com/sajjad2014/vq-vae-2-pytorch/tree/ef5f67c46f93624163776caec9e0d95063910eca |
SpatialRescaler | import torch
from functools import partial
import torch.nn as nn
class SpatialRescaler(nn.Module):
def __init__(self, n_stages=1, method='bilinear', multiplier=0.5,
in_channels=3, out_channels=None, bias=False):
super().__init__()
self.n_stages = n_stages
assert self.n_stages >= 0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from functools import partial
import torch.nn as nn
assert_size_stride = torch._C._dynamo... | samedii/latent-diffusion | SpatialRescaler | false | 16,357 | [
"MIT"
] | 563 | f13bf9bf463d95b5a16aeadd2b02abde31f769f8 | https://github.com/samedii/latent-diffusion/tree/f13bf9bf463d95b5a16aeadd2b02abde31f769f8 |
UpsampleConv2d | from torch.nn import Module
import math
import torch
from torchvision.datasets import *
import torch.nn.functional as F
from torch.nn import Parameter
from torch.nn.modules.utils import _pair
from torchvision.transforms import *
class UpsampleConv2d(Module):
"""
To avoid the checkerboard artifacts of standard... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torchvision.datasets import *
from ... | ruijieren98/DANet | UpsampleConv2d | false | 16,358 | [
"MIT"
] | 2,190 | e38d61e371179833c08888fd5a1ee444cf5bd875 | https://github.com/ruijieren98/DANet/tree/e38d61e371179833c08888fd5a1ee444cf5bd875 |
CCAMDec | from torch.nn import Module
import torch
from torchvision.datasets import *
from torch.nn import Parameter
from torch.nn import Softmax
from torchvision.transforms import *
class CCAMDec(Module):
"""
CCAM decoding module
"""
def __init__(self):
super(CCAMDec, self).__init__()
self.sof... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ruijieren98/DANet | CCAMDec | false | 16,359 | [
"MIT"
] | 2,190 | e38d61e371179833c08888fd5a1ee444cf5bd875 | https://github.com/ruijieren98/DANet/tree/e38d61e371179833c08888fd5a1ee444cf5bd875 |
TransposedUpsample | import torch
import torch.nn as nn
class TransposedUpsample(nn.Module):
"""Learned 2x upsampling without padding"""
def __init__(self, channels, out_channels=None, ks=5):
super().__init__()
self.channels = channels
self.out_channels = out_channels or channels
self.up = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | samedii/latent-diffusion | TransposedUpsample | false | 16,360 | [
"MIT"
] | 563 | f13bf9bf463d95b5a16aeadd2b02abde31f769f8 | https://github.com/samedii/latent-diffusion/tree/f13bf9bf463d95b5a16aeadd2b02abde31f769f8 |
VeryFlatNet | import torch
from torch import nn
from itertools import chain
import torch.nn.functional as F
class VeryFlatNet(nn.Module):
def __init__(self, num_channels=128, kernel_size=9):
super(VeryFlatNet, self).__init__()
self.num_channels = num_channels
None
padding = int((kernel_size - 1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from ite... | royerloic/aydin | VeryFlatNet | false | 16,361 | [
"BSD-3-Clause"
] | 78 | f9c61a24030891d008c318b250da5faec69fcd7d | https://github.com/royerloic/aydin/tree/f9c61a24030891d008c318b250da5faec69fcd7d |
GEGLU | import torch
import torch.nn.functional as F
import torch.nn as nn
class GEGLU(nn.Module):
def __init__(self, dim_in, dim_out):
super().__init__()
self.proj = nn.Linear(dim_in, dim_out * 2)
def forward(self, x):
x, gate = self.proj(x).chunk(2, dim=-1)
return x * F.gelu(gate)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | samedii/latent-diffusion | GEGLU | false | 16,362 | [
"MIT"
] | 563 | f13bf9bf463d95b5a16aeadd2b02abde31f769f8 | https://github.com/samedii/latent-diffusion/tree/f13bf9bf463d95b5a16aeadd2b02abde31f769f8 |
ResizeGatedConv2d | import torch
import torch.utils.data
import torch.nn as nn
class GatedConv2d(nn.Module):
def __init__(self, input_channels, output_channels, kernel_size, stride,
padding, dilation=1, activation=None):
super(GatedConv2d, self).__init__()
self.activation = activation
self.sigmoid = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | sanghiad/vae_vampprior | ResizeGatedConv2d | false | 16,363 | [
"MIT"
] | 218 | d24bc0c8781b7ee7b9570c2d560e43bceff50da4 | https://github.com/sanghiad/vae_vampprior/tree/d24bc0c8781b7ee7b9570c2d560e43bceff50da4 |
GatedResUnit | import torch
import torch.utils.data
import torch.nn as nn
class GatedConv2d(nn.Module):
def __init__(self, input_channels, output_channels, kernel_size, stride,
padding, dilation=1, activation=None):
super(GatedConv2d, self).__init__()
self.activation = activation
self.sigmoid = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | sanghiad/vae_vampprior | GatedResUnit | false | 16,364 | [
"MIT"
] | 218 | d24bc0c8781b7ee7b9570c2d560e43bceff50da4 | https://github.com/sanghiad/vae_vampprior/tree/d24bc0c8781b7ee7b9570c2d560e43bceff50da4 |
GaussianLoss | import torch
class GaussianLoss(torch.nn.Module):
"""
Gaussian log-likelihood loss. It assumes targets `y` with n rows and d
columns, but estimates `yhat` with n rows and 2d columns. The columns 0:d
of `yhat` contain estimated means, the columns d:2*d of `yhat` contain
estimated variances. This mo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | scottgigante-immunai/CPA | GaussianLoss | false | 16,365 | [
"MIT"
] | 132 | 9338ede503d36c6163a521bee904aa93d896ef92 | https://github.com/scottgigante-immunai/CPA/tree/9338ede503d36c6163a521bee904aa93d896ef92 |
FeedForward | import torch
import torch.cuda
import torch.distributed
class FeedForward(torch.nn.Module):
def __init__(self, input_size, hidden_size, dropout):
super().__init__()
self.linear1 = torch.nn.Linear(input_size, hidden_size)
self.linear2 = torch.nn.Linear(hidden_size, input_size)
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | sakrnference/data-to-text-hierarchical | FeedForward | false | 16,366 | [
"Apache-2.0"
] | 82 | 09b8fa8bf85385f25348378a30e830d425c93db3 | https://github.com/sakrnference/data-to-text-hierarchical/tree/09b8fa8bf85385f25348378a30e830d425c93db3 |
NBLoss | import torch
import numpy as np
def _nan2inf(x):
return torch.where(torch.isnan(x), torch.zeros_like(x) + np.inf, x)
class NBLoss(torch.nn.Module):
def __init__(self):
super(NBLoss, self).__init__()
def forward(self, yhat, y, eps=1e-08):
"""Negative binomial log-likelihood loss. It ass... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import numpy as np
assert_size_stride = torch._C._dynamo.guard... | scottgigante-immunai/CPA | NBLoss | false | 16,367 | [
"MIT"
] | 132 | 9338ede503d36c6163a521bee904aa93d896ef92 | https://github.com/scottgigante-immunai/CPA/tree/9338ede503d36c6163a521bee904aa93d896ef92 |
VGG_16 | import torch
import torch.nn.functional as F
import torch.nn as nn
class VGG_16(nn.Module):
"""
VGG-16 without pooling layer before fc layer
"""
def __init__(self):
super(VGG_16, self).__init__()
self.convolution1_1 = nn.Conv2d(3, 64, 3, padding=1)
self.convolution1_2 = 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | qiu9yu/Lets_OCR | VGG_16 | false | 16,368 | [
"MIT"
] | 671 | 62d68b044250d02a9d5ac8c4fbd08cec83faa0d1 | https://github.com/qiu9yu/Lets_OCR/tree/62d68b044250d02a9d5ac8c4fbd08cec83faa0d1 |
CNN | import torch
from torch import nn
import torch.nn.functional as F
class CNN(torch.nn.Module):
"""Basic CNN architecture."""
def __init__(self, in_channels=1):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(in_channels, 64, 8, 1)
self.conv2 = nn.Conv2d(64, 128, 6, 2)
self.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 nn
assert_s... | saumya0303/cleverhans | CNN | false | 16,369 | [
"MIT"
] | 4,333 | 03f3ee254c2a1c4ebd91728263b66ff29e8b4f78 | https://github.com/saumya0303/cleverhans/tree/03f3ee254c2a1c4ebd91728263b66ff29e8b4f78 |
DeConv2dBlock | import torch
from torch import nn
class DeConv2dBlock(nn.Module):
"""
Similar to a LeNet block
4x upsampling, dimension hard-coded
"""
def __init__(self, in_dim: 'int', hidden_dim: 'int', out_dim: 'int',
stride: 'int'=2, kernel_size: 'int'=3, padding: 'int'=2,
output_padding: 'int... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | scaomath/galerkin-transformer | DeConv2dBlock | false | 16,370 | [
"MIT"
] | 106 | a9c2dc4427bfaba051d7e0154f110e460050c1df | https://github.com/scaomath/galerkin-transformer/tree/a9c2dc4427bfaba051d7e0154f110e460050c1df |
Block | import torch
import torch.nn as nn
import torch.nn.functional as F
class LayerNorm(nn.Module):
"""LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to inputs with
shape (batch_size, height, width, ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | sayakpaul/ConvNeXt-TF | Block | false | 16,371 | [
"Apache-2.0"
] | 68 | bf610810558b4248cd969aa7db42fadff1fdf57a | https://github.com/sayakpaul/ConvNeXt-TF/tree/bf610810558b4248cd969aa7db42fadff1fdf57a |
ResizeConv2d | import torch
import torch.utils.data
import torch.nn as nn
class ResizeConv2d(nn.Module):
def __init__(self, input_channels, output_channels, kernel_size, stride,
padding, dilation=1, scale_factor=2, activation=None):
super(ResizeConv2d, self).__init__()
self.activation = 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
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dyn... | sanghiad/vae_vampprior | ResizeConv2d | false | 16,372 | [
"MIT"
] | 218 | d24bc0c8781b7ee7b9570c2d560e43bceff50da4 | https://github.com/sanghiad/vae_vampprior/tree/d24bc0c8781b7ee7b9570c2d560e43bceff50da4 |
MarginMSELoss | import torch
import torch.nn as nn
class MarginMSELoss(nn.Module):
def __init__(self):
super(MarginMSELoss, self).__init__()
def forward(self, scores_pos, scores_neg, label_pos, label_neg):
"""
A Margin-MSE loss, receiving 2 scores and 2 labels and it computes the MSE of the respecti... | 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... | sebastian-hofstaetter/neural-ranking-kd | MarginMSELoss | false | 16,373 | [
"Apache-2.0"
] | 51 | aafcc73d6b78ee9849c3d8f5ccf084051fcae2e9 | https://github.com/sebastian-hofstaetter/neural-ranking-kd/tree/aafcc73d6b78ee9849c3d8f5ccf084051fcae2e9 |
GMoF_unscaled | import torch
import torch.nn as nn
class GMoF_unscaled(nn.Module):
def __init__(self, rho=1):
super(GMoF_unscaled, self).__init__()
self.rho = rho
def extra_repr(self):
return 'rho = {}'.format(self.rho)
def forward(self, residual):
squared_res = residual ** 2
di... | 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... | sanweiliti/HMP | GMoF_unscaled | false | 16,374 | [
"MIT"
] | 92 | 3d1a96ec86a72396349daa9f8dde9b2e5a3fc578 | https://github.com/sanweiliti/HMP/tree/3d1a96ec86a72396349daa9f8dde9b2e5a3fc578 |
ChannelNorm2D | import torch
import torch.nn as nn
class ChannelNorm2D(nn.Module):
"""
Similar to default Torch instanceNorm2D but calculates
moments over channel dimension instead of spatial dims.
Expects input_dim in format (B,C,H,W)
"""
def __init__(self, input_channels, momentum=0.1, eps=0.001, affine=T... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | sedrickkeh/high-fidelity-dual-image | ChannelNorm2D | false | 16,375 | [
"Apache-2.0"
] | 266 | 9cefd378467826b91596653df38666e469bb23e0 | https://github.com/sedrickkeh/high-fidelity-dual-image/tree/9cefd378467826b91596653df38666e469bb23e0 |
Cnn | import torch
import torch.nn as nn
import torch.nn.functional as F
class Cnn(nn.Module):
def __init__(self):
super(Cnn, self).__init__()
None
self.maxpool = nn.MaxPool2d(2)
self.conv1 = nn.Conv2d(3, 8, 3, padding=1)
self.conv2 = nn.Conv2d(8, 12, 3, padding=1)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | satinder147/DeepWay.v2 | Cnn | false | 16,376 | [
"BSD-2-Clause"
] | 57 | c8fca77783ea39f3d17066600d89baf8d0d19a52 | https://github.com/satinder147/DeepWay.v2/tree/c8fca77783ea39f3d17066600d89baf8d0d19a52 |
ConvNet | import torch
import torch.nn.functional as F
import torch.utils.data
import torch.nn as nn
def conv(in_channels, out_channels, kernel_size):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=
kernel_size // 2)
def conv_stride(in_channels, out_channels, kernel_size):
return nn.Conv3d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | runeg96/vgn | ConvNet | false | 16,377 | [
"BSD-3-Clause"
] | 92 | 24278b80935f2a9cd51d20c9e2c5bfe6da4ce53a | https://github.com/runeg96/vgn/tree/24278b80935f2a9cd51d20c9e2c5bfe6da4ce53a |
DiceLoss | import torch
from torch import nn
import torch.hub
def soft_dice_loss(outputs, targets, per_image=False, reduce=True, ohpm=
False, ohpm_pixels=256 * 256):
batch_size = outputs.size()[0]
eps = 0.001
if not per_image:
batch_size = 1
if ohpm:
dice_target = targets.contiguous().view(-1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.hub
assert_size_stride = torch._C._dynamo.guards.assert... | selimsef/xview2_solution | DiceLoss | false | 16,378 | [
"Apache-2.0"
] | 57 | 5d0caba9c7a9c2707565a189f1a091c86d26b546 | https://github.com/selimsef/xview2_solution/tree/5d0caba9c7a9c2707565a189f1a091c86d26b546 |
RNNCell | import torch
from torch import nn
class RNNCell(nn.Module):
def __init__(self, embed_dim, hidden_size, vocab_dim):
super().__init__()
self.hidden_size = hidden_size
self.input2hidden = nn.Linear(embed_dim + hidden_size, hidden_size)
def forward(self, inputs, hidden):
combined... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | sdhnshu/HandsOnDeepLearningWithPytorch | RNNCell | false | 16,379 | [
"MIT"
] | 87 | 2292a952a4cb112b03d5db4048c78bc503eb858d | https://github.com/sdhnshu/HandsOnDeepLearningWithPytorch/tree/2292a952a4cb112b03d5db4048c78bc503eb858d |
Connection_Combination | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
class Connection_Combination(nn.Module):
"""combine 3 types of connection method by 'beta' weights to become an input node """
def _... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | senyang-ml/PoseNFS | Connection_Combination | false | 16,380 | [
"MIT"
] | 53 | 1229abb69917dab1e57def3de0e3fe9a8a3164cd | https://github.com/senyang-ml/PoseNFS/tree/1229abb69917dab1e57def3de0e3fe9a8a3164cd |
FinalConv | import torch
class FinalConv(torch.nn.Module):
def __init__(self, channels):
super().__init__()
self.conv1 = torch.nn.Conv1d(channels, channels, 1)
self.conv2 = torch.nn.Conv1d(channels, channels, 1)
self.relu = torch.nn.ReLU()
self.softmax = torch.nn.Softmax(dim=1)
d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | sdhnshu/HandsOnDeepLearningWithPytorch | FinalConv | false | 16,381 | [
"MIT"
] | 87 | 2292a952a4cb112b03d5db4048c78bc503eb858d | https://github.com/sdhnshu/HandsOnDeepLearningWithPytorch/tree/2292a952a4cb112b03d5db4048c78bc503eb858d |
Scale_B | import torch
import torch.nn as nn
class Scale_B(nn.Module):
"""
Learned per-channel scale factor, used to scale the noise
"""
def __init__(self, n_channel):
super().__init__()
self.weight = nn.Parameter(torch.zeros((1, n_channel, 1, 1)))
def forward(self, noise):
result ... | 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... | sergkuzn148/stg | Scale_B | false | 16,382 | [
"MIT"
] | 96 | 84d9f53ae3665c423836a4d0176dc3b22de62b19 | https://github.com/sergkuzn148/stg/tree/84d9f53ae3665c423836a4d0176dc3b22de62b19 |
SConv2d | import math
import torch
import torch.nn as nn
def quick_scale(module, name='weight'):
ScaleW.apply(module, name)
return module
class ScaleW:
"""
Constructor: name - name of attribute to be scaled
"""
def __init__(self, name):
self.name = name
def scale(self, module):
w... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | sergkuzn148/stg | SConv2d | false | 16,383 | [
"MIT"
] | 96 | 84d9f53ae3665c423836a4d0176dc3b22de62b19 | https://github.com/sergkuzn148/stg/tree/84d9f53ae3665c423836a4d0176dc3b22de62b19 |
IntegrationModule | import torch
from torch import nn
class IntegrationModule(nn.Module):
def __init__(self, min_iou=0.2, enhance_weight_max=1.0,
reduce_weight_max=1.0):
super(IntegrationModule, self).__init__()
self.min_iou = min_iou
self.enhance_weight_max = enhance_weight_max
self.reduce_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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | sguo2908/TADAM | IntegrationModule | false | 16,384 | [
"MIT"
] | 47 | abd0b7422c3582e36c928778894cee8a159f896e | https://github.com/sguo2908/TADAM/tree/abd0b7422c3582e36c928778894cee8a159f896e |
FC_A | import math
import torch
import torch.nn as nn
def quick_scale(module, name='weight'):
ScaleW.apply(module, name)
return module
class ScaleW:
"""
Constructor: name - name of attribute to be scaled
"""
def __init__(self, name):
self.name = name
def scale(self, module):
w... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | sergkuzn148/stg | FC_A | false | 16,385 | [
"MIT"
] | 96 | 84d9f53ae3665c423836a4d0176dc3b22de62b19 | https://github.com/sergkuzn148/stg/tree/84d9f53ae3665c423836a4d0176dc3b22de62b19 |
SLinear | import math
import torch
import torch.nn as nn
def quick_scale(module, name='weight'):
ScaleW.apply(module, name)
return module
class ScaleW:
"""
Constructor: name - name of attribute to be scaled
"""
def __init__(self, name):
self.name = name
def scale(self, module):
w... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | sergkuzn148/stg | SLinear | false | 16,386 | [
"MIT"
] | 96 | 84d9f53ae3665c423836a4d0176dc3b22de62b19 | https://github.com/sergkuzn148/stg/tree/84d9f53ae3665c423836a4d0176dc3b22de62b19 |
Sinkhorn_Net | import torch
from torch import nn
import torch.cuda
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class Features(nn.Module):
def __init__(self, latent_dim, output_dim, dropout_prob):
"""
In the constructor we instantiate two nn.Linear modu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | sfox14/butterfly | Sinkhorn_Net | false | 16,387 | [
"Apache-2.0"
] | 52 | 13cc15cee5bdb7adaf376219aaf20fab0459e9ef | https://github.com/sfox14/butterfly/tree/13cc15cee5bdb7adaf376219aaf20fab0459e9ef |
LowRankConv2d | import math
import torch
from torch import nn
import torch.nn.functional as F
import torch.cuda
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class LowRankConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, 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
import math
from torch import nn
import torch.cuda
import torch.nn.parallel
impo... | sfox14/butterfly | LowRankConv2d | false | 16,388 | [
"Apache-2.0"
] | 52 | 13cc15cee5bdb7adaf376219aaf20fab0459e9ef | https://github.com/sfox14/butterfly/tree/13cc15cee5bdb7adaf376219aaf20fab0459e9ef |
MSELoss | import torch
import torch.distributed
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
class MSELoss(torch.nn.Module):
def __init__(self):
super(MSELoss, self).__init__()
def forward(self, preds, heatmap_gt, weight):
losses = 0.5 * weight * ((preds - heatm... | 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.distributed
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
assert_size_stride = torch._C.... | senyang-ml/PoseNFS | MSELoss | false | 16,389 | [
"MIT"
] | 53 | 1229abb69917dab1e57def3de0e3fe9a8a3164cd | https://github.com/senyang-ml/PoseNFS/tree/1229abb69917dab1e57def3de0e3fe9a8a3164cd |
BilinearAttention | import torch
import torch.nn as nn
class BilinearAttention(nn.Module):
"""
Computes attention between two matrices using a bilinear attention function. This
function has a matrix of weights ``W`` and a bias ``b``, and the similarity between
the two matrices ``X`` and ``Y`` is computed as ``X W Y^T + b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | shabnam-b/crosslingual-nlp | BilinearAttention | false | 16,390 | [
"MIT"
] | 64 | ccd91baaea23004eab9c4d871910945ca3e61ab7 | https://github.com/shabnam-b/crosslingual-nlp/tree/ccd91baaea23004eab9c4d871910945ca3e61ab7 |
CRF | import torch
from torch import nn
import torch.nn.init
class CRF(nn.Module):
"""
Conditional Random Field.
"""
def __init__(self, hidden_dim, tagset_size):
"""
:param hidden_dim: size of word RNN/BLSTM's output
:param tagset_size: number of tags
"""
super(CRF, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.nn.init
assert_size_stride = torch._C._dynamo.... | sgrvinod/a-PyTorch-Tutorial-to-Sequence-Labeling | CRF | false | 16,391 | [
"MIT"
] | 334 | ee3f34b45a6e24dd748a144bfc25b1adf9e1f077 | https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Sequence-Labeling/tree/ee3f34b45a6e24dd748a144bfc25b1adf9e1f077 |
ShiftBias | import torch
from torch import nn
class ShiftBias(nn.Module):
def __init__(self, bias):
super(ShiftBias, self).__init__()
self.bias = bias
def forward(self, x):
return x + self.bias
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {'b... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | shaun95/StarGANv2-VC | ShiftBias | false | 16,392 | [
"MIT"
] | 116 | ed20538971a03d699351a349a3631767333baeb7 | https://github.com/shaun95/StarGANv2-VC/tree/ed20538971a03d699351a349a3631767333baeb7 |
BabyUnet | import torch
from torch import nn
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout=False, norm=None,
residual=True, activation='leakyrelu', in_place_activation=True,
transpose=False, reflectpad=True):
super(ConvBlock, 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.... | royerloic/aydin | BabyUnet | false | 16,393 | [
"BSD-3-Clause"
] | 78 | f9c61a24030891d008c318b250da5faec69fcd7d | https://github.com/royerloic/aydin/tree/f9c61a24030891d008c318b250da5faec69fcd7d |
CausualConv | import torch
from torch import nn
class CausualConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=1, dilation=1, bias=True, w_init_gain='linear', param=None):
super(CausualConv, self).__init__()
if padding is None:
assert kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | shaun95/StarGANv2-VC | CausualConv | false | 16,394 | [
"MIT"
] | 116 | ed20538971a03d699351a349a3631767333baeb7 | https://github.com/shaun95/StarGANv2-VC/tree/ed20538971a03d699351a349a3631767333baeb7 |
PatchEmbedding | import torch
import torch.nn as nn
class PatchEmbedding(nn.Module):
def __init__(self, image_size, patch_size, embed_dim, channels):
super().__init__()
self.image_size = image_size
if image_size[0] % patch_size != 0 or image_size[1] % patch_size != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | shampooma/segmenter | PatchEmbedding | false | 16,395 | [
"MIT"
] | 418 | b08fd481da6758e37d108ba28676229b62f757aa | https://github.com/shampooma/segmenter/tree/b08fd481da6758e37d108ba28676229b62f757aa |
PositionWiseFCNetwork | import torch
from torch import nn
import torch.optim
import torch.utils.data
class PositionWiseFCNetwork(nn.Module):
"""
The Position-Wise Feed Forward Network sublayer.
"""
def __init__(self, d_model, d_inner, dropout):
"""
:param d_model: size of vectors throughout the transformer m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | sgrvinod/a-PyTorch-Tutorial-to-Machine-Translation | PositionWiseFCNetwork | false | 16,396 | [
"MIT"
] | 59 | a4dd7bc5554d11ac80355241f603dcaa24bc70ae | https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Machine-Translation/tree/a4dd7bc5554d11ac80355241f603dcaa24bc70ae |
Model | from torch.nn import Module
import torch
import torch.nn.functional
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
import torch.optim
from torch.nn import Parameter
from torch.nn import Module
class Mode... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.nn.functional
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
import t... | Cubbee/apex | Model | false | 16,397 | [
"BSD-3-Clause"
] | 268 | 0a991543846966d5f586540dc2441e512139e9fc | https://github.com/Cubbee/apex/tree/0a991543846966d5f586540dc2441e512139e9fc |
ChainCRF | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
def logsumexp(x, dim=None):
"""
Args:
x: A pytorch tensor (any dimension will do)
dim: int or None, over which to perform the summation. `None`, the
default, performs over all axes.
Returns: The 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
import torch.nn as nn
from torch.nn.parameter import Parameter
assert_size_strid... | shabnam-b/crosslingual-nlp | ChainCRF | false | 16,398 | [
"MIT"
] | 64 | ccd91baaea23004eab9c4d871910945ca3e61ab7 | https://github.com/shabnam-b/crosslingual-nlp/tree/ccd91baaea23004eab9c4d871910945ca3e61ab7 |
SoftAttention | import torch
import numpy as np
import torch.nn as nn
class SoftAttention(nn.Module):
"""
https://arxiv.org/abs/1803.10916
"""
def __init__(self, emb_dim, attn_dim):
super().__init__()
self.attn_dim = attn_dim
self.emb_dim = emb_dim
self.W = torch.nn.Linear(self.emb_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | shangeth/wavencoder | SoftAttention | false | 16,399 | [
"MIT"
] | 56 | cd1a277c2cc44075c9f4506e344b3a725ad5b9fe | https://github.com/shangeth/wavencoder/tree/cd1a277c2cc44075c9f4506e344b3a725ad5b9fe |
TimeStrech | import random
import torch
from torch import nn
import torch.nn.functional as F
class TimeStrech(nn.Module):
def __init__(self, scale):
super(TimeStrech, self).__init__()
self.scale = scale
def forward(self, x):
mel_size = x.size(-1)
x = F.interpolate(x, scale_factor=(1, self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | shaun95/StarGANv2-VC | TimeStrech | false | 16,400 | [
"MIT"
] | 116 | ed20538971a03d699351a349a3631767333baeb7 | https://github.com/shaun95/StarGANv2-VC/tree/ed20538971a03d699351a349a3631767333baeb7 |
ConvEncoder3D | import torch
from matplotlib import cm as cm
import torch.nn as nn
class ConvEncoder3D(nn.Module):
""" Simple convolutional conditioning network.
It consists of 6 convolutional layers, each downsampling the input by a
factor of 2, and a final fully-connected layer projecting the output to
c_dim dimen... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 matplotlib import cm as ... | ray8828/occupancy_flow | ConvEncoder3D | false | 16,401 | [
"MIT"
] | 146 | 09c172262bb151895d450eb323e2383a5c88841c | https://github.com/ray8828/occupancy_flow/tree/09c172262bb151895d450eb323e2383a5c88841c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.