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 |
|---|---|---|---|---|---|---|---|---|---|---|
ActNorm | import torch
import torch.nn as nn
import torch.utils.data
from torch.nn import Parameter
class ActNorm(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super(ActNorm, self).__init__()
self.eps = eps
self.num_channels = num_channels
self._log_scale = Parameter(torch.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.triton_helpers import math as tl_math
import torch.nn as nn
import torch.utils.data
from torch.nn import Parame... | XinZhang525/fGAIL | ActNorm | false | 18,128 | [
"MIT"
] | 4 | 682d70286685612558e072d9a1668779b8ae325b | https://github.com/XinZhang525/fGAIL/tree/682d70286685612558e072d9a1668779b8ae325b |
_MultipleInputNetwork | import torch
import torch.nn as _nn
class _MultipleInputNetwork(_nn.Module):
def __init__(self):
super(_MultipleInputNetwork, self).__init__()
self.conv = _nn.Conv2d(3, 16, 3)
def forward(self, inp1, inp2):
inp = inp1 * inp2
out = self.conv(inp)
return out
def get_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 torch.nn as _nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Yifanfanfanfan/torchutils | _MultipleInputNetwork | false | 18,129 | [
"MIT"
] | 9 | 939331d28fcee97bfb0a4b2eaab8e799877fb0dc | https://github.com/Yifanfanfanfan/torchutils/tree/939331d28fcee97bfb0a4b2eaab8e799877fb0dc |
NextImgPrediction | import torch
import torch.nn as nn
class NextImgPrediction(nn.Module):
"""
2-class classification model : is_next, is_not_next
"""
def __init__(self, hidden):
"""
:param hidden: BERT model output size
"""
super().__init__()
self.linear = nn.Linear(hidden, 2)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YanyuanQiao/HOP-VLN | NextImgPrediction | false | 18,130 | [
"MIT"
] | 8 | 4b26b2569afb3e7eb7d8c2ed814cd424e41cbade | https://github.com/YanyuanQiao/HOP-VLN/tree/4b26b2569afb3e7eb7d8c2ed814cd424e41cbade |
gaussian_downsample | import math
import torch
import torch.nn as nn
class gaussian_downsample(nn.Module):
"""
Downsampling module with Gaussian filtering
"""
def __init__(self, kernel_size, sigma, stride, pad=False):
super(gaussian_downsample, self).__init__()
self.gauss = nn.Conv2d(3, 3, kernel_size, str... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Xmaster6y/wgenpatex | gaussian_downsample | false | 18,131 | [
"MIT"
] | 8 | 08079dc131cc2e9c74ee4f9e16cf9b58667f2b07 | https://github.com/Xmaster6y/wgenpatex/tree/08079dc131cc2e9c74ee4f9e16cf9b58667f2b07 |
BranchNet | import torch
import torch.nn as nn
from itertools import product as product
from math import sqrt as sqrt
import torch.utils.data
def conv1x1(in_channels, out_channels):
"""1x1 convolution"""
return nn.Conv2d(in_channels, out_channels, 1, bias=True)
class BranchNet(nn.Module):
"""
The branch of Naiv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from it... | XiangLiK/cv_course | BranchNet | false | 18,132 | [
"MIT"
] | 8 | da7c2318fd4128bbdab96db26ddbb2524f37d0a0 | https://github.com/XiangLiK/cv_course/tree/da7c2318fd4128bbdab96db26ddbb2524f37d0a0 |
HighwayNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class HighwayNetwork(nn.Module):
def __init__(self, size):
super().__init__()
self.W1 = nn.Linear(size, size)
self.W2 = nn.Linear(size, size)
self.W1.bias.data.fill_(0.0)
def forward(self, x):
x1 = sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | YoghesWaran/tacotron | HighwayNetwork | false | 18,133 | [
"MIT"
] | 10 | 0b97486da7698229bad09e2072cfa3313ae7effe | https://github.com/YoghesWaran/tacotron/tree/0b97486da7698229bad09e2072cfa3313ae7effe |
ActNorm2D | import torch
import torch.nn as nn
import torch.utils.data
from torch.nn import Parameter
class ActNorm2D(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super(ActNorm2D, self).__init__()
self.eps = eps
self.num_channels = num_channels
self._log_scale = Parameter(torch.Te... | 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
from torch.nn import Parame... | XinZhang525/fGAIL | ActNorm2D | false | 18,134 | [
"MIT"
] | 4 | 682d70286685612558e072d9a1668779b8ae325b | https://github.com/XinZhang525/fGAIL/tree/682d70286685612558e072d9a1668779b8ae325b |
ParentChildClassifier | import torch
from torch import nn
class ParentChildClassifier(nn.Module):
def __init__(self, parent_dim, child_short_dim, child_full_dim, hidden_dim
):
super(ParentChildClassifier, self).__init__()
if child_full_dim is not None:
self.hidden = nn.Linear(parent_dim + child_short... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | YilunZhou/wikihow-embedding | ParentChildClassifier | false | 18,135 | [
"MIT"
] | 8 | bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 | https://github.com/YilunZhou/wikihow-embedding/tree/bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 |
CenterLoss | import torch
from torch import nn
class CenterLoss(nn.Module):
def __init__(self, class_num, feature_num, alpha=0.5):
super(CenterLoss, self).__init__()
self.class_num = class_num
self.feature_num = feature_num
self.class_centers = nn.Parameter(torch.randn(self.class_num, self.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction | CenterLoss | false | 18,137 | [
"BSD-3-Clause"
] | 5 | 91ef1c95478367f5b421da125f07660cfc9bed98 | https://github.com/YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction/tree/91ef1c95478367f5b421da125f07660cfc9bed98 |
StepRankerLogistic3 | import torch
from torch import nn
class StepRankerLogistic3(nn.Module):
"""a logistic ranker that includes a don't care token"""
def __init__(self, parent_dim, child_short_dim, child_full_dim, hidden_dim
):
super(StepRankerLogistic3, self).__init__()
if child_full_dim is not None:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YilunZhou/wikihow-embedding | StepRankerLogistic3 | false | 18,138 | [
"MIT"
] | 8 | bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 | https://github.com/YilunZhou/wikihow-embedding/tree/bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 |
Normalizer | import torch
from torch import nn
class Normalizer(nn.Module):
def __init__(self, target_norm=1.0):
super().__init__()
self.target_norm = target_norm
def forward(self, input: 'torch.Tensor'):
return input * self.target_norm / input.norm(p=2, dim=1, keepdim=True)
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction | Normalizer | false | 18,139 | [
"BSD-3-Clause"
] | 5 | 91ef1c95478367f5b421da125f07660cfc9bed98 | https://github.com/YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction/tree/91ef1c95478367f5b421da125f07660cfc9bed98 |
StepRankerLogistic | import torch
from torch import nn
class StepRankerLogistic(nn.Module):
"""a logistic ranker"""
def __init__(self, parent_dim, child_short_dim, child_full_dim, hidden_dim
):
super(StepRankerLogistic, self).__init__()
if child_full_dim is not None:
self.hidden = nn.Linear(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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YilunZhou/wikihow-embedding | StepRankerLogistic | false | 18,140 | [
"MIT"
] | 8 | bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 | https://github.com/YilunZhou/wikihow-embedding/tree/bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 |
ChannelSELayer3D | import torch
import torch.nn as nn
class ChannelSELayer3D(nn.Module):
"""
3D extension of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
*Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238*
"""
def __init__(self, num_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
assert_... | YilinLiu97/AmygNet-Pytorch | ChannelSELayer3D | false | 18,141 | [
"MIT"
] | 3 | d5bb244fd930791345d38f09870a7ded633f4622 | https://github.com/YilinLiu97/AmygNet-Pytorch/tree/d5bb244fd930791345d38f09870a7ded633f4622 |
PreNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class PreNet(nn.Module):
def __init__(self, in_dims, fc1_dims=256, fc2_dims=128, dropout=0.5):
super().__init__()
self.fc1 = nn.Linear(in_dims, fc1_dims)
self.fc2 = nn.Linear(fc1_dims, fc2_dims)
self.p = dropout
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | YoghesWaran/tacotron | PreNet | false | 18,142 | [
"MIT"
] | 10 | 0b97486da7698229bad09e2072cfa3313ae7effe | https://github.com/YoghesWaran/tacotron/tree/0b97486da7698229bad09e2072cfa3313ae7effe |
Scaler | import torch
from torch import nn
class Scaler(nn.Module):
def __init__(self, alpha=16.0):
super().__init__()
self.alpha = nn.Parameter(torch.tensor(alpha))
def forward(self, input):
return self.alpha * input
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_in... | 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... | YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction | Scaler | false | 18,143 | [
"BSD-3-Clause"
] | 5 | 91ef1c95478367f5b421da125f07660cfc9bed98 | https://github.com/YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction/tree/91ef1c95478367f5b421da125f07660cfc9bed98 |
BertOutAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertOutAttention(nn.Module):
def __init__(self, config, ctx_dim=None):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
'The ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | YanyuanQiao/HOP-VLN | BertOutAttention | false | 18,144 | [
"MIT"
] | 8 | 4b26b2569afb3e7eb7d8c2ed814cd424e41cbade | https://github.com/YanyuanQiao/HOP-VLN/tree/4b26b2569afb3e7eb7d8c2ed814cd424e41cbade |
StepRankerMargin | import torch
from torch import nn
class StepRankerMargin(nn.Module):
def __init__(self, parent_dim, child_short_dim, child_full_dim, hidden_dim
):
super(StepRankerMargin, self).__init__()
if child_full_dim is not None:
self.hidden = nn.Linear(parent_dim + child_short_dim +
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | YilunZhou/wikihow-embedding | StepRankerMargin | false | 18,145 | [
"MIT"
] | 8 | bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 | https://github.com/YilunZhou/wikihow-embedding/tree/bfbcaf6aca854cd7e0dedfd5ecf77627138e8425 |
ProjectExciteLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class ProjectExciteLayer(nn.Module):
"""
Project & Excite Module, specifically designed for 3D inputs
*quote*
"""
def __init__(self, num_channels, reduction_ratio=2):
"""
:param num_channels: No of input 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 import triton_helpers
import torch.nn as nn
assert_... | YilinLiu97/AmygNet-Pytorch | ProjectExciteLayer | false | 18,146 | [
"MIT"
] | 3 | d5bb244fd930791345d38f09870a7ded633f4622 | https://github.com/YilinLiu97/AmygNet-Pytorch/tree/d5bb244fd930791345d38f09870a7ded633f4622 |
ChannelSpatialSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelSELayer3D(nn.Module):
"""
3D extension of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
*Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238*
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | YilinLiu97/AmygNet-Pytorch | ChannelSpatialSELayer3D | false | 18,147 | [
"MIT"
] | 3 | d5bb244fd930791345d38f09870a7ded633f4622 | https://github.com/YilinLiu97/AmygNet-Pytorch/tree/d5bb244fd930791345d38f09870a7ded633f4622 |
GELU | import torch
import torch.nn as nn
class GELU(nn.Module):
def forward(self, x):
return torch.sigmoid(1.702 * x) * x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | YuShen0118/SAAP_Auto-driving_Platform | GELU | false | 18,148 | [
"MIT"
] | 4 | 785f899fb3b3ad92075318f9fcb69b8e09597202 | https://github.com/YuShen0118/SAAP_Auto-driving_Platform/tree/785f899fb3b3ad92075318f9fcb69b8e09597202 |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super().__init__()
padding = [((i - 1) // 2) for i in kernel_size]
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=
kernel_size, stride... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | YoshikiMas/YoshikiMas-speech-enhancement-with-pytorch-lightning | Encoder | false | 18,149 | [
"MIT"
] | 5 | 8fcb78cbf64cb61dd9d2dd9e1118a1aa1992dd65 | https://github.com/YoshikiMas/YoshikiMas-speech-enhancement-with-pytorch-lightning/tree/8fcb78cbf64cb61dd9d2dd9e1118a1aa1992dd65 |
SpatialSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpatialSELayer3D(nn.Module):
"""
3D extension of SE block -- squeezing spatially and exciting channel-wise described in:
*Roy et al., Concurrent Spatial and Channel Squeeze & Excitation in Fully Convolutional Networks, MICCAI 201... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | YilinLiu97/AmygNet-Pytorch | SpatialSELayer3D | false | 18,150 | [
"MIT"
] | 3 | d5bb244fd930791345d38f09870a7ded633f4622 | https://github.com/YilinLiu97/AmygNet-Pytorch/tree/d5bb244fd930791345d38f09870a7ded633f4622 |
ReSentenceMatrixLayer | import torch
import torch.nn as nn
class ReSentenceMatrixLayer(nn.Module):
def __init__(self, in_size, out_size=1):
super(ReSentenceMatrixLayer, self).__init__()
self.in_size = in_size
self.out_size = out_size
self.a_Asem = nn.Parameter(torch.tensor(0.0))
self.linear = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Yottaxx/T-LSTM | ReSentenceMatrixLayer | false | 18,151 | [
"MIT"
] | 9 | 92618d8c3ee2418b194a2e1592512548da955b77 | https://github.com/Yottaxx/T-LSTM/tree/92618d8c3ee2418b194a2e1592512548da955b77 |
ExgLayer | import torch
import torch.nn as nn
class ExgLayer(nn.Module):
def __init__(self, x_size, h_size, g_size, out_size):
super(ExgLayer, self).__init__()
self.h_size = h_size
self.g_size = g_size
self.out_size = out_size
self.x_size = x_size
self.linear_x2 = nn.Linear(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... | Yottaxx/T-LSTM | ExgLayer | false | 18,152 | [
"MIT"
] | 9 | 92618d8c3ee2418b194a2e1592512548da955b77 | https://github.com/Yottaxx/T-LSTM/tree/92618d8c3ee2418b194a2e1592512548da955b77 |
PositionwiseFeedForward | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions
class PositionwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.1):
super().__init__()
self.w_1 = nn.Linear(d_in, 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.triton_helpers import libdevice
import torch.utils.... | Yinghao-Li/GuiGen | PositionwiseFeedForward | false | 18,153 | [
"MIT"
] | 10 | 22ababcd8cacae0adcc4ee74b514b188dc5084f3 | https://github.com/Yinghao-Li/GuiGen/tree/22ababcd8cacae0adcc4ee74b514b188dc5084f3 |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super().__init__()
padding = [((i - 1) // 2) for i in kernel_size]
self.tconv = nn.ConvTranspose2d(in_channels, out_channels,
kernel_size=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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YoshikiMas/YoshikiMas-speech-enhancement-with-pytorch-lightning | Decoder | false | 18,154 | [
"MIT"
] | 5 | 8fcb78cbf64cb61dd9d2dd9e1118a1aa1992dd65 | https://github.com/YoshikiMas/YoshikiMas-speech-enhancement-with-pytorch-lightning/tree/8fcb78cbf64cb61dd9d2dd9e1118a1aa1992dd65 |
SentenceMatrixLayer | import torch
import torch.nn as nn
class SentenceMatrixLayer(nn.Module):
def __init__(self, in_size, out_size=1, p_Asem=0.8):
super(SentenceMatrixLayer, self).__init__()
self.in_size = in_size
self.out_size = out_size
self.p_Asem = p_Asem
self.linear = nn.Linear(in_size * ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Yottaxx/T-LSTM | SentenceMatrixLayer | false | 18,155 | [
"MIT"
] | 9 | 92618d8c3ee2418b194a2e1592512548da955b77 | https://github.com/Yottaxx/T-LSTM/tree/92618d8c3ee2418b194a2e1592512548da955b77 |
SVDBilinear | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class SVDBilinear(nn.Module):
"""
my bilinear matmul but reducing parameter dimension using peusodu-SVD
"""
def __init__(self, num_basis, in1_features, in2_features, out_features):
supe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
import torch.nn.init as init
assert_size_strid... | Yindong-Zhang/myGAT | SVDBilinear | false | 18,156 | [
"MIT"
] | 6 | f69132f21785d3a6bf1ec014890adeb124c89e8d | https://github.com/Yindong-Zhang/myGAT/tree/f69132f21785d3a6bf1ec014890adeb124c89e8d |
ScaledDotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention --baseline version"""
def __init__(self, dropout=0.3):
super().__init__()
self.dropout = nn.Dropout(dropout)
def forward(self, q, k, v, mask=Non... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Yottaxx/T-LSTM | ScaledDotProductAttention | false | 18,157 | [
"MIT"
] | 9 | 92618d8c3ee2418b194a2e1592512548da955b77 | https://github.com/Yottaxx/T-LSTM/tree/92618d8c3ee2418b194a2e1592512548da955b77 |
GCN | import torch
import torch.nn as nn
import torch.nn.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, dropout=0.3):
super(GraphConvolution, self).__init__()
self.in_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Yottaxx/T-LSTM | GCN | false | 18,158 | [
"MIT"
] | 9 | 92618d8c3ee2418b194a2e1592512548da955b77 | https://github.com/Yottaxx/T-LSTM/tree/92618d8c3ee2418b194a2e1592512548da955b77 |
QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class QNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_dim):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Yuibooo/BEAR | QNetwork | false | 18,159 | [
"MIT"
] | 4 | d8cf22e3bf0017db0702a6b8b8eb00f22e760991 | https://github.com/Yuibooo/BEAR/tree/d8cf22e3bf0017db0702a6b8b8eb00f22e760991 |
MeanStdExtractor | import torch
from torch import nn
class MeanStdExtractor(nn.Module):
def __init__(self):
super().__init__()
def forward(self, feature_maps_batch):
feature_maps_batch = feature_maps_batch.view(*feature_maps_batch.
shape[:2], -1)
feature_means_batch = feature_maps_batch.mea... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction | MeanStdExtractor | false | 18,160 | [
"BSD-3-Clause"
] | 5 | 91ef1c95478367f5b421da125f07660cfc9bed98 | https://github.com/YangXuanyue/Neural-Unaligned-Phoneme-Sequence-Prediction/tree/91ef1c95478367f5b421da125f07660cfc9bed98 |
GraphDiffusedAttentionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphDiffusedAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha):
super(GraphDiffusedAttentionLayer, 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.... | Yindong-Zhang/myGAT | GraphDiffusedAttentionLayer | false | 18,161 | [
"MIT"
] | 6 | f69132f21785d3a6bf1ec014890adeb124c89e8d | https://github.com/Yindong-Zhang/myGAT/tree/f69132f21785d3a6bf1ec014890adeb124c89e8d |
TSAFusion | import torch
import torch.utils.data
from torch.utils import data as data
from torch import nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
class TSAFusion(nn.Module):
"""Temporal Spatial Attention (TSA) fusion module.
Temporal: Calc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | WoojunePark/BasicSR | TSAFusion | false | 18,162 | [
"Apache-2.0"
] | 9 | e0910b022b924bb913045fc412a5470dc2242cf0 | https://github.com/WoojunePark/BasicSR/tree/e0910b022b924bb913045fc412a5470dc2242cf0 |
DepthwiseSeparableConv | import torch
from torch import nn
import torch.nn.functional
import torch
class DepthwiseSeparableConv(nn.Module):
def __init__(self, in_channels, output_channels, kernels_per_layer=1):
super(DepthwiseSeparableConv, self).__init__()
self.depthwise = nn.Conv2d(in_channels, 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 import nn
import torch.nn.functional
import torch
assert_size_stride ... | YiminYang980510/A-TransUNet | DepthwiseSeparableConv | false | 18,163 | [
"MIT"
] | 10 | 600b9abef3460d9751d3a6b7b4e4586aec164aa7 | https://github.com/YiminYang980510/A-TransUNet/tree/600b9abef3460d9751d3a6b7b4e4586aec164aa7 |
sum_squared_error | import torch
from torch.nn.modules.loss import _Loss
class sum_squared_error(_Loss):
"""
Definition: sum_squared_error = 1/2 * nn.MSELoss(reduction = 'sum')
The backward is defined as: input-target
"""
def __init__(self, size_average=None, reduce=None, reduction='sum'):
super(sum_squared_... | 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.nn.modules.... | ZerojumpLine/Denoise | sum_squared_error | false | 18,164 | [
"MIT"
] | 4 | 09182b07f451d85448ce3c7a53fc69144f91384e | https://github.com/ZerojumpLine/Denoise/tree/09182b07f451d85448ce3c7a53fc69144f91384e |
GraphConvolution | import torch
import torch.nn as nn
import torch.nn.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, dropout=0.3):
super(GraphConvolution, self).__init__()
self.in_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | Yottaxx/T-LSTM | GraphConvolution | false | 18,165 | [
"MIT"
] | 9 | 92618d8c3ee2418b194a2e1592512548da955b77 | https://github.com/Yottaxx/T-LSTM/tree/92618d8c3ee2418b194a2e1592512548da955b77 |
L_1st | import torch
import torch.nn as nn
class L_1st(nn.Module):
def __init__(self, alpha):
super(L_1st, self).__init__()
self.alpha = alpha
def forward(self, y_pred, y_true):
Y = y_pred
L = y_true
batch_size = Y.shape[0]
return 2 * self.alpha * torch.trace(torch.mm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ZagHe568/graph_embedding | L_1st | false | 18,166 | [
"MIT"
] | 4 | 2a6f8214ce4b30b51eb9f1904b64fe782876f010 | https://github.com/ZagHe568/graph_embedding/tree/2a6f8214ce4b30b51eb9f1904b64fe782876f010 |
SimSiamLoss | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class SimSiamLoss(nn.Module):
def __init__(self, version='simplified'):
super().__init__()
self.ver = version
def asymmetric_loss(self, p, z):
if ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import ... | Yif-Yang/DSSL | SimSiamLoss | false | 18,167 | [
"MIT"
] | 8 | 79a000450cfe66836089ecd5e2467863cc702e1c | https://github.com/Yif-Yang/DSSL/tree/79a000450cfe66836089ecd5e2467863cc702e1c |
feedforwardLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class feedforwardLayer(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.3):
super().__init__()
self.w_1 = nn.Linear(d_in, d_hid)
self.w_2 = nn.Linear(d_hid, d_in)
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.... | Yottaxx/T-LSTM | feedforwardLayer | false | 18,168 | [
"MIT"
] | 9 | 92618d8c3ee2418b194a2e1592512548da955b77 | https://github.com/Yottaxx/T-LSTM/tree/92618d8c3ee2418b194a2e1592512548da955b77 |
L_2nd | import torch
import torch.nn as nn
class L_2nd(nn.Module):
def __init__(self, beta):
super(L_2nd, self).__init__()
self.beta = beta
def forward(self, y_pred, y_true):
b = torch.ones_like(y_true)
b[y_true != 0] = self.beta
x = ((y_true - y_pred) * b) ** 2
t = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ZagHe568/graph_embedding | L_2nd | false | 18,169 | [
"MIT"
] | 4 | 2a6f8214ce4b30b51eb9f1904b64fe782876f010 | https://github.com/ZagHe568/graph_embedding/tree/2a6f8214ce4b30b51eb9f1904b64fe782876f010 |
net_nvidia_pytorch | import torch
import torch.nn as nn
import torch.nn.functional as F
class LambdaLayer(nn.Module):
def __init__(self, lambd):
super(LambdaLayer, self).__init__()
self.lambd = lambd
def forward(self, x):
return self.lambd(x)
class net_nvidia_pytorch(nn.Module):
def __init__(self)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | YuShen0118/SAAP_Auto-driving_Platform | net_nvidia_pytorch | false | 18,170 | [
"MIT"
] | 4 | 785f899fb3b3ad92075318f9fcb69b8e09597202 | https://github.com/YuShen0118/SAAP_Auto-driving_Platform/tree/785f899fb3b3ad92075318f9fcb69b8e09597202 |
TverskyLoss | import torch
from torch import nn
class TverskyLoss(nn.Module):
"""DiceLoss implemented from 'Dice Loss for Data-imbalanced NLP Tasks'
Useful in dealing with unbalanced data
Add softmax automatically
"""
def __init__(self):
super(TverskyLoss, self).__init__()
self.m = nn.Sigmoid()... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ZhaoZhibin/Physionet2020model | TverskyLoss | false | 18,171 | [
"BSD-2-Clause",
"MIT"
] | 6 | ea7379bd1e4c145c84fd254faa0d5d1330cd2f6e | https://github.com/ZhaoZhibin/Physionet2020model/tree/ea7379bd1e4c145c84fd254faa0d5d1330cd2f6e |
CAMBlock | import torch
import torch.nn as nn
class CAMBlock(nn.Module):
def __init__(self):
super(CAMBlock, self).__init__()
self.maxpool = nn.AdaptiveMaxPool1d(1)
self.avgpool = nn.AdaptiveAvgPool1d(1)
self.conv = nn.Conv1d(2, 1, 7, padding=3)
self.sigmoid = nn.Sigmoid()
def f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | YuRui8879/CPSC2021_python | CAMBlock | false | 18,172 | [
"MIT"
] | 4 | bfa4c565ec3113528e73b064041082863cd228b4 | https://github.com/YuRui8879/CPSC2021_python/tree/bfa4c565ec3113528e73b064041082863cd228b4 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaxPoolStride1(nn.Module):
def __init__(self):
super(MaxPoolStride1, self).__init__()
def forward(self, x):
x = F.max_pool2d(F.pad(x, (0, 1, 0, 1), mode='replicate'), 2, stride=1)
return x
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Zhang-Jack/adversarial_yolo2 | MaxPoolStride1 | false | 18,173 | [
"MIT"
] | 8 | 91c2a4793047f656482cebf0309984db823e8030 | https://github.com/Zhang-Jack/adversarial_yolo2/tree/91c2a4793047f656482cebf0309984db823e8030 |
GNN_Encoder | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.functional as F
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | Zhen-Tan-dmml/GFCIL | GNN_Encoder | false | 18,174 | [
"MIT"
] | 7 | 9b78210418711a795280c588f55aef63f7df5b3b | https://github.com/Zhen-Tan-dmml/GFCIL/tree/9b78210418711a795280c588f55aef63f7df5b3b |
ResidualDenseBlock | import torch
import torch.utils.data
from torch.utils import data as data
from torch import nn as nn
from torch.nn import init as init
from torch.nn.modules.batchnorm import _BatchNorm
from torchvision.models import vgg as vgg
from torch import autograd as autograd
@torch.no_grad()
def default_init_weights(module_lis... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torch.utils import data as data
from torch import n... | WoojunePark/BasicSR | ResidualDenseBlock | false | 18,175 | [
"Apache-2.0"
] | 9 | e0910b022b924bb913045fc412a5470dc2242cf0 | https://github.com/WoojunePark/BasicSR/tree/e0910b022b924bb913045fc412a5470dc2242cf0 |
TotalVariation | import torch
import torch.nn as nn
class TotalVariation(nn.Module):
"""TotalVariation: calculates the total variation of a patch.
Module providing the functionality necessary to calculate the total vatiation (TV) of an adversarial patch.
"""
def __init__(self):
super(TotalVariation, 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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | Zhang-Jack/adversarial_yolo2 | TotalVariation | false | 18,176 | [
"MIT"
] | 8 | 91c2a4793047f656482cebf0309984db823e8030 | https://github.com/Zhang-Jack/adversarial_yolo2/tree/91c2a4793047f656482cebf0309984db823e8030 |
Reorg | import torch
import torch.nn as nn
class Reorg(nn.Module):
def __init__(self, stride=2):
super(Reorg, self).__init__()
self.stride = stride
def forward(self, x):
stride = self.stride
assert x.data.dim() == 4
B = x.data.size(0)
C = x.data.size(1)
H = x.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Zhang-Jack/adversarial_yolo2 | Reorg | false | 18,177 | [
"MIT"
] | 8 | 91c2a4793047f656482cebf0309984db823e8030 | https://github.com/Zhang-Jack/adversarial_yolo2/tree/91c2a4793047f656482cebf0309984db823e8030 |
TimeDecayMSELoss | import torch
from torch import Tensor
from torch import nn
class TimeDecayMSELoss(nn.Module):
def __init__(self, decay_factor=0.99):
super().__init__()
self.decay_factor = decay_factor
def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor:
size = [input.size(0), -1]
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Zinoex/hyperverlet | TimeDecayMSELoss | false | 18,178 | [
"MIT"
] | 7 | 431ef92fa2448ce69c357f01c0862353067bfa8a | https://github.com/Zinoex/hyperverlet/tree/431ef92fa2448ce69c357f01c0862353067bfa8a |
AvgConsensus | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class AvgConsensus(nn.Module):
def __init__(self, cfg):
super(AvgConsensus, self).__init__()
pass
def forward(self, input, dim=0):
assert isinstance(input, torch.Tensor)
output = input.mean(dim=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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ZJCV/X3D | AvgConsensus | false | 18,179 | [
"Apache-2.0"
] | 10 | 1635fe4ade5ac5e0bd8f272262cec73c7a12f0fb | https://github.com/ZJCV/X3D/tree/1635fe4ade5ac5e0bd8f272262cec73c7a12f0fb |
AEBatch | import torch
import torch.nn as nn
import torch._utils
class AEBatch(nn.Module):
def __init__(self):
super(AEBatch, self).__init__()
def forward(self, estimated_density_map, gt_num):
return torch.abs(torch.sum(estimated_density_map, dim=(1, 2, 3)) -
gt_num)
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch._utils
assert_size_stride = torch._C._... | Zhaoyi-Yan/DCANet | AEBatch | false | 18,180 | [
"MIT"
] | 3 | 1d99481494f4ef3cfe5abf227fa49a51011364bf | https://github.com/Zhaoyi-Yan/DCANet/tree/1d99481494f4ef3cfe5abf227fa49a51011364bf |
SEBatch | import torch
import torch.nn as nn
import torch._utils
class SEBatch(nn.Module):
def __init__(self):
super(SEBatch, self).__init__()
def forward(self, estimated_density_map, gt_num):
return torch.pow(torch.sum(estimated_density_map, dim=(1, 2, 3)) -
gt_num, 2)
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
import torch._utils
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | Zhaoyi-Yan/DCANet | SEBatch | false | 18,181 | [
"MIT"
] | 3 | 1d99481494f4ef3cfe5abf227fa49a51011364bf | https://github.com/Zhaoyi-Yan/DCANet/tree/1d99481494f4ef3cfe5abf227fa49a51011364bf |
SelfGating | import torch
import torch.utils.data
import torch
import torch.nn as nn
class SelfGating(nn.Module):
def __init__(self, input_dim):
super(SelfGating, self).__init__()
self.fc = nn.Linear(input_dim, input_dim)
def forward(self, input_tensor):
"""Feature gating as used in S3D-G"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = ... | ZhaofanQiu/Optimization-Planning-for-3D-ConvNets | SelfGating | false | 18,182 | [
"Apache-2.0"
] | 6 | d9f1b777811ca0d8f462798ca2efcea39b96fcc5 | https://github.com/ZhaofanQiu/Optimization-Planning-for-3D-ConvNets/tree/d9f1b777811ca0d8f462798ca2efcea39b96fcc5 |
PatchApplier | import torch
import torch.nn as nn
class PatchApplier(nn.Module):
"""PatchApplier: applies adversarial patches to images.
Module providing the functionality necessary to apply a patch to all detections in all images in the batch.
"""
def __init__(self):
super(PatchApplier, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Zhang-Jack/adversarial_yolo2 | PatchApplier | false | 18,183 | [
"MIT"
] | 8 | 91c2a4793047f656482cebf0309984db823e8030 | https://github.com/Zhang-Jack/adversarial_yolo2/tree/91c2a4793047f656482cebf0309984db823e8030 |
BinaryReg | import torch
import torch.nn as nn
import torch.utils.data
class BinaryReg(nn.Module):
"""Regularization for encouraging the outputs to be binary.
"""
def __init__(self, alpha=1.0):
super().__init__()
self.alpha = alpha
def forward(self, input):
diff = input - 0.5
dif... | 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
... | aarushgupta/pytorch_connectomics | BinaryReg | false | 18,184 | [
"MIT"
] | 5 | eb90ada14dbd425a741f481761d1ed9ea633e67c | https://github.com/aarushgupta/pytorch_connectomics/tree/eb90ada14dbd425a741f481761d1ed9ea633e67c |
MeanNormLoss | import torch
from torch import Tensor
from torch import nn
class MeanNormLoss(nn.Module):
def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor:
size = [input.size(0), input.size(1), -1]
input = input.view(*size)
target = target.view(*size)
diff = target - input
lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Zinoex/hyperverlet | MeanNormLoss | false | 18,185 | [
"MIT"
] | 7 | 431ef92fa2448ce69c357f01c0862353067bfa8a | https://github.com/Zinoex/hyperverlet/tree/431ef92fa2448ce69c357f01c0862353067bfa8a |
MSEScalarLoss | import torch
import torch.nn as nn
from functools import reduce
class MSEScalarLoss(nn.Module):
def __init__(self):
super(MSEScalarLoss, self).__init__()
def forward(self, x, gt_map):
return torch.pow(x.sum() - gt_map.sum(), 2) / reduce(lambda a, b: a *
b, x.shape)
def get_inpu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Zhaoyi-Yan/PFDNet | MSEScalarLoss | false | 18,186 | [
"MIT"
] | 4 | 86798fbc4fadc673e7912c08492ea3611bc20154 | https://github.com/Zhaoyi-Yan/PFDNet/tree/86798fbc4fadc673e7912c08492ea3611bc20154 |
ResNetV2 | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
import torch.utils.data
import torchvision.transforms.functional as F
from torch.nn import functional as F
from collections.__init__ import OrderedDict
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | BigFishMaster/tnt | ResNetV2 | false | 18,187 | [
"BSD-3-Clause"
] | 3 | 8b80bb3b194eb87ac18924428ef0924c2fb263c5 | https://github.com/BigFishMaster/tnt/tree/8b80bb3b194eb87ac18924428ef0924c2fb263c5 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, base_class_num, nway, dropout):
super(Attention, self).__init__()
self.fc1 = nn.Linear(base_class_num, base_class_num // 2)
self.fc2 = nn.Linear(base_class_num // 2, nway)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Zhen-Tan-dmml/GFCIL | Attention | false | 18,188 | [
"MIT"
] | 7 | 9b78210418711a795280c588f55aef63f7df5b3b | https://github.com/Zhen-Tan-dmml/GFCIL/tree/9b78210418711a795280c588f55aef63f7df5b3b |
Attention | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, num_heads, model_dim, k_dim=None, v_dim=None,
out_dim=None, temperature=None, dropout=0, score_function=
'scaled_dot_product'):
super(Attention,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | ZhengZixiang/OpenTC | Attention | false | 18,189 | [
"MIT"
] | 5 | 00306c4736d50f8f53c21c1dd0559144a8fcafa9 | https://github.com/ZhengZixiang/OpenTC/tree/00306c4736d50f8f53c21c1dd0559144a8fcafa9 |
GlobalAvgPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class GlobalAvgPool2d(nn.Module):
def __init__(self):
super(GlobalAvgPool2d, self).__init__()
def forward(self, x):
N = x.data.size(0)
C = x.data.size(1)
H = x.data.size(2)
W = x.data.size(3)
x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Zhang-Jack/adversarial_yolo2 | GlobalAvgPool2d | false | 18,190 | [
"MIT"
] | 8 | 91c2a4793047f656482cebf0309984db823e8030 | https://github.com/Zhang-Jack/adversarial_yolo2/tree/91c2a4793047f656482cebf0309984db823e8030 |
PoolingAverage | import torch
import torch.utils.data
import torch
import torch.nn as nn
class PoolingAverage(nn.Module):
def __init__(self, input_dim=2048):
super(PoolingAverage, self).__init__()
self.pool = nn.AdaptiveAvgPool2d((1, 1))
self.output_dim = input_dim
def forward(self, x):
x = 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
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | ZhaofanQiu/Optimization-Planning-for-3D-ConvNets | PoolingAverage | false | 18,191 | [
"Apache-2.0"
] | 6 | d9f1b777811ca0d8f462798ca2efcea39b96fcc5 | https://github.com/ZhaofanQiu/Optimization-Planning-for-3D-ConvNets/tree/d9f1b777811ca0d8f462798ca2efcea39b96fcc5 |
SimpleModel | import torch
import torch.nn as nn
import torch.nn.functional
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class SimpleModel(nn.Module):
def __init__(self):
super(SimpleModel, self).__init__()
def forward(self, x):
return x * 2
def... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data... | ZVK/jukebox | SimpleModel | false | 18,192 | [
"MIT"
] | 5 | 23fd6753f2892214ad3d97f6f2b59f8cc8d0c57a | https://github.com/ZVK/jukebox/tree/23fd6753f2892214ad3d97f6f2b59f8cc8d0c57a |
MedianPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn.modules.utils import _quadruple
class MedianPool2d(nn.Module):
""" Median pool (usable as median filter when stride=1) module.
Args:
kernel_size: size of pooling kernel, int ... | 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
from torch.nn.modules.utils import _pair
from torch... | Zhang-Jack/adversarial_yolo2 | MedianPool2d | false | 18,193 | [
"MIT"
] | 8 | 91c2a4793047f656482cebf0309984db823e8030 | https://github.com/Zhang-Jack/adversarial_yolo2/tree/91c2a4793047f656482cebf0309984db823e8030 |
WPMLoss | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
class WPMLoss(nn.Module):
def __init__(self, weight):
super(WPMLoss, self).__init__()
self.weight = weight
def forward(self, y_real, y_imag, y_real_hat, y_imag_hat):
torch.FloatTensor([np.pi])
mag =... | 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... | ZhangJingshu/WMP-loss-for-dereverberation | WPMLoss | false | 18,194 | [
"MIT"
] | 5 | 9f742634d8f30f0e17b8d4e44bd2e3bf66ced992 | https://github.com/ZhangJingshu/WMP-loss-for-dereverberation/tree/9f742634d8f30f0e17b8d4e44bd2e3bf66ced992 |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
"""DiceLoss implemented from 'Dice Loss for Data-imbalanced NLP Tasks'
Useful in dealing with unbalanced data
Add softmax automatically
"""
def __init__(self):
super(DiceLoss, self).__init__()
self.m = nn.Sigmoid()
... | 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... | ZhaoZhibin/Physionet2020model | DiceLoss | false | 18,195 | [
"BSD-2-Clause",
"MIT"
] | 6 | ea7379bd1e4c145c84fd254faa0d5d1330cd2f6e | https://github.com/ZhaoZhibin/Physionet2020model/tree/ea7379bd1e4c145c84fd254faa0d5d1330cd2f6e |
LocalConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class LocalConv2d(nn.Module):
def __init__(self, num_rows, num_feats_in, num_feats_out, kernel=1,
padding=0):
super(LocalConv2d, self).__init__()
self.num_rows = num_rows
self.out_channels = num_feats_out
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | abhi1kumar/M3D-RPN | LocalConv2d | false | 18,196 | [
"MIT"
] | 4 | cf79ec95ad84b3548c57af90aedd59da3ad4af5b | https://github.com/abhi1kumar/M3D-RPN/tree/cf79ec95ad84b3548c57af90aedd59da3ad4af5b |
GNN_Valuator | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.functional as F
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | Zhen-Tan-dmml/GFCIL | GNN_Valuator | false | 18,197 | [
"MIT"
] | 7 | 9b78210418711a795280c588f55aef63f7df5b3b | https://github.com/Zhen-Tan-dmml/GFCIL/tree/9b78210418711a795280c588f55aef63f7df5b3b |
ILN | import torch
from torch import nn
import torch.utils.data
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 = 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.triton_helpers import libdevice
from torch import nn
import torch.utils.data
from torch.nn.parameter import Par... | ZAKAUDD/-GEU-Net | ILN | false | 18,198 | [
"MIT"
] | 8 | 5251d329afb80c74328e72fd2fc21ff691ef3353 | https://github.com/ZAKAUDD/-GEU-Net/tree/5251d329afb80c74328e72fd2fc21ff691ef3353 |
GCN | from torch.nn import Module
import torch
import torch.utils.data
from torch.nn import Conv1d
from torch.nn import ReLU
class GCN(Module):
def __init__(self, num_state, num_node, bias=False):
super(GCN, self).__init__()
self.conv1 = Conv1d(num_node, num_node, kernel_size=1, padding=0,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | ZhihuaLiuEd/canetbrats | GCN | false | 18,199 | [
"MIT"
] | 7 | a23f008b2876a21026b2564588f4f51692083ae2 | https://github.com/ZhihuaLiuEd/canetbrats/tree/a23f008b2876a21026b2564588f4f51692083ae2 |
FactoredAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.functional
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch as t
def checkpoint(func, inputs, params, flag):
if flag:
args = inputs + tuple(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.... | ZVK/jukebox | FactoredAttention | false | 18,200 | [
"MIT"
] | 5 | 23fd6753f2892214ad3d97f6f2b59f8cc8d0c57a | https://github.com/ZVK/jukebox/tree/23fd6753f2892214ad3d97f6f2b59f8cc8d0c57a |
ln | import torch
from torch import nn
import torch.utils.data
class ln(nn.Module):
"""
Layer Normalization
"""
def __init__(self, input):
super(ln, self).__init__()
self.ln = nn.LayerNorm(input.size()[1:])
def forward(self, x):
x = self.ln(x)
return x
def get_inputs... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | ZAKAUDD/-GEU-Net | ln | false | 18,201 | [
"MIT"
] | 8 | 5251d329afb80c74328e72fd2fc21ff691ef3353 | https://github.com/ZAKAUDD/-GEU-Net/tree/5251d329afb80c74328e72fd2fc21ff691ef3353 |
MapReduce | import torch
import torch.nn as nn
class MapReduce(nn.Module):
"""
Reduce feature maps into a single edge map
"""
def __init__(self, channels):
super(MapReduce, self).__init__()
self.conv = nn.Conv2d(channels, 1, kernel_size=1, padding=0)
nn.init.constant_(self.conv.bias, 0)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ZitongYu/pidinet | MapReduce | false | 18,202 | [
"MIT"
] | 5 | 15cdf9fb056549934877675bf7571b427f86db55 | https://github.com/ZitongYu/pidinet/tree/15cdf9fb056549934877675bf7571b427f86db55 |
PDCBlock_converted | import torch
import torch.nn as nn
class PDCBlock_converted(nn.Module):
"""
CPDC, APDC can be converted to vanilla 3x3 convolution
RPDC can be converted to vanilla 5x5 convolution
"""
def __init__(self, pdc, inplane, ouplane, stride=1):
super(PDCBlock_converted, self).__init__()
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | ZitongYu/pidinet | PDCBlock_converted | false | 18,203 | [
"MIT"
] | 5 | 15cdf9fb056549934877675bf7571b427f86db55 | https://github.com/ZitongYu/pidinet/tree/15cdf9fb056549934877675bf7571b427f86db55 |
Encoder | import torch
from torch import nn
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super(Encoder, self).__init__()
self.lin_input_to_hidden = nn.Linear(input_dim, hidden_dim)
self.lin_hidden_to_hidden = nn.Linear(hidden_dim, hidden_dim)
self.lin_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
from torch._inductor.runtime.... | abacoelho/variational-poisson-rnn | Encoder | false | 18,204 | [
"MIT"
] | 5 | abf77f79fc64be75ae9102ec8d537f77ed9c5f8f | https://github.com/abacoelho/variational-poisson-rnn/tree/abf77f79fc64be75ae9102ec8d537f77ed9c5f8f |
CDCM | import torch
import torch.nn as nn
class CDCM(nn.Module):
"""
Compact Dilation Convolution based Module
"""
def __init__(self, in_channels, out_channels):
super(CDCM, self).__init__()
self.relu1 = nn.ReLU()
self.conv1 = nn.Conv2d(in_channels, out_channels, 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
import torch.nn as nn
assert_... | ZitongYu/pidinet | CDCM | false | 18,205 | [
"MIT"
] | 5 | 15cdf9fb056549934877675bf7571b427f86db55 | https://github.com/ZitongYu/pidinet/tree/15cdf9fb056549934877675bf7571b427f86db55 |
Swish | import torch
import torch.nn as nn
class Swish(nn.Module):
def forward(self, x):
return x.mul_(torch.sigmoid(x))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_mul_sigmoid_0(in_pt... | absallh/A_yolov3 | Swish | false | 18,206 | [
"Apache-2.0"
] | 6 | 550ec41de42b8efe638e887c51a568189947e049 | https://github.com/absallh/A_yolov3/tree/550ec41de42b8efe638e887c51a568189947e049 |
IOULoss | import torch
import torch.nn as nn
class IOULoss(nn.Module):
def __init__(self, eps: 'float'=1e-06):
super(IOULoss, self).__init__()
self.eps = eps
def forward(self, predict, target):
assert predict.shape[0] == target.shape[0
], 'Predict and target must be same shape'
... | 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... | ZiyunClaudeWang/e3d | IOULoss | false | 18,207 | [
"MIT"
] | 9 | 2efd01167350c29423babb6233907fa54156268f | https://github.com/ZiyunClaudeWang/e3d/tree/2efd01167350c29423babb6233907fa54156268f |
GenerationProbabilty | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class GenerationProbabilty(nn.Module):
def __init__(self, embedding_size, hidden_size, h_star_size):
"""Calculates `p_gen` as described in Pointer-Generator Networks paper."""
super(GenerationProbabilty, 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
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | abhishek0318/conll-sigmorphon-2018 | GenerationProbabilty | false | 18,208 | [
"MIT"
] | 6 | de4b8da7778947e03e7a35b56e0e53281f65e403 | https://github.com/abhishek0318/conll-sigmorphon-2018/tree/de4b8da7778947e03e7a35b56e0e53281f65e403 |
net_nvidia_featshift_pytorch | import torch
import torch.nn as nn
import torch.nn.functional as F
class LambdaLayer(nn.Module):
def __init__(self, lambd):
super(LambdaLayer, self).__init__()
self.lambd = lambd
def forward(self, x):
return self.lambd(x)
class net_nvidia_featshift_pytorch(nn.Module):
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YuShen0118/SAAP_Auto-driving_Platform | net_nvidia_featshift_pytorch | false | 18,209 | [
"MIT"
] | 4 | 785f899fb3b3ad92075318f9fcb69b8e09597202 | https://github.com/YuShen0118/SAAP_Auto-driving_Platform/tree/785f899fb3b3ad92075318f9fcb69b8e09597202 |
Emitter | import torch
from torch import nn
class Emitter(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super(Emitter, self).__init__()
self.lin_input_to_hidden = nn.Linear(input_dim, hidden_dim)
self.lin_hidden_to_hidden = nn.Linear(hidden_dim, hidden_dim)
self.lin_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
from torch._inductor.runtime.... | abacoelho/variational-poisson-rnn | Emitter | false | 18,210 | [
"MIT"
] | 5 | abf77f79fc64be75ae9102ec8d537f77ed9c5f8f | https://github.com/abacoelho/variational-poisson-rnn/tree/abf77f79fc64be75ae9102ec8d537f77ed9c5f8f |
PositionalEncoder | import math
import torch
import torch.nn as nn
class PositionalEncoder(nn.Module):
"""Generate positional encoding for a vector
Args:
length (int): length of the input sentence to be encoded
d_model (int): dimention of the word vector
Returns:
torch.Tensor: positionaly encoded vect... | 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... | abhirajtiwari/QANet | PositionalEncoder | false | 18,211 | [
"MIT"
] | 4 | 85e1db4edf0710169268a091e7d7959e524f1ceb | https://github.com/abhirajtiwari/QANet/tree/85e1db4edf0710169268a091e7d7959e524f1ceb |
LuongAttention | import torch
import torch.nn.functional as F
from torch import nn
class LuongAttention(nn.Module):
"""
Luong Attention from Effective Approaches to Attention-based Neural Machine Translation
https://arxiv.org/pdf/1508.04025.pdf
"""
def __init__(self, attention_dim):
super(LuongAttention, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | aditya140/ques_gen | LuongAttention | false | 18,212 | [
"MIT"
] | 3 | 57be43de682a384ee4114adb3fbc75a527f2aaff | https://github.com/aditya140/ques_gen/tree/57be43de682a384ee4114adb3fbc75a527f2aaff |
PoseCriterion | import torch
import torch.nn as nn
class PoseCriterion(nn.Module):
def __init__(self, t_loss_fn=nn.MSELoss(), q_loss_fn=nn.MSELoss(), sax=
0.0, saq=0.0, learn_beta=False):
super(PoseCriterion, self).__init__()
self.t_loss_fn = t_loss_fn
self.q_loss_fn = q_loss_fn
self.sax ... | 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... | ZiyunClaudeWang/e3d | PoseCriterion | false | 18,213 | [
"MIT"
] | 9 | 2efd01167350c29423babb6233907fa54156268f | https://github.com/ZiyunClaudeWang/e3d/tree/2efd01167350c29423babb6233907fa54156268f |
RobertaRNNHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class RobertaRNNHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config, num_labels):
super(RobertaRNNHead, self).__init__()
self.hidden_size = config.hidden_size
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.triton_helpers import libdevice
from torch import n... | abrinkmann/productCategorization | RobertaRNNHead | false | 18,214 | [
"MIT"
] | 5 | 75732e4b1c9da941a793db80b5fe2245bae45e87 | https://github.com/abrinkmann/productCategorization/tree/75732e4b1c9da941a793db80b5fe2245bae45e87 |
Mish | import torch
import torch.nn as nn
import torch.nn.functional as F
class Mish(nn.Module):
def forward(self, x):
return x.mul_(F.softplus(x).tanh())
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | absallh/A_yolov3 | Mish | false | 18,215 | [
"Apache-2.0"
] | 6 | 550ec41de42b8efe638e887c51a568189947e049 | https://github.com/absallh/A_yolov3/tree/550ec41de42b8efe638e887c51a568189947e049 |
RobertaHierarchyHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class RobertaHierarchyHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config, num_labels):
super(RobertaHierarchyHead, self).__init__()
self.hidden_size = config.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
from torch import n... | abrinkmann/productCategorization | RobertaHierarchyHead | false | 18,216 | [
"MIT"
] | 5 | 75732e4b1c9da941a793db80b5fe2245bae45e87 | https://github.com/abrinkmann/productCategorization/tree/75732e4b1c9da941a793db80b5fe2245bae45e87 |
D_GCN | import math
import torch
import torch.nn.functional as F
from torch import nn
class D_GCN(nn.Module):
"""
Neural network block that applies a diffusion graph convolution to sampled location
"""
def __init__(self, in_channels, out_channels, orders, activation='relu'):
"""
:param in_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
import math
from torch import... | ZhuangDingyi/STZINB | D_GCN | false | 18,217 | [
"MIT"
] | 6 | e290ad05f76030c0c8e86b5dd78346097e1127cb | https://github.com/ZhuangDingyi/STZINB/tree/e290ad05f76030c0c8e86b5dd78346097e1127cb |
FixedSubnetConv | import math
import torch
import torch.multiprocessing
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
class FixedSubnetConv(nn.Conv2d):
def __init__(self, *args, **kwargs):
super().__init__(*args... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.multiprocessing
import torch.nn as nn
import torch.nn.p... | adityakusupati/LLC-2.0 | FixedSubnetConv | false | 18,218 | [
"MIT"
] | 10 | 38608bbaa425b15dcf5c971000b7a1b08120fb5c | https://github.com/adityakusupati/LLC-2.0/tree/38608bbaa425b15dcf5c971000b7a1b08120fb5c |
BinarizeActivations | import torch
import torch.multiprocessing
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.autograd as autograd
class BinarizeWeight(autograd.Function):
@staticmethod
def forward(ctx, scores):
out = scores.clone... | 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.multiprocessing
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.da... | adityakusupati/LLC-2.0 | BinarizeActivations | false | 18,219 | [
"MIT"
] | 10 | 38608bbaa425b15dcf5c971000b7a1b08120fb5c | https://github.com/adityakusupati/LLC-2.0/tree/38608bbaa425b15dcf5c971000b7a1b08120fb5c |
EmbeddingLearner | import torch
from torch import nn
class EmbeddingLearner(nn.Module):
def __init__(self):
super(EmbeddingLearner, self).__init__()
def forward(self, h, r, t):
if r.dim() == 1:
r = r.unsqueeze(0)
h = h.view(1, -1, h.shape[-1])
t = t.view(1, -1, t.shape[-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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | adonis704/ucas_2021_hc_15 | EmbeddingLearner | false | 18,220 | [
"MIT"
] | 6 | 7308c3b32962ef5430d85ccfcb199ebe40bf4a7f | https://github.com/adonis704/ucas_2021_hc_15/tree/7308c3b32962ef5430d85ccfcb199ebe40bf4a7f |
DummyLoss | import torch
import torch.nn as nn
class DummyLoss(nn.Module):
"""
Dummy Loss for debugging
"""
def __init__(self):
super(DummyLoss, self).__init__()
def forward(self, inp, target):
delta = inp - target
None
return delta.mean()
def get_inputs():
return [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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | adriangrepo/segmentl | DummyLoss | false | 18,221 | [
"MIT"
] | 5 | 9b520bf6cfd005eef9bba3db36ee6b3bb373b085 | https://github.com/adriangrepo/segmentl/tree/9b520bf6cfd005eef9bba3db36ee6b3bb373b085 |
OhemSphereLoss | import torch
import torch.utils.data
import torch.nn as nn
from torchvision.transforms import *
class OhemSphereLoss(nn.Module):
def __init__(self, in_feats, n_classes, thresh=0.7, scale=14, *args, **
kwargs):
super(OhemSphereLoss, self).__init__(*args, **kwargs)
self.thresh = thresh
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | ace19-dev/image-retrieval-pytorch | OhemSphereLoss | false | 18,222 | [
"MIT"
] | 9 | 19bd4ae5efea5b6184c345f693646bcd9a0fc8cf | https://github.com/ace19-dev/image-retrieval-pytorch/tree/19bd4ae5efea5b6184c345f693646bcd9a0fc8cf |
SpatialPyramidPooling | import torch
from math import sqrt
import torch.nn as nn
class SpatialPyramidPooling(nn.Module):
"""Generate fixed length representation regardless of image dimensions
Based on the paper "Spatial Pyramid Pooling in Deep Convolutional Networks
for Visual Recognition" (https://arxiv.org/pdf/1406.4729.pdf)
... | 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 math import sqrt
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.... | addisonklinke/pytorch-architectures | SpatialPyramidPooling | false | 18,223 | [
"MIT"
] | 6 | a5739b9b90db726db29b02166a9b1a7e52eb1eba | https://github.com/addisonklinke/pytorch-architectures/tree/a5739b9b90db726db29b02166a9b1a7e52eb1eba |
DiceCoeffLoss | import torch
import torch.nn as nn
class DiceCoeffLoss(nn.Module):
def __init__(self, eps: 'float'=0.0001):
super(DiceCoeffLoss, self).__init__()
self.eps = eps
def forward(self, predict, target):
assert predict.shape[0] == target.shape[0
], 'Predict and target must be sa... | 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... | ZiyunClaudeWang/e3d | DiceCoeffLoss | false | 18,224 | [
"MIT"
] | 9 | 2efd01167350c29423babb6233907fa54156268f | https://github.com/ZiyunClaudeWang/e3d/tree/2efd01167350c29423babb6233907fa54156268f |
CnptAttention | import torch
from torch import nn
class CnptAttention(nn.Module):
def __init__(self, in_dim, out_dim):
super(CnptAttention, self).__init__()
self.softmax = nn.Softmax(dim=-1)
def forward(self, query, key):
"""
query: sent_emb (1, D)
key: [(k, D), (k,D)]
value:... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | adonis704/ucas_2021_hc_15 | CnptAttention | false | 18,225 | [
"MIT"
] | 6 | 7308c3b32962ef5430d85ccfcb199ebe40bf4a7f | https://github.com/adonis704/ucas_2021_hc_15/tree/7308c3b32962ef5430d85ccfcb199ebe40bf4a7f |
LSR | import torch
import torch.nn as nn
import torch.nn.functional as F
class LSR(nn.Module):
def __init__(self, epsilon=0.1, num_classes=162):
super(LSR, self).__init__()
self._epsilon = epsilon
self._num_classes = num_classes
def forward(self, yhat, y):
prior = torch.div(torch.o... | 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
... | aisolab/bertnd | LSR | false | 18,226 | [
"MIT"
] | 6 | 01bb46b0fad9285b34d08e1d741f6b1b620997d2 | https://github.com/aisolab/bertnd/tree/01bb46b0fad9285b34d08e1d741f6b1b620997d2 |
OutputLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
def masked_softmax(logits, mask, dim=-1, log_softmax=False):
"""Take the softmax of `logits` over given dimension, and set
entries to 0 wherever `mask` is 0.
Args:
logits (torch.Tensor): Inputs to the softmax function.
mas... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | abhirajtiwari/QANet | OutputLayer | false | 18,227 | [
"MIT"
] | 4 | 85e1db4edf0710169268a091e7d7959e524f1ceb | https://github.com/abhirajtiwari/QANet/tree/85e1db4edf0710169268a091e7d7959e524f1ceb |
ResidualBlock | import torch
import torch.optim
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, in_f, out_f):
super(ResidualBlock, self).__init__()
self.conv = nn.Conv2d(in_f, out_f, 1, 1, padding=0, bias=False)
def forward(self, x):
residual = x
out = self.conv(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.optim
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | ajiljalal/code-cs-fairness | ResidualBlock | false | 18,228 | [
"MIT"
] | 9 | 2025c1c8520444df800a1fc03d91d63d1415db54 | https://github.com/ajiljalal/code-cs-fairness/tree/2025c1c8520444df800a1fc03d91d63d1415db54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.