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 |
|---|---|---|---|---|---|---|---|---|---|---|
CrossEn | import torch
from torch import nn
import torch.nn.functional as F
import torch.cuda
class CrossEn(nn.Module):
def forward(self, sim_matrix):
logpt = F.log_softmax(sim_matrix, dim=-1)
logpt = torch.diag(logpt)
nce_loss = -logpt
sim_loss = nce_loss.mean()
return sim_loss
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
i... | LoveEachDay/towhee | CrossEn | false | 11,651 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
HardMish | import torch
from torch import nn
import torch.cuda
def hard_mish(x, inplace: 'bool'=False):
if inplace:
return x.mul_(0.5 * (x + 2).clamp(min=0, max=2))
else:
return 0.5 * x * (x + 2).clamp(min=0, max=2)
class HardMish(nn.Module):
"""
Hard Mish
Experimental, based on notes by Mi... | 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.cuda
assert_size_stride = torch._C._dynamo.guards.asser... | LoveEachDay/towhee | HardMish | false | 11,652 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
Conv2dSame | import math
import torch
from typing import List
from typing import Union
from torch import nn
import torch.nn.functional as F
from typing import Tuple
import torch.cuda
from typing import Optional
from torch.nn.common_types import _size_2_t
def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int') ->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
import math
from typing import List
from typing import Union
from torch import n... | LoveEachDay/towhee | Conv2dSame | false | 11,653 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
HardSwish | import torch
from torch import nn
import torch.nn.functional as F
import torch.cuda
def hard_swish(x: 'torch.Tensor', inplace: 'bool'=False) ->torch.Tensor:
inner = F.relu6(x + 3.0).div_(6.0)
return x.mul_(inner) if inplace else x.mul(inner)
class HardSwish(nn.Module):
"""
HardSwish activiation laye... | 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.nn.functional as F
import torch.cuda
assert_size_stride... | LoveEachDay/towhee | HardSwish | false | 11,654 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
CMlp | import torch
from torch import nn
import torch.cuda
def conv_1x1x1(inp, oup, groups=1):
return nn.Conv3d(inp, oup, (1, 1, 1), (1, 1, 1), (0, 0, 0), groups=groups)
class CMlp(nn.Module):
"""
CMlp
"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GE... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | LoveEachDay/towhee | CMlp | false | 11,655 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
Upsampler | import math
import torch
import torch.utils.data
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = ... | 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.utils.data
from torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | HamsterBiz/iSeeBetter | Upsampler | false | 11,656 | [
"MIT"
] | 0 | a71cee61583bdedab1f3b368e2cb7dc5ad969aed | https://github.com/HamsterBiz/iSeeBetter/tree/a71cee61583bdedab1f3b368e2cb7dc5ad969aed |
NextSentencePrediction | import torch
import torch.nn as nn
class NextSentencePrediction(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, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | JacobTyo/Syntax-Encoding_EMNLP2018 | NextSentencePrediction | false | 11,657 | [
"MIT"
] | 0 | 5aed2fdd01dc7d0baebbd555c97a25fedbde0c39 | https://github.com/JacobTyo/Syntax-Encoding_EMNLP2018/tree/5aed2fdd01dc7d0baebbd555c97a25fedbde0c39 |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
"""
Compute 'Scaled Dot Product Attention
"""
def forward(self, query, key, value, mask=None, dropout=None):
scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(query
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | JacobTyo/Syntax-Encoding_EMNLP2018 | Attention | false | 11,658 | [
"MIT"
] | 0 | 5aed2fdd01dc7d0baebbd555c97a25fedbde0c39 | https://github.com/JacobTyo/Syntax-Encoding_EMNLP2018/tree/5aed2fdd01dc7d0baebbd555c97a25fedbde0c39 |
ConvMlp | import torch
from torch import nn
import torch.cuda
class ConvMlp(nn.Module):
""" MLP using 1x1 convs that keeps spatial dims
"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.ReLU, norm_layer=None, drop=0.0):
super().__init__()
out_features... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | LoveEachDay/towhee | ConvMlp | false | 11,659 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
InnerProductDecoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class InnerProductDecoder(nn.Module):
def __init__(self, activation=torch.sigmoid, dropout=0.1):
super(InnerProductDecoder, self).__init__()
self.dropout = dropout
self.activation = activation
def forward(self, z):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | LymanSong/suwon_bus_stop_competition | InnerProductDecoder | false | 11,660 | [
"MIT"
] | 0 | 42297c8cfb0f109f28d8aeead097a57bb5d6be53 | https://github.com/LymanSong/suwon_bus_stop_competition/tree/42297c8cfb0f109f28d8aeead097a57bb5d6be53 |
CrossAttention | import torch
from torch import nn
import torch.cuda
class MultiHeadAttention(nn.Module):
"""
Multi head attention for Perceiver https://arxiv.org/pdf/2103.03206.pdf.
Args:
num_q_channels (`int`):
Number of q channels.
num_kv_channels (`int`):
Number of k or v channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | LoveEachDay/towhee | CrossAttention | false | 11,661 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
TVLoss | import torch
from torch import nn
from torch.nn import functional as F
class TVLoss(nn.Module):
"""L2 total variation loss, as in Mahendran et al."""
def forward(self, input):
input = F.pad(input, (0, 1, 0, 1), 'replicate')
x_diff = input[..., :-1, 1:] - input[..., :-1, :-1]
y_diff = ... | 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... | MED-YAHYAOUI/style-transfer-pytorch | TVLoss | false | 11,662 | [
"MIT"
] | 0 | 867a6a45d964c151d6b94f50153cf535385c9078 | https://github.com/MED-YAHYAOUI/style-transfer-pytorch/tree/867a6a45d964c151d6b94f50153cf535385c9078 |
AttentionPool2d | import torch
from torch import nn
import torch.cuda
class AttentionPool2d(nn.Module):
"""
Attention
"""
def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads:
'int', output_dim: 'int'=None):
super().__init__()
self.positional_embedding = nn.Parameter(torch.randn(s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LoveEachDay/towhee | AttentionPool2d | false | 11,663 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
ConvNetsModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvNetsModel(nn.Module):
def __init__(self, num_classes, cross_entropy_loss=False, kernel_size=3,
channel_size1=32, channel_size2=64, dropout=False):
super(ConvNetsModel, self).__init__()
self.cross_entropy_loss = 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._inductor.runtime.... | LidiaAlecci/ConvNet | ConvNetsModel | false | 11,664 | [
"MIT"
] | 0 | 23bc0919edfa346440588f79bc86d9c5f5fcc4d2 | https://github.com/LidiaAlecci/ConvNet/tree/23bc0919edfa346440588f79bc86d9c5f5fcc4d2 |
ClassificationModel | import torch
import torch.nn as nn
class ClassificationModel(nn.Module):
def __init__(self, num_features_in, num_anchors=9, num_classes=80,
prior=0.01, feature_size=256):
super(ClassificationModel, self).__init__()
self.num_classes = num_classes
self.num_anchors = num_anchors
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | Hyojin021/auto_labeling | ClassificationModel | false | 11,665 | [
"Apache-2.0"
] | 0 | 1ccf0cd1c5adf34692751553a988aa0fcf4efefb | https://github.com/Hyojin021/auto_labeling/tree/1ccf0cd1c5adf34692751553a988aa0fcf4efefb |
TemporalDecay | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class TemporalDecay(nn.Module):
def __init__(self, input_size, rnn_hid_size):
super(TemporalDecay, self).__init__()
self.rnn_hid_size = rnn_hid_size
self.build(input_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.... | LyapunovStability/BRITS | TemporalDecay | false | 11,666 | [
"MIT"
] | 0 | 92a889dd5946aae215d61b1854d9767c6f7fcf2c | https://github.com/LyapunovStability/BRITS/tree/92a889dd5946aae215d61b1854d9767c6f7fcf2c |
CSDN_Tem | import torch
import torch.nn as nn
class CSDN_Tem(nn.Module):
def __init__(self, in_ch, out_ch):
super(CSDN_Tem, self).__init__()
self.depth_conv = nn.Conv2d(in_channels=in_ch, out_channels=in_ch,
kernel_size=3, padding=1, groups=in_ch)
self.point_conv = nn.Conv2d(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Lundez/londogard-backend | CSDN_Tem | false | 11,667 | [
"MIT"
] | 0 | 90d9e405b832c2157e6fde00f58b9312cfc4ddbc | https://github.com/Lundez/londogard-backend/tree/90d9e405b832c2157e6fde00f58b9312cfc4ddbc |
MultinomialCELoss | import torch
import torch.nn as nn
class MultinomialCELoss(nn.Module):
def __init__(self):
super(MultinomialCELoss, self).__init__()
def forward(self, x, y):
x = x + 1e-08
x = torch.log(x)
zlogz = y * x
loss = -zlogz.sum()
loss /= x.shape[0] * x.shape[2] * x.s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | MMujtabaRoohani/FlowerColorizer-PyTorch | MultinomialCELoss | false | 11,668 | [
"MIT"
] | 0 | 4c9c4c954a38babe1f10f816f8406eb4ab998842 | https://github.com/MMujtabaRoohani/FlowerColorizer-PyTorch/tree/4c9c4c954a38babe1f10f816f8406eb4ab998842 |
DownBlock | import torch
import torch.utils.data
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torchvision.transforms import *
assert_size_stride ... | HamsterBiz/iSeeBetter | DownBlock | false | 11,669 | [
"MIT"
] | 0 | a71cee61583bdedab1f3b368e2cb7dc5ad969aed | https://github.com/HamsterBiz/iSeeBetter/tree/a71cee61583bdedab1f3b368e2cb7dc5ad969aed |
BoundSoftmaxImpl | import torch
import torch.nn as nn
class BoundSoftmaxImpl(nn.Module):
def __init__(self, axis):
super().__init__()
self.axis = axis
def forward(self, x):
max_x = torch.max(x, dim=self.axis).values
assert self.axis == int(self.axis)
x = torch.exp(x - max_x.unsqueeze(se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Mahoumaru/auto_LiRPA | BoundSoftmaxImpl | false | 11,670 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
RegressionHead | import abc
import torch
import torch.nn as nn
import torch.utils.data.dataset
class BaseHead(nn.Module, metaclass=abc.ABCMeta):
pass
class RegressionHead(BaseHead):
def __init__(self, hidden_size, hidden_dropout_prob):
"""From RobertaClassificationHead"""
super().__init__()
self.den... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 abc
import t... | HarshTrivedi/jiant-fork | RegressionHead | false | 11,671 | [
"MIT"
] | 0 | 6b0150a8d923b0fca33f244a25e1bf2c74ea5f30 | https://github.com/HarshTrivedi/jiant-fork/tree/6b0150a8d923b0fca33f244a25e1bf2c74ea5f30 |
BertLayerNormNoVar | import torch
import torch.nn as nn
class BertLayerNormNoVar(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNormNoVar, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsil... | 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... | Mahoumaru/auto_LiRPA | BertLayerNormNoVar | false | 11,672 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
Transition | import torch
import torch.nn as nn
import torch.nn.functional as F
class Transition(nn.Module):
def __init__(self, in_planes, out_planes):
super(Transition, self).__init__()
self.conv = nn.Conv2d(in_planes, out_planes, kernel_size=1, bias=True)
def forward(self, x):
out = self.conv(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_... | Mahoumaru/auto_LiRPA | Transition | false | 11,673 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
UpBlock | import torch
import torch.utils.data
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torchvision.transforms import *
assert_size_stride ... | HamsterBiz/iSeeBetter | UpBlock | false | 11,674 | [
"MIT"
] | 0 | a71cee61583bdedab1f3b368e2cb7dc5ad969aed | https://github.com/HamsterBiz/iSeeBetter/tree/a71cee61583bdedab1f3b368e2cb7dc5ad969aed |
mlp_2layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class mlp_2layer(nn.Module):
def __init__(self, in_ch, in_dim, width=1):
super(mlp_2layer, self).__init__()
self.fc1 = nn.Linear(in_ch * in_dim * in_dim, 256 * width)
self.fc2 = nn.Linear(256 * width, 10)
def forward(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | Mahoumaru/auto_LiRPA | mlp_2layer | false | 11,675 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
D_DownBlock | import torch
import torch.utils.data
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torchvision.transforms import *
assert_size_stride ... | HamsterBiz/iSeeBetter | D_DownBlock | false | 11,676 | [
"MIT"
] | 0 | a71cee61583bdedab1f3b368e2cb7dc5ad969aed | https://github.com/HamsterBiz/iSeeBetter/tree/a71cee61583bdedab1f3b368e2cb7dc5ad969aed |
RAEClassifier | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Callable
class ReactiveAutoencoder(nn.Module):
"""The RAE a.k.a. SRAE a.k.a. the autoencoder with the strict supervised sparsity matrix.
This module provides a framework for training an encoder to maximize information throug... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MHHukiewitz/SRAE_pytorch | RAEClassifier | false | 11,677 | [
"MIT"
] | 0 | 91f961f740c96cdb49739c9738ed330af59750d0 | https://github.com/MHHukiewitz/SRAE_pytorch/tree/91f961f740c96cdb49739c9738ed330af59750d0 |
SuperPointNet | import torch
import torch.optim
import torch.utils.data
class SuperPointNet(torch.nn.Module):
""" Pytorch definition of SuperPoint Network. """
def __init__(self):
super(SuperPointNet, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.pool = torch.nn.MaxPool2d(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
from torch._inductor.runtime.... | LeikvollE/pytorch-superpoint | SuperPointNet | false | 11,678 | [
"MIT"
] | 0 | 52144a760e0cc46259e57397a5a55f0585fe6d0b | https://github.com/LeikvollE/pytorch-superpoint/tree/52144a760e0cc46259e57397a5a55f0585fe6d0b |
cnn_4layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class cnn_4layer(nn.Module):
def __init__(self, in_ch, in_dim, width=2, linear_size=256):
super(cnn_4layer, self).__init__()
self.conv1 = nn.Conv2d(in_ch, 4 * width, 4, stride=2, padding=1)
self.conv2 = nn.Conv2d(4 * width... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | Mahoumaru/auto_LiRPA | cnn_4layer | false | 11,679 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
mlp_3layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class mlp_3layer(nn.Module):
def __init__(self, in_ch, in_dim, width=1):
super(mlp_3layer, self).__init__()
self.fc1 = nn.Linear(in_ch * in_dim * in_dim, 256 * width)
self.fc2 = nn.Linear(256 * width, 128 * width)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | Mahoumaru/auto_LiRPA | mlp_3layer | false | 11,680 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
mlp_5layer | import torch
import torch.nn as nn
import torch.nn.functional as F
class mlp_5layer(nn.Module):
def __init__(self, in_ch, in_dim, width=1):
super(mlp_5layer, self).__init__()
self.fc1 = nn.Linear(in_ch * in_dim * in_dim, 256 * width)
self.fc2 = nn.Linear(256 * width, 256 * width)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | Mahoumaru/auto_LiRPA | mlp_5layer | false | 11,681 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
cnn_7layer_alt | import torch
import torch.nn as nn
import torch.nn.functional as F
class cnn_7layer_alt(nn.Module):
def __init__(self, in_ch, in_dim, width=2, linear_size=128):
super(cnn_7layer_alt, self).__init__()
self.conv1 = nn.Conv2d(in_ch, 4 * width, 3, stride=1, padding=1)
self.conv2 = nn.Conv2d(4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Mahoumaru/auto_LiRPA | cnn_7layer_alt | false | 11,682 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
ASPP | import torch
from torch import nn
import torch.nn.functional as F
import torch.cuda
class ASPP(nn.Module):
"""
Atrous spatial pyramid pooling used in object detection and segmentation.
"""
def __init__(self, in_channel=512, depth=256):
super().__init__()
self.mean = nn.AdaptiveAvgPool... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | LoveEachDay/towhee | ASPP | false | 11,683 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
FCNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class FCNetwork(nn.Module):
def __init__(self, state_size, action_size, output_gate=None):
super(FCNetwork, self).__init__()
self.fc1 = nn.Linear(state_size, 256)
self.fc2 = nn.Linear(256, 256)
self.fc3 = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | JoshVarty/Reacher | FCNetwork | false | 11,684 | [
"MIT"
] | 0 | cab41484aaaeeae177cc625c3697d7e7cd80c2ed | https://github.com/JoshVarty/Reacher/tree/cab41484aaaeeae177cc625c3697d7e7cd80c2ed |
Upsample_interpolate | import torch
import torch.nn as nn
import torch.nn.functional as F
class Upsample_interpolate(nn.Module):
def __init__(self, stride):
super(Upsample_interpolate, self).__init__()
self.stride = stride
def forward(self, x):
x_numpy = x.cpu().detach().numpy()
H = x_numpy.shape[2... | 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... | Mathiebhan/darknet_ros | Upsample_interpolate | false | 11,685 | [
"BSD-3-Clause"
] | 0 | 04a97b61b6b3b086da1a46331a747accd37d05f9 | https://github.com/Mathiebhan/darknet_ros/tree/04a97b61b6b3b086da1a46331a747accd37d05f9 |
cnn_4layer_LeakyRelu | import torch
import torch.nn as nn
import torch.nn.functional as F
class cnn_4layer_LeakyRelu(nn.Module):
def __init__(self, in_ch, in_dim, width=2, linear_size=256, alpha=0.1):
super(cnn_4layer_LeakyRelu, self).__init__()
self.conv1 = nn.Conv2d(in_ch, 4 * width, 4, stride=2, padding=1)
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... | Mahoumaru/auto_LiRPA | cnn_4layer_LeakyRelu | false | 11,686 | [
"BSD-3-Clause"
] | 0 | b03a6c36eb1b921726778359d6d2b94e0cd7e480 | https://github.com/Mahoumaru/auto_LiRPA/tree/b03a6c36eb1b921726778359d6d2b94e0cd7e480 |
ReOrgLayer | import torch
from torch import nn
class ReOrgLayer(nn.Module):
def __init__(self, stride=2):
super(ReOrgLayer, self).__init__()
self.stride = stride
def forward(self, x):
assert x.data.dim() == 4
B, C, H, W = x.data.shape
hs = self.stride
ws = self.stride
... | 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... | MaoXianXin/pytorchx | ReOrgLayer | false | 11,687 | [
"MIT"
] | 0 | f46cc9692c3bd11ea9d5d54c20de3ac2f67dabcc | https://github.com/MaoXianXin/pytorchx/tree/f46cc9692c3bd11ea9d5d54c20de3ac2f67dabcc |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, inputLayer):
super(Net, self).__init__()
self.fc1 = nn.Linear(inputLayer, 100)
self.fc2 = nn.Linear(100, 2)
def forward(self, x):
x = self.fc1(x)
x = F.tanh(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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Marissa4/RPyCA | Net | false | 11,688 | [
"MIT"
] | 0 | e3c229361a4cd9ddd53accc5541b7c8b5f8939e0 | https://github.com/Marissa4/RPyCA/tree/e3c229361a4cd9ddd53accc5541b7c8b5f8939e0 |
MaxPoolStride1 | import torch
from torch import nn
from torch.nn import functional as F
class MaxPoolStride1(nn.Module):
def __init__(self, kernel_size):
super(MaxPoolStride1, self).__init__()
self.kernel_size = kernel_size
self.pad = kernel_size - 1
def forward(self, x):
padded_x = F.pad(x, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | MaoXianXin/pytorchx | MaxPoolStride1 | false | 11,689 | [
"MIT"
] | 0 | f46cc9692c3bd11ea9d5d54c20de3ac2f67dabcc | https://github.com/MaoXianXin/pytorchx/tree/f46cc9692c3bd11ea9d5d54c20de3ac2f67dabcc |
Network | import torch
import torch.nn as nn
import torch.nn.functional as F
class Network(nn.Module):
def __init__(self, input_size, nb_action):
super(Network, self).__init__()
self.input_size = input_size
self.nb_action = nb_action
self.fc1 = nn.Linear(input_size, 30)
self.fc2 = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | MarcoPerdomo/Self-Automated-Driving_Car | Network | false | 11,690 | [
"MIT"
] | 0 | 943bf53a8b0dd26f8370b943d879e7dbaadb2201 | https://github.com/MarcoPerdomo/Self-Automated-Driving_Car/tree/943bf53a8b0dd26f8370b943d879e7dbaadb2201 |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=20,
fc2_units=80):
"""Initialize parameters and build model.
Params
======
state_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.... | Mavrepis/DeepLearning_FoodSafety | QNetwork | false | 11,691 | [
"MIT"
] | 0 | 4f70b575036b06cd0edd4fdf9fc9303728872fc1 | https://github.com/Mavrepis/DeepLearning_FoodSafety/tree/4f70b575036b06cd0edd4fdf9fc9303728872fc1 |
DotProduct | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
class DotProduct(nn.Module):
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
"""
Inputs:
x - (N, F)
y - (N, F)
Output:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MicroTensor-ai/episodic-memory | DotProduct | false | 11,692 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
SeparableBlock | from torch.nn import Module
import torch
from torch.nn import Linear
class SeparableBlock(Module):
def __init__(self, input_size, kernel_channels_in, kernel_channels_out,
kernel_size):
super(SeparableBlock, self).__init__()
self.input_size = input_size
self.kernel_size = kernel_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.nn import Module
from torch.nn import Linear
assert_size_stride = tor... | Kiberchaika/hyperstyle | SeparableBlock | false | 11,693 | [
"MIT"
] | 0 | b67e5ca9c67dfdfa18f1d6cda6e8eff5da07db7b | https://github.com/Kiberchaika/hyperstyle/tree/b67e5ca9c67dfdfa18f1d6cda6e8eff5da07db7b |
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.... | J-C-Chang/human-pose-detect | CmapPafHeadAttention | false | 11,694 | [
"MIT"
] | 0 | 092e6ec53aa5058d644a30269abff606b74e3bf3 | https://github.com/J-C-Chang/human-pose-detect/tree/092e6ec53aa5058d644a30269abff606b74e3bf3 |
HighLightLayer | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import to... | MicroTensor-ai/episodic-memory | HighLightLayer | false | 11,695 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
enhance_net_nopool | import torch
import torch.nn as nn
import torch.nn.functional as F
class CSDN_Tem(nn.Module):
def __init__(self, in_ch, out_ch):
super(CSDN_Tem, self).__init__()
self.depth_conv = nn.Conv2d(in_channels=in_ch, out_channels=in_ch,
kernel_size=3, padding=1, groups=in_ch)
self.poi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Lundez/londogard-backend | enhance_net_nopool | false | 11,696 | [
"MIT"
] | 0 | 90d9e405b832c2157e6fde00f58b9312cfc4ddbc | https://github.com/Lundez/londogard-backend/tree/90d9e405b832c2157e6fde00f58b9312cfc4ddbc |
CQConcatenate | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MicroTensor-ai/episodic-memory | CQConcatenate | false | 11,697 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
GEGLU | import torch
import torch.nn.functional as F
from torch import nn
class GEGLU(nn.Module):
def forward(self, x):
x, gates = x.chunk(2, dim=-1)
return F.gelu(gates) * 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
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Mohan-Zhang-u/vit-pytorch | GEGLU | false | 11,698 | [
"MIT"
] | 0 | 76050c812474d7c10d67db4e811f537e26c3996a | https://github.com/Mohan-Zhang-u/vit-pytorch/tree/76050c812474d7c10d67db4e811f537e26c3996a |
Actor | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, 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
from torch._inductor.runtime.... | Mika412/deep-reinforcement-learning | Actor | false | 11,699 | [
"MIT"
] | 0 | 9b5ba901f760e50cd64d272939eff75881af5a9c | https://github.com/Mika412/deep-reinforcement-learning/tree/9b5ba901f760e50cd64d272939eff75881af5a9c |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | Mika412/deep-reinforcement-learning | Critic | false | 11,700 | [
"MIT"
] | 0 | 9b5ba901f760e50cd64d272939eff75881af5a9c | https://github.com/Mika412/deep-reinforcement-learning/tree/9b5ba901f760e50cd64d272939eff75881af5a9c |
Conv1D | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=1, stride=1, padding=0,
bias=True):
super(Conv1D, self).__init__()
self.conv1d = nn.Conv1d(in_channels=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.parallel
import torch.nn as nn
import torch.utils.data
import to... | MicroTensor-ai/episodic-memory | Conv1D | false | 11,701 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
WeightedPool | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class WeightedPool(nn.Module):
def __init__(self, dim):
sup... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MicroTensor-ai/episodic-memory | WeightedPool | false | 11,702 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
ELUPlus | import torch
from torch import nn
import torch.nn
class ELUPlus(nn.Module):
def __init__(self):
super().__init__()
self.elu = nn.ELU()
def forward(self, x):
return self.elu(x) + 1.0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import torch.nn
assert_size_stride = torch._C._dynamo.guar... | MilesCranmer/nflows | ELUPlus | false | 11,703 | [
"MIT"
] | 0 | 6e2a267ad0f4ddc84e1db5592ce3c3e4551a7555 | https://github.com/MilesCranmer/nflows/tree/6e2a267ad0f4ddc84e1db5592ce3c3e4551a7555 |
FrameMaxPool | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
class FrameMaxPool(nn.Module):
def __init__(self, input_size, hidden_size, stride):
super(FrameMaxPool, self).__init__()
self.vis_conv = nn.Conv1d(input_size, hidden_size, 1, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.parallel
impo... | MicroTensor-ai/episodic-memory | FrameMaxPool | false | 11,704 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
NN | import torch
import torch.nn.functional as F
import torch.nn as nn
class NN(nn.Module):
def __init__(self, input_size):
super().__init__()
self.fc1 = nn.Linear(input_size, 50)
self.fc2 = nn.Linear(50, 40)
self.fc3 = nn.Linear(40, 20)
self.fc4 = nn.Linear(20, 9)
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_... | Meydand2001/Machine-Learning-project | NN | false | 11,705 | [
"MIT"
] | 0 | dc73bc3820024939ba66a1a3e2ae130d6bf35f9a | https://github.com/Meydand2001/Machine-Learning-project/tree/dc73bc3820024939ba66a1a3e2ae130d6bf35f9a |
L2Norm | import torch
from torch import nn
class L2Norm(nn.Module):
def forward(self, x, eps=1e-06):
norm = x.norm(dim=1, keepdim=True).clamp(min=eps)
return x / norm
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_... | Mohan-Zhang-u/vit-pytorch | L2Norm | false | 11,706 | [
"MIT"
] | 0 | 76050c812474d7c10d67db4e811f537e26c3996a | https://github.com/Mohan-Zhang-u/vit-pytorch/tree/76050c812474d7c10d67db4e811f537e26c3996a |
Downsample | import torch
from torch import nn
class Downsample(nn.Module):
def __init__(self, dim_in, dim_out):
super().__init__()
self.conv = nn.Conv2d(dim_in, dim_out, 3, stride=2, padding=1)
def forward(self, x):
return self.conv(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Mohan-Zhang-u/vit-pytorch | Downsample | false | 11,707 | [
"MIT"
] | 0 | 76050c812474d7c10d67db4e811f537e26c3996a | https://github.com/Mohan-Zhang-u/vit-pytorch/tree/76050c812474d7c10d67db4e811f537e26c3996a |
CQAttention | import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MicroTensor-ai/episodic-memory | CQAttention | false | 11,708 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
MultiHeadAttentionBlock | import math
import torch
import torch.nn.parallel
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, 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._inductor.runtime.... | MicroTensor-ai/episodic-memory | MultiHeadAttentionBlock | false | 11,709 | [
"MIT"
] | 0 | 295a3752ab94c7a6f45355aa2c54bffbf84b574f | https://github.com/MicroTensor-ai/episodic-memory/tree/295a3752ab94c7a6f45355aa2c54bffbf84b574f |
LayerNorm | import torch
from torch import nn
class LayerNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.eps = eps
self.g = nn.Parameter(torch.ones(1, dim, 1, 1))
self.b = nn.Parameter(torch.zeros(1, dim, 1, 1))
def forward(self, x):
std = torch.var(x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Mohan-Zhang-u/vit-pytorch | LayerNorm | false | 11,710 | [
"MIT"
] | 0 | 76050c812474d7c10d67db4e811f537e26c3996a | https://github.com/Mohan-Zhang-u/vit-pytorch/tree/76050c812474d7c10d67db4e811f537e26c3996a |
PEG | import torch
from torch import nn
class Residual(nn.Module):
def __init__(self, fn):
super().__init__()
self.fn = fn
def forward(self, x, **kwargs):
return self.fn(x, **kwargs) + x
class PEG(nn.Module):
def __init__(self, dim, kernel_size=3):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Mohan-Zhang-u/vit-pytorch | PEG | false | 11,711 | [
"MIT"
] | 0 | 76050c812474d7c10d67db4e811f537e26c3996a | https://github.com/Mohan-Zhang-u/vit-pytorch/tree/76050c812474d7c10d67db4e811f537e26c3996a |
ClassHead | import torch
from torch import nn
import torch.cuda
class ClassHead(nn.Module):
"""
ClassHead
RetinaFace head for classification branch.
Args:
inchannels (`int`):
number of input channels.
num_anchors (`int`):
number of anchors.
"""
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 import nn
import torch.cuda
assert_size_stride = torch._C._dynamo.gua... | LoveEachDay/towhee | ClassHead | false | 11,712 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
FakeRKHSConvNet | import math
import torch
import numpy as np
import torch.nn as nn
class MaybeBatchNorm2d(nn.Module):
def __init__(self, n_ftr, affine, use_bn):
super(MaybeBatchNorm2d, self).__init__()
self.bn = nn.BatchNorm2d(n_ftr, affine=affine)
self.use_bn = use_bn
def forward(self, x):
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.... | Luab/pytorch-lightning-bolts | FakeRKHSConvNet | false | 11,713 | [
"Apache-2.0"
] | 0 | b8ac85154465956b06fd1005b21b071af5493f11 | https://github.com/Luab/pytorch-lightning-bolts/tree/b8ac85154465956b06fd1005b21b071af5493f11 |
SchedulerTestNet | import torch
from torch.nn import functional as F
class SchedulerTestNet(torch.nn.Module):
"""
adapted from: https://github.com/pytorch/pytorch/blob/master/test/test_optim.py
"""
def __init__(self):
super(SchedulerTestNet, self).__init__()
self.conv1 = torch.nn.Conv2d(1, 1, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | Luab/pytorch-lightning-bolts | SchedulerTestNet | false | 11,714 | [
"Apache-2.0"
] | 0 | b8ac85154465956b06fd1005b21b071af5493f11 | https://github.com/Luab/pytorch-lightning-bolts/tree/b8ac85154465956b06fd1005b21b071af5493f11 |
Project3D | import torch
import torch.nn as nn
class Project3D(nn.Module):
"""Layer which projects 3D points into a camera with intrinsics K and at position T
"""
def __init__(self, batch_size, height, width, eps=1e-07):
super(Project3D, self).__init__()
self.batch_size = batch_size
self.heig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Morbotu/drone-PWS | Project3D | false | 11,715 | [
"MIT"
] | 0 | face9cbf30a55783592cce8af59c1c70da982b6a | https://github.com/Morbotu/drone-PWS/tree/face9cbf30a55783592cce8af59c1c70da982b6a |
BboxHead | import torch
from torch import nn
import torch.cuda
class BboxHead(nn.Module):
"""
BboxHead
RetinaFace head for bounding box branch.
Args:
inchannels (`int`):
number of input channels.
num_anchors (`int`):
number of anchors.
"""
def __init__(self, inc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.cuda
assert_size_stride = torch._C._dynamo.gua... | LoveEachDay/towhee | BboxHead | false | 11,716 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
LandmarkHead | import torch
from torch import nn
import torch.cuda
class LandmarkHead(nn.Module):
"""
LandmarkHead
RetinaFace head for landmark branch.
inchannels (`int`):
number of input channels.
num_anchors (`int`):
number of anchors.
"""
def __init__(self, inchannel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.cuda
assert_size_stride = torch._C._dynamo.gua... | LoveEachDay/towhee | LandmarkHead | false | 11,717 | [
"Apache-2.0"
] | 0 | 513c9c2626676cadaaf0a16ac3c828d96bec91a1 | https://github.com/LoveEachDay/towhee/tree/513c9c2626676cadaaf0a16ac3c828d96bec91a1 |
AmdimNCELoss | import torch
import torch.nn as nn
def tanh_clip(x, clip_val=10.0):
"""
soft clip values to the range [-clip_val, +clip_val]
"""
if clip_val is not None:
x_clip = clip_val * torch.tanh(1.0 / clip_val * x)
else:
x_clip = x
return x_clip
class AmdimNCELoss(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.... | Luab/pytorch-lightning-bolts | AmdimNCELoss | false | 11,718 | [
"Apache-2.0"
] | 0 | b8ac85154465956b06fd1005b21b071af5493f11 | https://github.com/Luab/pytorch-lightning-bolts/tree/b8ac85154465956b06fd1005b21b071af5493f11 |
Conv3x3 | import torch
import torch.nn as nn
class Conv3x3(nn.Module):
"""Layer to pad and convolve input
"""
def __init__(self, in_channels, out_channels, use_refl=True):
super(Conv3x3, self).__init__()
if use_refl:
self.pad = nn.ReflectionPad2d(1)
else:
self.pad = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Morbotu/drone-PWS | Conv3x3 | false | 11,719 | [
"MIT"
] | 0 | face9cbf30a55783592cce8af59c1c70da982b6a | https://github.com/Morbotu/drone-PWS/tree/face9cbf30a55783592cce8af59c1c70da982b6a |
ConvBlock | import torch
import torch.nn as nn
class Conv3x3(nn.Module):
"""Layer to pad and convolve input
"""
def __init__(self, in_channels, out_channels, use_refl=True):
super(Conv3x3, self).__init__()
if use_refl:
self.pad = nn.ReflectionPad2d(1)
else:
self.pad = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
im... | Morbotu/drone-PWS | ConvBlock | false | 11,720 | [
"MIT"
] | 0 | face9cbf30a55783592cce8af59c1c70da982b6a | https://github.com/Morbotu/drone-PWS/tree/face9cbf30a55783592cce8af59c1c70da982b6a |
Scaled_Dot_Product_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Moon-xm/Chinese-Text-Classification-Pytorch | Scaled_Dot_Product_Attention | false | 11,721 | [
"MIT"
] | 0 | 19fe64006418bf4296f884e4d1f038c17b34d3de | https://github.com/Moon-xm/Chinese-Text-Classification-Pytorch/tree/19fe64006418bf4296f884e4d1f038c17b34d3de |
Discriminator | import torch
import numpy as np
import torch.nn as nn
from torch.nn import functional as F
class Discriminator(nn.Module):
def __init__(self, img_shape, hidden_dim=1024):
super().__init__()
in_dim = int(np.prod(img_shape))
self.fc1 = nn.Linear(in_dim, hidden_dim)
self.fc2 = nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | Luab/pytorch-lightning-bolts | Discriminator | false | 11,722 | [
"Apache-2.0"
] | 0 | b8ac85154465956b06fd1005b21b071af5493f11 | https://github.com/Luab/pytorch-lightning-bolts/tree/b8ac85154465956b06fd1005b21b071af5493f11 |
DenseBlock | import torch
from torch import nn as nn
from torch.nn import 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.
Output: (B, D_out, T), where B... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | NagisaZj/ProMP | DenseBlock | false | 11,723 | [
"MIT"
] | 0 | 539739ae2b7d5fdcad00855da695f643b23df4b3 | https://github.com/NagisaZj/ProMP/tree/539739ae2b7d5fdcad00855da695f643b23df4b3 |
SSIM | import torch
import torch.nn as nn
class SSIM(nn.Module):
"""Layer to compute the SSIM loss between a pair of images
"""
def __init__(self):
super(SSIM, self).__init__()
self.mu_x_pool = nn.AvgPool2d(3, 1)
self.mu_y_pool = nn.AvgPool2d(3, 1)
self.sig_x_pool = nn.AvgPool2d(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Morbotu/drone-PWS | SSIM | false | 11,724 | [
"MIT"
] | 0 | face9cbf30a55783592cce8af59c1c70da982b6a | https://github.com/Morbotu/drone-PWS/tree/face9cbf30a55783592cce8af59c1c70da982b6a |
Multi_Head_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | Moon-xm/Chinese-Text-Classification-Pytorch | Multi_Head_Attention | false | 11,725 | [
"MIT"
] | 0 | 19fe64006418bf4296f884e4d1f038c17b34d3de | https://github.com/Moon-xm/Chinese-Text-Classification-Pytorch/tree/19fe64006418bf4296f884e4d1f038c17b34d3de |
HuberLoss | import torch
from torch import nn as nn
class HuberLoss(nn.Module):
def __init__(self, delta=1):
super().__init__()
self.huber_loss_delta1 = nn.SmoothL1Loss()
self.delta = delta
def forward(self, x, x_hat):
loss = self.huber_loss_delta1(x / self.delta, x_hat / self.delta)
... | 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... | NagisaZj/ProMP | HuberLoss | false | 11,726 | [
"MIT"
] | 0 | 539739ae2b7d5fdcad00855da695f643b23df4b3 | https://github.com/NagisaZj/ProMP/tree/539739ae2b7d5fdcad00855da695f643b23df4b3 |
LayerNorm | import torch
from torch import nn as nn
class LayerNorm(nn.Module):
"""
Simple 1D LayerNorm.
"""
def __init__(self, features, center=True, scale=False, eps=1e-06):
super().__init__()
self.center = center
self.scale = scale
self.eps = eps
if self.scale:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_... | NagisaZj/ProMP | LayerNorm | false | 11,727 | [
"MIT"
] | 0 | 539739ae2b7d5fdcad00855da695f643b23df4b3 | https://github.com/NagisaZj/ProMP/tree/539739ae2b7d5fdcad00855da695f643b23df4b3 |
CausalConv1d | import torch
from torch import nn as nn
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 the minibatch size, D_out is 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 import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_s... | NagisaZj/ProMP | CausalConv1d | false | 11,728 | [
"MIT"
] | 0 | 539739ae2b7d5fdcad00855da695f643b23df4b3 | https://github.com/NagisaZj/ProMP/tree/539739ae2b7d5fdcad00855da695f643b23df4b3 |
Stoplinear | import torch
from collections import OrderedDict
import torch.nn as nn
class Linear(nn.Module):
"""
Linear Module
"""
def __init__(self, in_dim, out_dim, bias=True, w_init='linear'):
"""
:param in_dim: dimension of input
:param out_dim: dimension of output
:param bias:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 collections import Order... | Munna-Manoj/Team7_TTS | Stoplinear | false | 11,729 | [
"MIT"
] | 0 | 5e2d473a2afe429023876bcc51c2ac966a4938b8 | https://github.com/Munna-Manoj/Team7_TTS/tree/5e2d473a2afe429023876bcc51c2ac966a4938b8 |
FFN | import torch
import torch.nn as nn
import torch as t
class Conv(nn.Module):
"""
Convolution Module
"""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=1, bias=True, w_init='linear'):
"""
:param in_channels: dimension of input
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Munna-Manoj/Team7_TTS | FFN | false | 11,730 | [
"MIT"
] | 0 | 5e2d473a2afe429023876bcc51c2ac966a4938b8 | https://github.com/Munna-Manoj/Team7_TTS/tree/5e2d473a2afe429023876bcc51c2ac966a4938b8 |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Moon-xm/Chinese-Text-Classification-Pytorch | Encoder | false | 11,731 | [
"MIT"
] | 0 | 19fe64006418bf4296f884e4d1f038c17b34d3de | https://github.com/Moon-xm/Chinese-Text-Classification-Pytorch/tree/19fe64006418bf4296f884e4d1f038c17b34d3de |
Position_wise_Feed_Forward | import torch
import torch.nn as nn
import torch.nn.functional as F
class Position_wise_Feed_Forward(nn.Module):
def __init__(self, dim_model, hidden, dropout=0.0):
super(Position_wise_Feed_Forward, self).__init__()
self.fc1 = nn.Linear(dim_model, hidden)
self.fc2 = nn.Linear(hidden, dim_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.... | Moon-xm/Chinese-Text-Classification-Pytorch | Position_wise_Feed_Forward | false | 11,732 | [
"MIT"
] | 0 | 19fe64006418bf4296f884e4d1f038c17b34d3de | https://github.com/Moon-xm/Chinese-Text-Classification-Pytorch/tree/19fe64006418bf4296f884e4d1f038c17b34d3de |
MultiheadAttention | import math
import torch
import torch.nn as nn
import torch as t
class MultiheadAttention(nn.Module):
"""
Multihead attention mechanism (dot attention)
"""
def __init__(self, num_hidden_k):
"""
:param num_hidden_k: dimension of hidden
"""
super(MultiheadAttention, 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
from torch._inductor.runtime.... | Munna-Manoj/Team7_TTS | MultiheadAttention | false | 11,733 | [
"MIT"
] | 0 | 5e2d473a2afe429023876bcc51c2ac966a4938b8 | https://github.com/Munna-Manoj/Team7_TTS/tree/5e2d473a2afe429023876bcc51c2ac966a4938b8 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
"""Sørensen–Dice coefficient loss to calculate
the mean loss over a batch of data.This loss mainly
calculates the similarity between two samples.
To know more about this loss check this link:
https://en.wikipedia.org/wiki/S%C3%B8rensen%... | 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... | NajusAnaxi/UNet-based-for-Brain-Tumor-Segmentation | DiceLoss | false | 11,734 | [
"MIT"
] | 0 | 24ca4432873f145ad33810f40c851ac10bf030fa | https://github.com/NajusAnaxi/UNet-based-for-Brain-Tumor-Segmentation/tree/24ca4432873f145ad33810f40c851ac10bf030fa |
BCEDiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiceLoss(nn.Module):
"""Sørensen–Dice coefficient loss to calculate
the mean loss over a batch of data.This loss mainly
calculates the similarity between two samples.
To know more about this loss check this link:
https://en.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._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | NajusAnaxi/UNet-based-for-Brain-Tumor-Segmentation | BCEDiceLoss | false | 11,735 | [
"MIT"
] | 0 | 24ca4432873f145ad33810f40c851ac10bf030fa | https://github.com/NajusAnaxi/UNet-based-for-Brain-Tumor-Segmentation/tree/24ca4432873f145ad33810f40c851ac10bf030fa |
GraphConv | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
class MeanAggregator(nn.Module):
def forward(self, features, A):
x = torch.bmm(A, features)
return x
class GraphConv(nn.Module):
def __init__(self, in_dim, out_dim):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | NceBoy/mmocr | GraphConv | false | 11,736 | [
"Apache-2.0"
] | 0 | 3fb7a18d7eb44799e75c1991e5da2044b458d411 | https://github.com/NceBoy/mmocr/tree/3fb7a18d7eb44799e75c1991e5da2044b458d411 |
Vol | import math
import torch
from torch import Tensor
import torchaudio.functional as F
class Vol(torch.nn.Module):
"""Add a volume to an waveform.
Args:
gain (float): Interpreted according to the given gain_type:
If ``gain_type`` = ``amplitude``, ``gain`` is a positive amplitude ratio.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Nayef211/audio | Vol | false | 11,737 | [
"BSD-2-Clause"
] | 0 | 241ab1e8284e589262f510ee9411baf2bc374ded | https://github.com/Nayef211/audio/tree/241ab1e8284e589262f510ee9411baf2bc374ded |
ComputeDeltas | import torch
from torch import Tensor
import torchaudio.functional as F
class ComputeDeltas(torch.nn.Module):
"""Compute delta coefficients of a tensor, usually a spectrogram.
See `torchaudio.functional.compute_deltas` for more details.
Args:
win_length (int): The window length used for computin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Nayef211/audio | ComputeDeltas | false | 11,738 | [
"BSD-2-Clause"
] | 0 | 241ab1e8284e589262f510ee9411baf2bc374ded | https://github.com/Nayef211/audio/tree/241ab1e8284e589262f510ee9411baf2bc374ded |
MuLawEncoding | import torch
from torch import Tensor
import torchaudio.functional as F
class MuLawEncoding(torch.nn.Module):
"""Encode signal based on mu-law companding. For more info see the
`Wikipedia Entry <https://en.wikipedia.org/wiki/%CE%9C-law_algorithm>`_
This algorithm assumes the signal has been scaled to be... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_strid... | Nayef211/audio | MuLawEncoding | false | 11,739 | [
"BSD-2-Clause"
] | 0 | 241ab1e8284e589262f510ee9411baf2bc374ded | https://github.com/Nayef211/audio/tree/241ab1e8284e589262f510ee9411baf2bc374ded |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 5)
self.pool1 = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(32, 32, 3)
self.pool2 = nn.MaxPool2d(3, 3)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MonteYang/P1_Facial_Keypoints | Net | false | 11,740 | [
"MIT"
] | 0 | 1e3e4c9c6b48ec241f6fc7e072b25c7211cebd18 | https://github.com/MonteYang/P1_Facial_Keypoints/tree/1e3e4c9c6b48ec241f6fc7e072b25c7211cebd18 |
Attention | import math
import torch
import torch.nn as nn
import torch as t
class Linear(nn.Module):
"""
Linear Module
"""
def __init__(self, in_dim, out_dim, bias=True, w_init='linear'):
"""
:param in_dim: dimension of input
:param out_dim: dimension of output
:param bias: boole... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Munna-Manoj/Team7_TTS | Attention | false | 11,741 | [
"MIT"
] | 0 | 5e2d473a2afe429023876bcc51c2ac966a4938b8 | https://github.com/Munna-Manoj/Team7_TTS/tree/5e2d473a2afe429023876bcc51c2ac966a4938b8 |
SlidingWindowCmn | import torch
from torch import Tensor
import torchaudio.functional as F
class SlidingWindowCmn(torch.nn.Module):
"""
Apply sliding-window cepstral mean (and optionally variance) normalization per utterance.
Args:
cmn_window (int, optional): Window in frames for running average CMN computation (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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret... | Nayef211/audio | SlidingWindowCmn | false | 11,742 | [
"BSD-2-Clause"
] | 0 | 241ab1e8284e589262f510ee9411baf2bc374ded | https://github.com/Nayef211/audio/tree/241ab1e8284e589262f510ee9411baf2bc374ded |
AmplitudeToDB | import math
import torch
from torch import Tensor
import torchaudio.functional as F
from typing import Optional
class AmplitudeToDB(torch.nn.Module):
"""Turn a tensor from the power/amplitude scale to the decibel scale.
This output depends on the maximum value in the input tensor, and so
may return diffe... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import math
from typing impo... | Nayef211/audio | AmplitudeToDB | false | 11,743 | [
"BSD-2-Clause"
] | 0 | 241ab1e8284e589262f510ee9411baf2bc374ded | https://github.com/Nayef211/audio/tree/241ab1e8284e589262f510ee9411baf2bc374ded |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, eps=1e-06):
super().__init__()
assert isinstance(eps, float)
self.eps = eps
def forward(self, pred, target, mask=None):
pred = pred.contiguous().view(pred.size()[0], -1)
target = target.c... | 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... | NceBoy/mmocr | DiceLoss | false | 11,744 | [
"Apache-2.0"
] | 0 | 3fb7a18d7eb44799e75c1991e5da2044b458d411 | https://github.com/NceBoy/mmocr/tree/3fb7a18d7eb44799e75c1991e5da2044b458d411 |
MuLawDecoding | import torch
from torch import Tensor
import torchaudio.functional as F
class MuLawDecoding(torch.nn.Module):
"""Decode mu-law encoded signal. For more info see the
`Wikipedia Entry <https://en.wikipedia.org/wiki/%CE%9C-law_algorithm>`_
This expects an input with values between 0 and quantization_channe... | 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... | Nayef211/audio | MuLawDecoding | false | 11,745 | [
"BSD-2-Clause"
] | 0 | 241ab1e8284e589262f510ee9411baf2bc374ded | https://github.com/Nayef211/audio/tree/241ab1e8284e589262f510ee9411baf2bc374ded |
AvgPool2d | from torch.nn import Module
import torch
import torch as th
class AvgPool2d(Module):
"""
This class is the beginning of an exact python port of the torch.nn.AvgPool2d
module. Because PySyft cannot hook into layers which are implemented in C++,
our special functionalities (such as encrypted computation... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._em... | NiWaRe/PySyft | AvgPool2d | false | 11,746 | [
"Apache-2.0"
] | 0 | b5abe66ea949d60be14a08d2e4e32e9587c7bf5c | https://github.com/NiWaRe/PySyft/tree/b5abe66ea949d60be14a08d2e4e32e9587c7bf5c |
MultiHeadAttention | import math
import torch
import torch.nn as nn
def scaled_dot_product_attention(query, keys, values, mask=None):
d_k = keys.shape[-1]
dot_score = query @ keys.transpose(-2, -1) / math.sqrt(d_k)
if mask is not None:
dot_score = dot_score.masked_fill(mask == 0, -1000000000.0)
attn_score = torch.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | NathanYanJing/TransformerReplication | MultiHeadAttention | false | 11,748 | [
"MIT"
] | 0 | b20f987dcc507724971f843c2d214c9c76bd8e34 | https://github.com/NathanYanJing/TransformerReplication/tree/b20f987dcc507724971f843c2d214c9c76bd8e34 |
EncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def scaled_dot_product_attention(query, keys, values, mask=None):
d_k = keys.shape[-1]
dot_score = query @ keys.transpose(-2, -1) / math.sqrt(d_k)
if mask is not None:
dot_score = dot_score.masked_fill(mask == 0, -10000... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | NathanYanJing/TransformerReplication | EncoderLayer | false | 11,749 | [
"MIT"
] | 0 | b20f987dcc507724971f843c2d214c9c76bd8e34 | https://github.com/NathanYanJing/TransformerReplication/tree/b20f987dcc507724971f843c2d214c9c76bd8e34 |
CustomGruCell | import torch
import numpy as np
import torch.nn as nn
class CustomGruCell(nn.Module):
"""
A forward only GRU cell.
Input should be: (sequence length x batch size x input_size).
The output is the output of the final forward call.
It's not clear if it would be possible to use the output from each ce... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | NiWaRe/PySyft | CustomGruCell | false | 11,750 | [
"Apache-2.0"
] | 0 | b5abe66ea949d60be14a08d2e4e32e9587c7bf5c | https://github.com/NiWaRe/PySyft/tree/b5abe66ea949d60be14a08d2e4e32e9587c7bf5c |
ToLongTensor | import torch
from torch import Tensor
from typing import List
import torch.nn as nn
class ToLongTensor(nn.Module):
"""Convert a list of integers to long tensor
"""
def __init__(self):
super(ToLongTensor, self).__init__()
def forward(self, tokens: 'List[List[int]]') ->Tensor:
return 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... | NivekT/text | ToLongTensor | false | 11,751 | [
"BSD-3-Clause"
] | 0 | 4908d3c88f92296a4c23be2f064ccde13cce50ce | https://github.com/NivekT/text/tree/4908d3c88f92296a4c23be2f064ccde13cce50ce |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.