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 |
|---|---|---|---|---|---|---|---|---|---|---|
Foo | import torch
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.fx
import torch.optim
import torch.utils.data.distributed
def add_lowp(a: 'torch.Tensor', b: 'torch.Tensor'):
a, b = a.float(), b.float()
c = a + b
return c.half()
def sigmoid_lowp(x: 'torch.Tensor'):
x = 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.parallel
import torch.utils.data
import torch.onnx
import torch.fx
import torch.optim
import torch.utils.data.distributed
as... | lenaguignard/examples | Foo | false | 15,895 | [
"BSD-3-Clause"
] | 19,783 | 973e77b725a6028289a90170f0b237ea2e71d4f2 | https://github.com/lenaguignard/examples/tree/973e77b725a6028289a90170f0b237ea2e71d4f2 |
DCLoss | import torch
def apply_reduction(losses, reduction='none'):
"""Apply reduction to collection of losses."""
if reduction == 'mean':
losses = losses.mean()
elif reduction == 'sum':
losses = losses.sum()
return losses
class DCLoss(torch.nn.Module):
"""DC loss function module.
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.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | leoauri/auraloss | DCLoss | false | 15,896 | [
"Apache-2.0"
] | 272 | 0e3362674ae1b53aa61c6a631fb4e6970c5683c1 | https://github.com/leoauri/auraloss/tree/0e3362674ae1b53aa61c6a631fb4e6970c5683c1 |
ChannelAttention | import torch
import torch.nn as nn
class ChannelAttention(nn.Module):
def __init__(self, in_planes, ratio=4):
super(ChannelAttention, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPool2d(1)
self.fc1 = nn.Conv2d(in_planes, in_planes // ratio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | lee-zq/VesselSeg-pytorch | ChannelAttention | false | 15,897 | [
"Apache-2.0"
] | 83 | b4f6571fc1fb1fbdaad60ff9282a54a1f1c455fa | https://github.com/lee-zq/VesselSeg-pytorch/tree/b4f6571fc1fb1fbdaad60ff9282a54a1f1c455fa |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, d_k):
super(ScaledDotProductAttention, self).__init__()
self.d_k = d_k
def forward(self, Q, K, V, attn_mask=None):
scores = torch.matmul(Q, K.transpose(-1, -2)) / np.s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | limhj159/NewsRecommendation | ScaledDotProductAttention | false | 15,898 | [
"MIT"
] | 125 | 5d19566b63b6cf35b5be0c2b175c5050e51f57b8 | https://github.com/limhj159/NewsRecommendation/tree/5d19566b63b6cf35b5be0c2b175c5050e51f57b8 |
MyElementwiseModule | import torch
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.fx
import torch.optim
import torch.utils.data.distributed
class MyElementwiseModule(torch.nn.Module):
def forward(self, x, y):
return x * y + y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand... | 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.parallel
import torch.utils.data
import torch.onnx
import torch.fx
import torch.optim
import torch.utils.data.distributed
as... | lenaguignard/examples | MyElementwiseModule | false | 15,899 | [
"BSD-3-Clause"
] | 19,783 | 973e77b725a6028289a90170f0b237ea2e71d4f2 | https://github.com/lenaguignard/examples/tree/973e77b725a6028289a90170f0b237ea2e71d4f2 |
BasicBlock | import torch
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1, padding=0):
"""3x3 convolution with padding"""
return torch.nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=
stride, padding=padding, groups=groups, bias=False, dilation=dilation)
class BasicBlock(torch.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
assert_size_stride = torch._C... | leggedrobotics/DeLORA | BasicBlock | false | 15,900 | [
"BSD-3-Clause"
] | 154 | 909948d63a9517e6dd54bedcf099f6b39ded2cb4 | https://github.com/leggedrobotics/DeLORA/tree/909948d63a9517e6dd54bedcf099f6b39ded2cb4 |
Residual | import torch
import torch.nn as nn
class Residual(nn.Module):
def __init__(self, channels, filter=3, stride=1, padding=1, activation=
nn.ReLU):
super(Residual, self).__init__()
self.conv = nn.Conv2d(channels, channels, filter, stride, padding)
self.activation = activation()
d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | limberc/HyperGAN | Residual | false | 15,901 | [
"MIT"
] | 889 | b074e74abf0ed9b81bd52084706e3707a47e0fe2 | https://github.com/limberc/HyperGAN/tree/b074e74abf0ed9b81bd52084706e3707a47e0fe2 |
SDSDRLoss | import torch
def apply_reduction(losses, reduction='none'):
"""Apply reduction to collection of losses."""
if reduction == 'mean':
losses = losses.mean()
elif reduction == 'sum':
losses = losses.sum()
return losses
class SDSDRLoss(torch.nn.Module):
"""Scale-dependent signal-to-di... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | leoauri/auraloss | SDSDRLoss | false | 15,902 | [
"Apache-2.0"
] | 272 | 0e3362674ae1b53aa61c6a631fb4e6970c5683c1 | https://github.com/leoauri/auraloss/tree/0e3362674ae1b53aa61c6a631fb4e6970c5683c1 |
Codebook | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class Codebook(nn.Module):
"""
Codebook mapping: takes in an encoded image and maps each vector onto its closest codebook vector.
Metric: mean squared error = (z_e - z_q)**2 = (z_e**2) - (2*z_e*z_q) + (z_q**2)
"""
de... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | JiangtaoFeng/MaskGIT-pytorch | Codebook | false | 15,903 | [
"MIT"
] | 163 | 198b32e29a306fae2830a71621befad008500f76 | https://github.com/JiangtaoFeng/MaskGIT-pytorch/tree/198b32e29a306fae2830a71621befad008500f76 |
LogCoshLoss | import torch
def apply_reduction(losses, reduction='none'):
"""Apply reduction to collection of losses."""
if reduction == 'mean':
losses = losses.mean()
elif reduction == 'sum':
losses = losses.sum()
return losses
class LogCoshLoss(torch.nn.Module):
"""Log-cosh loss function mod... | 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... | leoauri/auraloss | LogCoshLoss | false | 15,904 | [
"Apache-2.0"
] | 272 | 0e3362674ae1b53aa61c6a631fb4e6970c5683c1 | https://github.com/leoauri/auraloss/tree/0e3362674ae1b53aa61c6a631fb4e6970c5683c1 |
ESRLoss | import torch
def apply_reduction(losses, reduction='none'):
"""Apply reduction to collection of losses."""
if reduction == 'mean':
losses = losses.mean()
elif reduction == 'sum':
losses = losses.sum()
return losses
class ESRLoss(torch.nn.Module):
"""Error-to-signal ratio loss fun... | 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... | leoauri/auraloss | ESRLoss | false | 15,905 | [
"Apache-2.0"
] | 272 | 0e3362674ae1b53aa61c6a631fb4e6970c5683c1 | https://github.com/leoauri/auraloss/tree/0e3362674ae1b53aa61c6a631fb4e6970c5683c1 |
MulticlassDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target):
N = target.size(0)
smooth = 1
input_flat = input.view(N, -1)
target_flat = target.view(N, -1)
intersection = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | lee-zq/VesselSeg-pytorch | MulticlassDiceLoss | false | 15,906 | [
"Apache-2.0"
] | 83 | b4f6571fc1fb1fbdaad60ff9282a54a1f1c455fa | https://github.com/lee-zq/VesselSeg-pytorch/tree/b4f6571fc1fb1fbdaad60ff9282a54a1f1c455fa |
Variational | import torch
import torch.nn as nn
class Variational(nn.Module):
def __init__(self, channels, filter=1, stride=1, padding=0, activation=
nn.LeakyReLU):
super(Variational, self).__init__()
self.mu_logit = nn.Conv2d(channels, channels, filter, stride,
padding, padding_mode='refl... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math... | limberc/HyperGAN | Variational | false | 15,907 | [
"MIT"
] | 889 | b074e74abf0ed9b81bd52084706e3707a47e0fe2 | https://github.com/limberc/HyperGAN/tree/b074e74abf0ed9b81bd52084706e3707a47e0fe2 |
SNRLoss | import torch
def apply_reduction(losses, reduction='none'):
"""Apply reduction to collection of losses."""
if reduction == 'mean':
losses = losses.mean()
elif reduction == 'sum':
losses = losses.sum()
return losses
class SNRLoss(torch.nn.Module):
"""Signal-to-noise ratio loss mod... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | leoauri/auraloss | SNRLoss | false | 15,908 | [
"Apache-2.0"
] | 272 | 0e3362674ae1b53aa61c6a631fb4e6970c5683c1 | https://github.com/leoauri/auraloss/tree/0e3362674ae1b53aa61c6a631fb4e6970c5683c1 |
SISDRLoss | import torch
def apply_reduction(losses, reduction='none'):
"""Apply reduction to collection of losses."""
if reduction == 'mean':
losses = losses.mean()
elif reduction == 'sum':
losses = losses.sum()
return losses
class SISDRLoss(torch.nn.Module):
"""Scale-invariant signal-to-di... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | leoauri/auraloss | SISDRLoss | false | 15,909 | [
"Apache-2.0"
] | 272 | 0e3362674ae1b53aa61c6a631fb4e6970c5683c1 | https://github.com/leoauri/auraloss/tree/0e3362674ae1b53aa61c6a631fb4e6970c5683c1 |
ComplexConv | import torch
import torch.nn as nn
class ComplexConv(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True):
super(ComplexConv, self).__init__()
self.device = torch.device('cuda' if torch.cuda.is_available() else
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | litcoderr/ComplexCNN | ComplexConv | false | 15,910 | [
"MIT"
] | 154 | 97db7c94b1ad91fc689faf36693977cc476818e9 | https://github.com/litcoderr/ComplexCNN/tree/97db7c94b1ad91fc689faf36693977cc476818e9 |
CO2Regularizer | import torch
class MemoryBankModule(torch.nn.Module):
"""Memory bank implementation
This is a parent class to all loss functions implemented by the lightly
Python package. This way, any loss can be used with a memory bank if
desired.
Attributes:
size:
Number of keys the memo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | lightly-ai/lightly | CO2Regularizer | false | 15,911 | [
"MIT"
] | 1,515 | 0b98bda640d13d842fd13f9354271d0cef116ba5 | https://github.com/lightly-ai/lightly/tree/0b98bda640d13d842fd13f9354271d0cef116ba5 |
DepthNormalizer | import torch
import torch.nn as nn
class DepthNormalizer(nn.Module):
def __init__(self, input_size: 'int'=512, z_size: 'int'=200):
"""
Class about DepthNormalizer
which use to generate depth-information
Parameters:
input_size: the size of image, initially, 512 x 512
... | 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... | lingtengqiu/Open-PIFuhd | DepthNormalizer | false | 15,912 | [
"MIT"
] | 191 | 3a66b647bcf5591e818af62735e64a93c4aaef85 | https://github.com/lingtengqiu/Open-PIFuhd/tree/3a66b647bcf5591e818af62735e64a93c4aaef85 |
MultiHeadSelfAttention | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, d_k):
super(ScaledDotProductAttention, self).__init__()
self.d_k = d_k
def forward(self, Q, K, V, attn_mask=None):
scores = torch.matmul(Q, K.transpose(-1, -2)) / np.s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy ... | limhj159/NewsRecommendation | MultiHeadSelfAttention | false | 15,913 | [
"MIT"
] | 125 | 5d19566b63b6cf35b5be0c2b175c5050e51f57b8 | https://github.com/limhj159/NewsRecommendation/tree/5d19566b63b6cf35b5be0c2b175c5050e51f57b8 |
RayAngEncoder | import torch
import numpy as np
import torch.nn as nn
def calculate_angle(a, b=None):
if b is None:
b = torch.Tensor([0.0, 0.0, 1.0]).view(1, 1, -1)
dot_product = (a * b).sum(-1)
norm_a = torch.norm(a, p=2, dim=-1)
norm_b = torch.norm(b, p=2, dim=-1)
cos = dot_product / (norm_a * norm_b)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
import to... | liruilong940607/A-NeRF | RayAngEncoder | false | 15,914 | [
"MIT"
] | 110 | 19cb6c4fd389266214ac0d7215a44011cb1bebf5 | https://github.com/liruilong940607/A-NeRF/tree/19cb6c4fd389266214ac0d7215a44011cb1bebf5 |
CustomizedNet | import torch
import torch.nn as nn
import torch.utils.data.distributed
class CustomizedNet(nn.Module):
def __init__(self, dropout, input_size, input_feature_num, hidden_dim,
output_size):
"""
Simply use linear layers for multi-variate single-step forecasting.
"""
super()._... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | limn2o4/analytics-zoo | CustomizedNet | false | 15,915 | [
"Apache-2.0"
] | 2,970 | 78d6ce10976a7e1320ff5ebdf431db93a439ec56 | https://github.com/limn2o4/analytics-zoo/tree/78d6ce10976a7e1320ff5ebdf431db93a439ec56 |
ParseL1loss | import torch
from torch import nn
import torch.nn.functional as F
class ParseL1loss(nn.Module):
def __init__(self):
super(ParseL1loss, self).__init__()
def forward(self, output, target, mask):
mask = (mask == 1).float()
loss = F.l1_loss(output * mask, target * mask, size_average=Fals... | 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... | litsunshine/NonCuboidRoom | ParseL1loss | false | 15,916 | [
"MIT"
] | 54 | c782222b951c622d80cae5f3217424dc2cbe6ef5 | https://github.com/litsunshine/NonCuboidRoom/tree/c782222b951c622d80cae5f3217424dc2cbe6ef5 |
UserEncoder | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class AdditiveAttention(torch.nn.Module):
"""
A general additive attention module.
Originally for NAML.
"""
def __init__(self, query_vector_dim, candidate_vector_dim, writer=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.... | limhj159/NewsRecommendation | UserEncoder | false | 15,917 | [
"MIT"
] | 125 | 5d19566b63b6cf35b5be0c2b175c5050e51f57b8 | https://github.com/limhj159/NewsRecommendation/tree/5d19566b63b6cf35b5be0c2b175c5050e51f57b8 |
NTXentLoss | import torch
class MemoryBankModule(torch.nn.Module):
"""Memory bank implementation
This is a parent class to all loss functions implemented by the lightly
Python package. This way, any loss can be used with a memory bank if
desired.
Attributes:
size:
Number of keys the memo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | lightly-ai/lightly | NTXentLoss | false | 15,918 | [
"MIT"
] | 1,515 | 0b98bda640d13d842fd13f9354271d0cef116ba5 | https://github.com/lightly-ai/lightly/tree/0b98bda640d13d842fd13f9354271d0cef116ba5 |
DCGanGenerator | import torch
import torch.nn as nn
from torch.nn import functional as F
class DCGanGenerator(nn.Module):
def __init__(self, latent_dim):
super().__init__()
self.fc1 = nn.Linear(latent_dim, 2 * 2 * 512)
self.conv1 = nn.ConvTranspose2d(512, 256, kernel_size=5, stride=1,
padding=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | krylea/mine-pytorch | DCGanGenerator | false | 15,919 | [
"MIT"
] | 108 | a638ca3e46ff21a3b9dfebe25480eaed0e3304bc | https://github.com/krylea/mine-pytorch/tree/a638ca3e46ff21a3b9dfebe25480eaed0e3304bc |
BalancedNet | import torch
import torch.nn as nn
from torch import logsumexp as logsumexp
import torch.nn.functional as F
class BalancedNet(nn.Module):
"""A torch.model used as a component of the HEMM module to determine the outcome as a function of confounders.
The balanced net consists of two different neural networks 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.triton_helpers import libdevice
import torch.nn as ... | liranszlak/causallib | BalancedNet | false | 15,920 | [
"Apache-2.0"
] | 350 | 2636149f6b1e307672aff638a53f8eaf2be56bc9 | https://github.com/liranszlak/causallib/tree/2636149f6b1e307672aff638a53f8eaf2be56bc9 |
AttentionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import *
class AttentionLayer(nn.Module):
def __init__(self, hidden_dim_en, hidden_dim_de, projected_size):
super(AttentionLayer, self).__init__()
self.linear1 = nn.Linear(hidden_dim_en, projected_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.... | littlekobe/AREL-for-Visual-Storytelling | AttentionLayer | false | 15,921 | [
"MIT"
] | 82 | 7df46be67a2de22a763bad25c70066b702a6afba | https://github.com/littlekobe/AREL-for-Visual-Storytelling/tree/7df46be67a2de22a763bad25c70066b702a6afba |
VecNormEncoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class BaseEncoder(nn.Module):
def __init__(self, N_joints=24, N_dims=None):
super().__init__()
self.N_joints = N_joints
self.N_dims = N_dims if N_dims is not None else 1
@property
def dims(self):
return 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 libdevice
import torch.nn as nn
assert... | liruilong940607/A-NeRF | VecNormEncoder | false | 15,922 | [
"MIT"
] | 110 | 19cb6c4fd389266214ac0d7215a44011cb1bebf5 | https://github.com/liruilong940607/A-NeRF/tree/19cb6c4fd389266214ac0d7215a44011cb1bebf5 |
BertLinear | import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 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.triton_helpers import libdevice
import math
import ... | liu4lin/UniRE | BertLinear | false | 15,923 | [
"MIT"
] | 87 | fb31801161758e50762f9a70820b71aefb5c5515 | https://github.com/liu4lin/UniRE/tree/fb31801161758e50762f9a70820b71aefb5c5515 |
TwoMLPHead | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
class TwoMLPHead(nn.Module):
"""
Standard heads for FPN-based models
Arguments:
in_channels (int): number of input channels
representation_size (int): size of the intermediate representation
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | littlerain2310/japances_character | TwoMLPHead | false | 15,924 | [
"MIT",
"BSD-3-Clause"
] | 81 | bdca6b30f3058af30462dcd5729eacb69f6fa83b | https://github.com/littlerain2310/japances_character/tree/bdca6b30f3058af30462dcd5729eacb69f6fa83b |
SoftDetectionModule | import torch
import torch.nn.functional as F
import torch.nn as nn
class SoftDetectionModule(nn.Module):
def __init__(self, soft_local_max_size=3):
super(SoftDetectionModule, self).__init__()
self.soft_local_max_size = soft_local_max_size
self.pad = self.soft_local_max_size // 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | liuyuzhenn/d2-net | SoftDetectionModule | false | 15,925 | [
"BSD-3-Clause-Clear"
] | 603 | bc3394934c87cba232144756b1fece4c8ed3aba1 | https://github.com/liuyuzhenn/d2-net/tree/bc3394934c87cba232144756b1fece4c8ed3aba1 |
MLPFunc | import torch
from torch import nn
from torch.nn import functional as F
from torch.autograd import Variable
def seq_dropout(x, p=0, training=False):
"""
x: batch * len * input_size
"""
if training is False or p == 0:
return x
dropout_mask = Variable(1.0 / (1 - p) * torch.bernoulli((1 - p) *... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | lixinsu/RCZoo | MLPFunc | false | 15,926 | [
"MIT"
] | 166 | 37fcb7962fbd4c751c561d4a0c84173881ea8339 | https://github.com/lixinsu/RCZoo/tree/37fcb7962fbd4c751c561d4a0c84173881ea8339 |
SmoothL1Loss | import torch
import torch.nn as nn
class SmoothL1Loss(nn.Module):
def __init__(self, beta=1.0, reduction='mean'):
super().__init__()
self.beta = beta
self.reduction = reduction
def forward(self, pred, target, weight=None):
assert pred.size() == target.size() and target.numel(... | 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... | liuhuaijjin/epnet_det3d_rcnn_reg_dir_cls_iou3d_loss | SmoothL1Loss | false | 15,927 | [
"MIT"
] | 175 | 92376a99d919d983742df97bcf29eaea29afaf00 | https://github.com/liuhuaijjin/epnet_det3d_rcnn_reg_dir_cls_iou3d_loss/tree/92376a99d919d983742df97bcf29eaea29afaf00 |
CrossRegion | import torch
import torch.nn as nn
import torch.fft
class CrossRegion(nn.Module):
def __init__(self, step=1, dim=1):
super().__init__()
self.step = step
self.dim = dim
def forward(self, x):
return torch.roll(x, self.step, self.dim)
def get_inputs():
return [torch.rand([... | 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.fft
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | liuruiyang98/Jittor-MLP | CrossRegion | false | 15,928 | [
"MIT"
] | 49 | b86656b65cf5f18ba9eb760d1f7565ed95e7e96e | https://github.com/liuruiyang98/Jittor-MLP/tree/b86656b65cf5f18ba9eb760d1f7565ed95e7e96e |
CharbonnierLoss | import torch
import torch.nn as nn
from torch.nn import init as init
class CharbonnierLoss(nn.Module):
def __init__(self, loss_weight=1.0, eps=1e-06):
"""
the original eps is 1e-12
"""
super(CharbonnierLoss, self).__init__()
self.eps = eps
def forward(self, pred, targ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from t... | ljzycmd/SimDeblur | CharbonnierLoss | false | 15,929 | [
"MIT"
] | 190 | dd2f60c41176b75c4eaf80d740f547c206aa8227 | https://github.com/ljzycmd/SimDeblur/tree/dd2f60c41176b75c4eaf80d740f547c206aa8227 |
GaussianNoise | import torch
from torch import nn
import torch.cuda
import torch.backends
import torch.multiprocessing
class GaussianNoise(nn.Module):
"""Add random gaussian noise to images."""
def __init__(self, std=0.05):
super(GaussianNoise, self).__init__()
self.std = std
def forward(self, x):
... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.cuda
import torch.backends
import torch.multiprocessing
assert_size_stride = torc... | llv22/baal_tf2.4_mac | GaussianNoise | false | 15,930 | [
"Apache-2.0"
] | 575 | 6eed225f8b57e61d8d16b1868ea655384c566700 | https://github.com/llv22/baal_tf2.4_mac/tree/6eed225f8b57e61d8d16b1868ea655384c566700 |
Hidden2Discrete | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.init
class Hidden2Discrete(nn.Module):
def __init__(self, input_size, y_size, k_size, is_lstm=False, has_bias=True
):
super(Hidden2Discrete, self).__init__()
self.y_size = y_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.... | ljw23/ConvLab-2 | Hidden2Discrete | false | 15,931 | [
"Apache-2.0"
] | 339 | 13d48ea0e441701bd66100689b6c25b561f15525 | https://github.com/ljw23/ConvLab-2/tree/13d48ea0e441701bd66100689b6c25b561f15525 |
ProductOfExperts | import torch
import torch.nn as nn
class ProductOfExperts(nn.Module):
"""Return parameters for product of independent experts.
See https://arxiv.org/pdf/1410.7827.pdf for equations.
@param mu: M x D for M experts
@param logvar: M x D for M experts
"""
def forward(self, mu, logvar, eps=1e-08)... | 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... | liuyangdh/multimodal-vae-public | ProductOfExperts | false | 15,932 | [
"MIT"
] | 98 | ba5941d010b0164094f5818b93baad9df546494e | https://github.com/liuyangdh/multimodal-vae-public/tree/ba5941d010b0164094f5818b93baad9df546494e |
ResBlock1D | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResBlock1D(nn.Module):
def __init__(self, inplanes, planes, seq_len, stride=1, downsample=None):
super(ResBlock1D, self).__init__()
self.conv1 = nn.Conv1d(inplanes, planes, kernel_size=3, stride=
stride, padding=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | liuruoze/mini-AlphaStar | ResBlock1D | false | 15,933 | [
"Apache-2.0"
] | 108 | cf9de2507d526a5fb8ef67676aab2ffb92738640 | https://github.com/liuruoze/mini-AlphaStar/tree/cf9de2507d526a5fb8ef67676aab2ffb92738640 |
GlobalPerceptron | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.fft
class GlobalPerceptron(nn.Module):
def __init__(self, input_channels, internal_neurons):
super(GlobalPerceptron, self).__init__()
self.fc1 = nn.Conv2d(in_channels=input_channels, out_channels=
internal... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | liuruiyang98/Jittor-MLP | GlobalPerceptron | false | 15,934 | [
"MIT"
] | 49 | b86656b65cf5f18ba9eb760d1f7565ed95e7e96e | https://github.com/liuruiyang98/Jittor-MLP/tree/b86656b65cf5f18ba9eb760d1f7565ed95e7e96e |
RobertaSequenceClassificationHead | import torch
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class RobertaSequenceClassificationHead(nn.Module):
"""Head for sequence-level classification tasks. Ignores the <s> vector."""
def __init__(self, input_dim, inner_dim, ke... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import... | llMuShu/NEW_repstp | RobertaSequenceClassificationHead | false | 15,935 | [
"MIT"
] | 138 | 314ba30e4ab2af2b23a435db49a8eb4b89e48680 | https://github.com/llMuShu/NEW_repstp/tree/314ba30e4ab2af2b23a435db49a8eb4b89e48680 |
CosLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class CosLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, state_S, state_T, mask=None):
"""
This is the loss used in DistilBERT
:param state_S: Tensor of shape (batch_size, length, h... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | lonePatient/TorchBlocks | CosLoss | false | 15,936 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
SelfAttn | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.init
import torch as th
class SelfAttn(nn.Module):
def __init__(self, hidden_size):
super(SelfAttn, self).__init__()
self.query = nn.Linear(hidden_size, 1)
def forward(self, keys, value... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | ljw23/ConvLab-2 | SelfAttn | false | 15,937 | [
"Apache-2.0"
] | 339 | 13d48ea0e441701bd66100689b6c25b561f15525 | https://github.com/ljw23/ConvLab-2/tree/13d48ea0e441701bd66100689b6c25b561f15525 |
SeparableConv | import torch
from torch import nn
class SeparableConv(nn.Module):
def __init__(self, nb_dim, nb_out, kernel_size):
super().__init__()
self.conv1 = nn.Conv1d(nb_dim, nb_dim, kernel_size, groups=nb_dim,
padding=kernel_size // 2, bias=True)
self.conv2 = nn.Conv1d(nb_dim, nb_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | lixinsu/RCZoo | SeparableConv | false | 15,938 | [
"MIT"
] | 166 | 37fcb7962fbd4c751c561d4a0c84173881ea8339 | https://github.com/lixinsu/RCZoo/tree/37fcb7962fbd4c751c561d4a0c84173881ea8339 |
Attention | import math
import torch
from torch import nn
class Attention(nn.Module):
def __init__(self, input_size, max_seq_len):
super(Attention, self).__init__()
self.atten_w = nn.Parameter(torch.randn(max_seq_len, input_size, 1))
self.atten_bias = nn.Parameter(torch.randn(max_seq_len, 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.triton_helpers import libdevice
import math
from to... | logpai/deep-loglizer- | Attention | false | 15,939 | [
"Apache-2.0"
] | 55 | 1069a1e0e9b000e1bc9b353fb01d3d451d9a6d5d | https://github.com/logpai/deep-loglizer-/tree/1069a1e0e9b000e1bc9b353fb01d3d451d9a6d5d |
FusionLayer | import torch
from torch import nn
from torch.nn import functional as F
class FusionLayer(nn.Module):
"""
make a fusion two vectors
"""
def __init__(self, hdim):
super(FusionLayer, self).__init__()
self.linear_fusion = nn.Linear(hdim * 4, hdim)
self.linear_gate = 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.triton_helpers import libdevice
from torch import n... | lixinsu/RCZoo | FusionLayer | false | 15,940 | [
"MIT"
] | 166 | 37fcb7962fbd4c751c561d4a0c84173881ea8339 | https://github.com/lixinsu/RCZoo/tree/37fcb7962fbd4c751c561d4a0c84173881ea8339 |
VAE | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
import torch.onnx
import torch.fx
import torch.optim
import torch.utils.data.distributed
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Linear(7... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | lenaguignard/examples | VAE | false | 15,941 | [
"BSD-3-Clause"
] | 19,783 | 973e77b725a6028289a90170f0b237ea2e71d4f2 | https://github.com/lenaguignard/examples/tree/973e77b725a6028289a90170f0b237ea2e71d4f2 |
LocalResponseNorm | from torch.nn import Module
import torch
import torch.optim
from torch.nn.modules.module import Module
from torch.nn.functional import *
class LocalResponseNorm(Module):
def __init__(self, size, alpha=0.0001, beta=0.75, k=1):
"""Applies local response normalization over an input signal composed
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.triton_helpers import libdevice
from torch.nn import Module
import torch.optim
from torch.nn.modules.module imp... | leoshine/Spherical_Regression | LocalResponseNorm | false | 15,942 | [
"BSD-2-Clause-FreeBSD"
] | 133 | d19bc2f6f52982d4d58f5ddabe4231381d7facd7 | https://github.com/leoshine/Spherical_Regression/tree/d19bc2f6f52982d4d58f5ddabe4231381d7facd7 |
PyConv2 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
def conv(in_planes, out_planes, kernel_size=3, stride=1, padding=1,
dilation=1, groups=1):
"""standard convolution with padding"""
return nn.Conv2d(in_planes, out_plan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | lkf59553/pyconv | PyConv2 | false | 15,943 | [
"MIT"
] | 295 | d8b39cf43014b8fd277dcefc9eb7f8880511e977 | https://github.com/lkf59553/pyconv/tree/d8b39cf43014b8fd277dcefc9eb7f8880511e977 |
PyConv3 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
def conv(in_planes, out_planes, kernel_size=3, stride=1, padding=1,
dilation=1, groups=1):
"""standard convolution with padding"""
return nn.Conv2d(in_planes, out_plan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | lkf59553/pyconv | PyConv3 | false | 15,944 | [
"MIT"
] | 295 | d8b39cf43014b8fd277dcefc9eb7f8880511e977 | https://github.com/lkf59553/pyconv/tree/d8b39cf43014b8fd277dcefc9eb7f8880511e977 |
DenseSynthesizer | import torch
import torch.nn as nn
class DenseSynthesizer(nn.Module):
def __init__(self, head_dim, n_heads, n_tokens, big=True):
super().__init__()
h = max(head_dim, n_tokens) if big else min(head_dim, n_tokens)
w1 = torch.empty(n_heads, head_dim, h)
b1 = torch.empty(n_heads, h)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | llucid-97/dfa-scales-to-modern-deep-learning | DenseSynthesizer | false | 15,945 | [
"MIT"
] | 63 | 66efb4b4ef8a378bf01ea0e5e6794d6bb4380c97 | https://github.com/llucid-97/dfa-scales-to-modern-deep-learning/tree/66efb4b4ef8a378bf01ea0e5e6794d6bb4380c97 |
PyConv4 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
def conv(in_planes, out_planes, kernel_size=3, stride=1, padding=1,
dilation=1, groups=1):
"""standard convolution with padding"""
return nn.Conv2d(in_planes, out_plan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | lkf59553/pyconv | PyConv4 | false | 15,946 | [
"MIT"
] | 295 | d8b39cf43014b8fd277dcefc9eb7f8880511e977 | https://github.com/lkf59553/pyconv/tree/d8b39cf43014b8fd277dcefc9eb7f8880511e977 |
AttMseLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttMseLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, attention_S, attention_T, mask=None):
"""
Calculate the mse loss between attention_S and attention_T.
:param logits_S: Ten... | 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... | lonePatient/TorchBlocks | AttMseLoss | false | 15,947 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
DecoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | liuruoze/mini-AlphaStar | DecoderLayer | false | 15,948 | [
"Apache-2.0"
] | 108 | cf9de2507d526a5fb8ef67676aab2ffb92738640 | https://github.com/liuruoze/mini-AlphaStar/tree/cf9de2507d526a5fb8ef67676aab2ffb92738640 |
AvgPoolWithMask | import torch
import torch.nn as nn
class AvgPoolWithMask(nn.Module):
"""
给定形如[batch_size, max_len, hidden_size]的输入,在最后一维进行avg pooling. 输出为[batch_size, hidden_size], pooling
的时候只会考虑mask为1的位置
"""
def __init__(self):
super(AvgPoolWithMask, self).__init__()
self.inf = 10000000000000.0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | lonePatient/TorchBlocks | AvgPoolWithMask | false | 15,949 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
Gate | import torch
import torch.nn as nn
import torch.nn.functional as F
class Gate(nn.Module):
"""Gate Unit
g = sigmoid(Wx)
x = g * x
"""
def __init__(self, input_size, dropout_rate=0.0):
super(Gate, self).__init__()
self.linear = nn.Linear(input_size, input_size, bias=False)
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... | lonePatient/TorchBlocks | Gate | false | 15,950 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
KL | import torch
import torch.nn as nn
import torch.nn.functional as F
class KL(nn.Module):
def __init__(self, reduction='batchmean'):
super(KL, self).__init__()
self.reduction = reduction
def forward(self, input, target):
input = input.float()
target = target.float()
los... | 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... | lonePatient/TorchBlocks | KL | false | 15,951 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
StochasticGate | import torch
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
class StochasticGate(nn.Module):
"""Stochastically merges features from two levels
with varying size of the receptive field
"""
def __init__(self):
super(StochasticGate, self).__i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | loserbbb/1-stage-wseg | StochasticGate | false | 15,952 | [
"Apache-2.0"
] | 364 | f1579be241986c1e19420bfbf6711b6c2208d99a | https://github.com/loserbbb/1-stage-wseg/tree/f1579be241986c1e19420bfbf6711b6c2208d99a |
NormKLLoss | import torch
import torch.utils.data
import torch.nn.init
import torch as th
from torch.nn.modules.loss import _Loss
class NormKLLoss(_Loss):
def __init__(self, unit_average=False):
super(NormKLLoss, self).__init__()
self.unit_average = unit_average
def forward(self, recog_mu, recog_logvar, ... | 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.utils.data
import torch.nn.init
from torch.nn.modules.loss i... | ljw23/ConvLab-2 | NormKLLoss | false | 15,953 | [
"Apache-2.0"
] | 339 | 13d48ea0e441701bd66100689b6c25b561f15525 | https://github.com/ljw23/ConvLab-2/tree/13d48ea0e441701bd66100689b6c25b561f15525 |
AttCeLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttCeLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, attention_S, attention_T, mask=None):
"""
Calculate the cross entropy between attention_S and attention_T.
:param logits_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
... | lonePatient/TorchBlocks | AttCeLoss | false | 15,954 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
MaskedConv1d | import torch
import torch.nn as nn
class MaskedConv1d(nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, dilation=1,
groups=1, bias=True, causal=True):
if causal:
padding = (kernel_size - 1) * dilation
else:
padding = (kernel_size - 1) * dilatio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | lonePatient/TorchBlocks | MaskedConv1d | false | 15,955 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
CosAttention | import torch
import torch.nn as nn
class CosAttention(nn.Module):
def __init__(self):
super(CosAttention, self).__init__()
def forward(self, q, k, v):
"""
q: (batchsize, hidden_dim)
k: (batchsize, seqlen, hidden_dim)
v: (batchsize, seqlen, hidden_dim)
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | lonePatient/TorchBlocks | CosAttention | false | 15,956 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
MultiSampleDropout | import torch
import torch.nn as nn
class MultiSampleDropout(nn.Module):
"""
# multisample dropout (wut): https://arxiv.org/abs/1905.09788
"""
def __init__(self, hidden_size, num_labels, K=5, p=0.5):
super().__init__()
self.K = K
self.dropout = nn.Dropout(p)
self.classi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | lonePatient/TorchBlocks | MultiSampleDropout | false | 15,957 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
MaxPoolWithMask | import torch
import torch.nn as nn
class MaxPoolWithMask(nn.Module):
"""
带mask矩阵的max pooling。在做max-pooling的时候不会考虑mask值为0的位置。
"""
def __init__(self):
super(MaxPoolWithMask, self).__init__()
self.inf = 10000000000000.0
def forward(self, tensor, mask, dim=1):
"""
:pa... | 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... | lonePatient/TorchBlocks | MaxPoolWithMask | false | 15,958 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
KdMseLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class KdMseLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logits_S, logits_T, temperature=1):
"""
Calculate the mse loss between logits_S and logits_T
:param logits_S: Tensor of sha... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | lonePatient/TorchBlocks | KdMseLoss | false | 15,959 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
SKL | import torch
import torch.nn as nn
import torch.nn.functional as F
class SKL(nn.Module):
def __init__(self, epsilon=1e-08):
super(SKL, self).__init__()
self.epsilon = epsilon
def forward(self, input, target):
logit = input.view(-1, input.size(-1)).float()
target = target.view... | 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
... | lonePatient/TorchBlocks | SKL | false | 15,960 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
NetVLAD | import torch
import torch.nn.functional as func
import torch.nn as nn
class NetVLAD(nn.Module):
"""
NetVLAD layer implementation
Credits: https://github.com/lyakaap/NetVLAD-pytorch
"""
def __init__(self, num_clusters=64, dim=128, alpha=100.0,
normalize_input=True):
"""
Arg... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | liuyuzhenn/LISRD | NetVLAD | false | 15,961 | [
"MIT"
] | 225 | bfd890b81defebea971db0b744be617ed58f5ffa | https://github.com/liuyuzhenn/LISRD/tree/bfd890b81defebea971db0b744be617ed58f5ffa |
GaussianSmearing | import torch
from torch import nn
class GaussianSmearing(nn.Module):
def __init__(self, cutoff_lower=0.0, cutoff_upper=5.0, num_rbf=50,
trainable=True):
super(GaussianSmearing, self).__init__()
self.cutoff_lower = cutoff_lower
self.cutoff_upper = cutoff_upper
self.num_rbf ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | lsnty5190/torchmd-net | GaussianSmearing | false | 15,962 | [
"MIT"
] | 51 | 0bedf43801f0c7d38900d8e1db778fe69f3a4d01 | https://github.com/lsnty5190/torchmd-net/tree/0bedf43801f0c7d38900d8e1db778fe69f3a4d01 |
GatedConv1d | import torch
import torch.nn as nn
class MaskedConv1d(nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, dilation=1,
groups=1, bias=True, causal=True):
if causal:
padding = (kernel_size - 1) * dilation
else:
padding = (kernel_size - 1) * dilatio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | lonePatient/TorchBlocks | GatedConv1d | false | 15,963 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
ExpNormalSmearing | import math
import torch
from torch import nn
class CosineCutoff(nn.Module):
def __init__(self, cutoff_lower=0.0, cutoff_upper=5.0):
super(CosineCutoff, self).__init__()
self.cutoff_lower = cutoff_lower
self.cutoff_upper = cutoff_upper
def forward(self, distances):
if self.cu... | 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 math
from torch import nn
assert_size_stride = torch._C._dynamo.gu... | lsnty5190/torchmd-net | ExpNormalSmearing | false | 15,964 | [
"MIT"
] | 51 | 0bedf43801f0c7d38900d8e1db778fe69f3a4d01 | https://github.com/lsnty5190/torchmd-net/tree/0bedf43801f0c7d38900d8e1db778fe69f3a4d01 |
TripletLoss | import torch
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 TripletLoss(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a positive sample and a negative sample
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data... | lxy5513/cvToolkit | TripletLoss | false | 15,965 | [
"MIT"
] | 47 | 51586c8016b47f5e7852032f9f3211c89d80f537 | https://github.com/lxy5513/cvToolkit/tree/51586c8016b47f5e7852032f9f3211c89d80f537 |
AxialPositionalEmbedding | import torch
from torch import nn
class AxialPositionalEmbedding(nn.Module):
def __init__(self, dim, shape, emb_dim_index=1):
super().__init__()
total_dimensions = len(shape) + 2
ax_dim_indexes = [i for i in range(1, total_dimensions) if i !=
emb_dim_index]
self.num_ax... | 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... | lucidrains/axial-attention | AxialPositionalEmbedding | false | 15,966 | [
"MIT"
] | 189 | eff2c10c2e76c735a70a6b995b571213adffbbb7 | https://github.com/lucidrains/axial-attention/tree/eff2c10c2e76c735a70a6b995b571213adffbbb7 |
AttCeMeanLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttCeMeanLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, attention_S, attention_T, mask=None):
"""
Calculate the cross entropy between attention_S and attention_T, the dim of num_heads... | 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
... | lonePatient/TorchBlocks | AttCeMeanLoss | false | 15,967 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
LayerNormChan | import torch
from torch import nn
class LayerNormChan(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):
var = torch.v... | 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... | lucidrains/nuwa-pytorch | LayerNormChan | false | 15,968 | [
"MIT"
] | 310 | bf1f3dc1126ba0a24a280bd7412a8082e5013b46 | https://github.com/lucidrains/nuwa-pytorch/tree/bf1f3dc1126ba0a24a280bd7412a8082e5013b46 |
KdCeLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class KdCeLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logits_S, logits_T, temperature=1):
"""
Calculate the cross entropy between logits_S and logits_T
:param logits_S: Tensor of... | 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
... | lonePatient/TorchBlocks | KdCeLoss | false | 15,969 | [
"MIT"
] | 82 | 4a65d746cc8a396cb7df73ed4644d97ddf843e29 | https://github.com/lonePatient/TorchBlocks/tree/4a65d746cc8a396cb7df73ed4644d97ddf843e29 |
BCNN | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class BCNN(nn.Module):
"""Bilinear Pool
implementation of Bilinear CNN (BCNN)
https://arxiv.org/abs/1504.07889v5
Args:
thresh: small positive nu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | lvyilin/fast-MPN-COV | BCNN | false | 15,970 | [
"MIT"
] | 257 | d21c3fd2863c12f885faf20bd177dc066a25856c | https://github.com/lvyilin/fast-MPN-COV/tree/d21c3fd2863c12f885faf20bd177dc066a25856c |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, smooth=1.0, eps=1e-07):
super(DiceLoss, self).__init__()
self.smooth = smooth
self.eps = eps
def forward(self, output, target):
output = torch.sigmoid(output)
if torch.sum(target) == 0:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | lyakaap/pytorch-template | DiceLoss | false | 15,971 | [
"MIT"
] | 140 | eff9f0a4dd50fa49c3b949065247598d5eabc91e | https://github.com/lyakaap/pytorch-template/tree/eff9f0a4dd50fa49c3b949065247598d5eabc91e |
Truncation2D | import torch
class Truncation2D(torch.nn.Module):
"""
A module merging the last two dimensions, merging coarse scale in grid
of dimensions -4, -3 and finer resolution in dimensions -2, -1 to
one fine grained grid with two dimensions less.
"""
def __init__(self):
super().__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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | kpoeppel/pytorch_probgraph | Truncation2D | false | 15,972 | [
"BSD-3-Clause"
] | 47 | b78595ab03bbe92595ad2f6b35f5dd8bf84d6da0 | https://github.com/kpoeppel/pytorch_probgraph/tree/b78595ab03bbe92595ad2f6b35f5dd8bf84d6da0 |
PAM_Module | import torch
import torch.utils.data
from torch import nn
class PAM_Module(nn.Module):
""" Position attention module"""
def __init__(self, in_dim):
super(PAM_Module, self).__init__()
self.chanel_in = in_dim
self.query_conv = nn.Conv2d(in_channels=in_dim, out_channels=in_dim //
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | lzrobots/dgmn | PAM_Module | false | 15,973 | [
"MIT"
] | 54 | 515476b5c6a07dcc3b7a4d2243c541377624bb33 | https://github.com/lzrobots/dgmn/tree/515476b5c6a07dcc3b7a4d2243c541377624bb33 |
resnet_block | import torch
import torch.nn as nn
import torch.nn.functional as F
class resnet_block(nn.Module):
def __init__(self, ef_dim):
super(resnet_block, self).__init__()
self.ef_dim = ef_dim
self.conv_1 = nn.Conv3d(self.ef_dim, self.ef_dim, 1, stride=1,
padding=0, bias=True)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | lwkobe/NMC | resnet_block | false | 15,974 | [
"MIT"
] | 74 | a59c187d35b2f929ea3a94fc2b434061d7f7993a | https://github.com/lwkobe/NMC/tree/a59c187d35b2f929ea3a94fc2b434061d7f7993a |
StableLayerNorm | import torch
from torch import nn
class StableLayerNorm(nn.Module):
def __init__(self, dim):
super().__init__()
self.norm = nn.LayerNorm(dim)
def forward(self, x):
x = x / x.amax(dim=-1, keepdim=True).detach()
return self.norm(x)
def get_inputs():
return [torch.rand([4,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_... | lucidrains/nuwa-pytorch | StableLayerNorm | false | 15,975 | [
"MIT"
] | 310 | bf1f3dc1126ba0a24a280bd7412a8082e5013b46 | https://github.com/lucidrains/nuwa-pytorch/tree/bf1f3dc1126ba0a24a280bd7412a8082e5013b46 |
DDM_Decoder | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
weight_shape = list(m.weight.data.size())
fan_in = np.prod(weight_shape[1:4])
fan_ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | lysuk96/rl_representations | DDM_Decoder | false | 15,976 | [
"MIT"
] | 438 | 19de69305e40c9b3a1d746a7af26d232c9fb3f6f | https://github.com/lysuk96/rl_representations/tree/19de69305e40c9b3a1d746a7af26d232c9fb3f6f |
FinalTanh | import torch
class FinalTanh(torch.nn.Module):
def __init__(self, input_channels, hidden_channels,
hidden_hidden_channels, num_hidden_layers):
super(FinalTanh, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
self.hidden_hidden_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.... | lysuk96/rl_representations | FinalTanh | false | 15,977 | [
"MIT"
] | 438 | 19de69305e40c9b3a1d746a7af26d232c9fb3f6f | https://github.com/lysuk96/rl_representations/tree/19de69305e40c9b3a1d746a7af26d232c9fb3f6f |
MixLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
from itertools import filterfalse
def flatten_binary_scores(scores, labels, ignore=None):
"""
Flattens predictions in the batch (binary case)
Remove labels equal to 'ignore'
"""
scores = scores.view(-1)
labels = labels.view(-1)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | lyakaap/pytorch-template | MixLoss | false | 15,978 | [
"MIT"
] | 140 | eff9f0a4dd50fa49c3b949065247598d5eabc91e | https://github.com/lyakaap/pytorch-template/tree/eff9f0a4dd50fa49c3b949065247598d5eabc91e |
ResidualBlockNoBN | import torch
import torch.nn as nn
from torch.nn import init as init
from torch.nn.modules.batchnorm import _BatchNorm
@torch.no_grad()
def default_init_weights(module_list, scale=1, bias_fill=0, **kwargs):
"""Initialize network weights.
Args:
module_list (list[nn.Module] | nn.Module): Modules to be ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | ljzycmd/SimDeblur | ResidualBlockNoBN | false | 15,979 | [
"MIT"
] | 190 | dd2f60c41176b75c4eaf80d740f547c206aa8227 | https://github.com/ljzycmd/SimDeblur/tree/dd2f60c41176b75c4eaf80d740f547c206aa8227 |
_GRU_ODE | import torch
class _GRU_ODE(torch.nn.Module):
def __init__(self, input_channels, hidden_channels):
super(_GRU_ODE, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
self.W_r = torch.nn.Linear(input_channels, hidden_channels, bias=False)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride ... | lysuk96/rl_representations | _GRU_ODE | false | 15,980 | [
"MIT"
] | 438 | 19de69305e40c9b3a1d746a7af26d232c9fb3f6f | https://github.com/lysuk96/rl_representations/tree/19de69305e40c9b3a1d746a7af26d232c9fb3f6f |
baseRNN_predict | import torch
import numpy as np
import torch.nn as nn
import torch.nn.init as init
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
weight_shape = list(m.weight.data.size())
fan_in = np.prod(weight_shape[1:4])
fan_out = np.prod(weight_shape[2: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 numpy as np
import tor... | lysuk96/rl_representations | baseRNN_predict | false | 15,981 | [
"MIT"
] | 438 | 19de69305e40c9b3a1d746a7af26d232c9fb3f6f | https://github.com/lysuk96/rl_representations/tree/19de69305e40c9b3a1d746a7af26d232c9fb3f6f |
SparseDownSampleClose | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class SparseDownSampleClose(nn.Module):
def __init__(self, stride):
super(SparseDownSampleClose, self).__init__()
self.pooling = nn.MaxPool2d(stride, stride)
self.large_number = 600
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | maciej-3/PENet_ICRA2021 | SparseDownSampleClose | false | 15,982 | [
"MIT"
] | 155 | 40b5b20fb5d64455f8964045204fa9e7629d0c8c | https://github.com/maciej-3/PENet_ICRA2021/tree/40b5b20fb5d64455f8964045204fa9e7629d0c8c |
DynamicWeights | import torch
import torch.utils.data
from torch import nn
class DynamicWeights(nn.Module):
def __init__(self, channels):
super(DynamicWeights, self).__init__()
self.cata = nn.Conv2d(channels, 9, 3, padding=1, bias=False)
self.softmax = nn.Softmax(dim=-1)
self.unfold1 = nn.Unfold(k... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | lzrobots/dgmn | DynamicWeights | false | 15,983 | [
"MIT"
] | 54 | 515476b5c6a07dcc3b7a4d2243c541377624bb33 | https://github.com/lzrobots/dgmn/tree/515476b5c6a07dcc3b7a4d2243c541377624bb33 |
DDM_Encoder | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
weight_shape = list(m.weight.data.size())
fan_in = np.prod(weight_shape[1:4])
fan_ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | lysuk96/rl_representations | DDM_Encoder | false | 15,984 | [
"MIT"
] | 438 | 19de69305e40c9b3a1d746a7af26d232c9fb3f6f | https://github.com/lysuk96/rl_representations/tree/19de69305e40c9b3a1d746a7af26d232c9fb3f6f |
SingleHiddenLayer | import torch
class SingleHiddenLayer(torch.nn.Module):
def __init__(self, input_channels, hidden_channels):
super(SingleHiddenLayer, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
self.linear1 = torch.nn.Linear(hidden_channels, 128)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | lysuk96/rl_representations | SingleHiddenLayer | false | 15,985 | [
"MIT"
] | 438 | 19de69305e40c9b3a1d746a7af26d232c9fb3f6f | https://github.com/lysuk96/rl_representations/tree/19de69305e40c9b3a1d746a7af26d232c9fb3f6f |
GeometryFeature | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class GeometryFeature(nn.Module):
def __init__(self):
super(GeometryFeature, self).__init__()
def forward(self, z, vnorm, unorm, h, w, ch, cw, fh, fw):
x = z * (0.5 * h * (vnorm + 1) - ch) ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | maciej-3/PENet_ICRA2021 | GeometryFeature | false | 15,986 | [
"MIT"
] | 155 | 40b5b20fb5d64455f8964045204fa9e7629d0c8c | https://github.com/maciej-3/PENet_ICRA2021/tree/40b5b20fb5d64455f8964045204fa9e7629d0c8c |
SelfAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class SelfAttention(nn.Module):
def __init__(self, hidden_size, attention_size=100, n_attention_heads=1):
super().__init__()
self.hidden_size = hidden_size
self.attention_size = attention_size
self.n_attention_head... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | maltevogl/CVDD-PyTorch | SelfAttention | false | 15,987 | [
"MIT"
] | 48 | 9299894720a8d3d0a329d92c9d2702f43112ff63 | https://github.com/maltevogl/CVDD-PyTorch/tree/9299894720a8d3d0a329d92c9d2702f43112ff63 |
MLP | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
from torch.nn import Parameter
from torch.nn.parameter import Parameter
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class Conv1D(nn.Module):
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | mandaltanmoy1938/VisualGPT | MLP | false | 15,988 | [
"MIT"
] | 86 | 9ba78948282fdca502d5030f4eccc3df562982c3 | https://github.com/mandaltanmoy1938/VisualGPT/tree/9ba78948282fdca502d5030f4eccc3df562982c3 |
FC_Q | import torch
import torch.nn as nn
import torch.nn.functional as F
class FC_Q(nn.Module):
def __init__(self, state_dim, num_actions, num_nodes=128):
super(FC_Q, self).__init__()
self.q1 = nn.Linear(state_dim, num_nodes)
self.q2 = nn.Linear(num_nodes, num_nodes)
self.q3 = 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
from torch._inductor.runtime.... | lysuk96/rl_representations | FC_Q | false | 15,989 | [
"MIT"
] | 438 | 19de69305e40c9b3a1d746a7af26d232c9fb3f6f | https://github.com/lysuk96/rl_representations/tree/19de69305e40c9b3a1d746a7af26d232c9fb3f6f |
KLDivLoss | import torch
from torchvision.transforms import *
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class KLDivLoss(nn.Module):
def __init__(self):
super(KLDivLoss, self).__init__()
def forward(self, pred, label):
T = 3
predict = F.log_softmax(... | 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 torchvision.trans... | mangye16/Cross-Modal-Re-ID-baseline | KLDivLoss | false | 15,990 | [
"MIT"
] | 249 | 26bc0ce088eb97867ff489dceda386b8092b9fde | https://github.com/mangye16/Cross-Modal-Re-ID-baseline/tree/26bc0ce088eb97867ff489dceda386b8092b9fde |
DRS | import torch
import torch.nn as nn
class DRS(nn.Module):
"""
DRS non-learnable setting
hyperparameter O , additional training paramters X
"""
def __init__(self, delta):
super(DRS, self).__init__()
self.relu = nn.ReLU()
self.delta = delta
self.global_max_pool = nn.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | manideep1108/DRS | DRS | false | 15,991 | [
"MIT"
] | 62 | 0858c3ffea310e9d504b7c2b06db5f281273df56 | https://github.com/manideep1108/DRS/tree/0858c3ffea310e9d504b7c2b06db5f281273df56 |
VGG16 | import torch
import numpy as np
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
class Normalize:
def __init__(self, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)):
self.mean = mean
self.std = std
def undo(self, imgarr):
proc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | loserbbb/1-stage-wseg | VGG16 | false | 15,992 | [
"Apache-2.0"
] | 364 | f1579be241986c1e19420bfbf6711b6c2208d99a | https://github.com/loserbbb/1-stage-wseg/tree/f1579be241986c1e19420bfbf6711b6c2208d99a |
CrossPooling | import torch
import torch.nn as nn
class CrossPooling(nn.Module):
""" Cross pooling """
def forward(self, x):
""" Forward function of CrossPooling module.
Args:
x: a stack of (batch x channel x height x width) tensors on the last axis.
Returns:
A (batch x channel x height x widt... | 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... | manipopopo/C5 | CrossPooling | false | 15,993 | [
"Apache-2.0"
] | 51 | 154eb38c330e65476ddb77836948a28237f23c88 | https://github.com/manipopopo/C5/tree/154eb38c330e65476ddb77836948a28237f23c88 |
CausalAttentionSortNet | import torch
from torch.nn import functional as F
from torch import nn
def bucket(buckets, t, dim=1):
shape = list(t.shape)
shape[dim:dim + 1] = [buckets, -1]
return t.reshape(*shape)
def differentiable_topk(x, k, temperature=1.0):
*_, n, dim = x.shape
topk_tensors = []
for i in range(k):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | lucidrains/sinkhorn-transformer | CausalAttentionSortNet | false | 15,994 | [
"MIT"
] | 216 | 531bdbe46dfc2abd20183dbcede669bc9df567c6 | https://github.com/lucidrains/sinkhorn-transformer/tree/531bdbe46dfc2abd20183dbcede669bc9df567c6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.