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 |
|---|---|---|---|---|---|---|---|---|---|---|
AspectMean | import torch
import torch.nn as nn
class AspectMean(nn.Module):
def __init__(self, max_sen_len):
"""
:param max_sen_len: maximum length of sentence
"""
super(AspectMean, self).__init__()
self.max_sen_len = max_sen_len
def forward(self, aspect):
"""
:p... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | williamSYSU/ABSA-william | AspectMean | false | 4,538 | [
"MIT"
] | 0 | 84ccd3dca00e84c7fefadb9f5835216b2c4fe1df | https://github.com/williamSYSU/ABSA-william/tree/84ccd3dca00e84c7fefadb9f5835216b2c4fe1df |
ComplexConv | import torch
import torch.nn as nn
class ComplexConv(nn.Module):
def __init__(self, rank, in_channels, out_channels, kernel_size, stride
=1, padding=0, output_padding=0, dilation=1, groups=1, bias=True,
normalize_weight=False, epsilon=1e-07, conv_transposed=False):
super(ComplexConv, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | wizofe/urus-mri-recon | ComplexConv | false | 4,539 | [
"MIT"
] | 0 | eab8e48dca31d2b936ce69ccc251ec5a4a10facc | https://github.com/wizofe/urus-mri-recon/tree/eab8e48dca31d2b936ce69ccc251ec5a4a10facc |
TotalVariations | import torch
from torch.nn.modules.loss import _Loss
class TotalVariations(_Loss):
def forward(self, img1):
return torch.sum(torch.abs(img1[:, :, :-1] - img1[:, :, 1:])
) + torch.sum(torch.abs(img1[:, :-1, :] - img1[:, 1:, :]))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def g... | 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.nn.modules.loss import _Loss
assert_size_stride = torch._C._dy... | wizofe/urus-mri-recon | TotalVariations | false | 4,540 | [
"MIT"
] | 0 | eab8e48dca31d2b936ce69ccc251ec5a4a10facc | https://github.com/wizofe/urus-mri-recon/tree/eab8e48dca31d2b936ce69ccc251ec5a4a10facc |
CenteredL1Loss | import torch
from torch.nn.functional import l1_loss
class CenteredL1Loss(torch.nn.Module):
def __init__(self, margin):
super(CenteredL1Loss, self).__init__()
self.m = margin
def forward(self, true, preds):
return l1_loss(preds[:, :, self.m:-self.m, self.m:-self.m], true[:,
... | 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... | wsdea/EfficientSR | CenteredL1Loss | false | 4,541 | [
"MIT"
] | 0 | 077dea18c90e0d5bed722c609a776033c09f80e6 | https://github.com/wsdea/EfficientSR/tree/077dea18c90e0d5bed722c609a776033c09f80e6 |
ZReLU | import torch
import numpy as np
import torch.nn as nn
def cylindricalToPolarConversion(input1, input2=None):
if input2 is None:
"""input1 is tensor of [B,C,H,W,D,2] contains both real and imaginary channels
in the last dims"""
ndims = input1.ndimension()
real_input = input1.narrow... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | wizofe/urus-mri-recon | ZReLU | false | 4,542 | [
"MIT"
] | 0 | eab8e48dca31d2b936ce69ccc251ec5a4a10facc | https://github.com/wizofe/urus-mri-recon/tree/eab8e48dca31d2b936ce69ccc251ec5a4a10facc |
ModReLU | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
def magnitude(input):
if input.ndimension() == 4:
return (input[:, :, :, 0] ** 2 + input[:, :, :, 1] ** 2) ** 0.5
elif input.ndimension() == 5:
return (input[:, :, :, :, 0] ** 2 + input[:, :, :, :, 1] ** 2) ** 0.5
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from torch.nn.parameter import Parameter
assert_size_stri... | wizofe/urus-mri-recon | ModReLU | false | 4,543 | [
"MIT"
] | 0 | eab8e48dca31d2b936ce69ccc251ec5a4a10facc | https://github.com/wizofe/urus-mri-recon/tree/eab8e48dca31d2b936ce69ccc251ec5a4a10facc |
PointLoss | import torch
import torch.nn as nn
def array2samples_distance(array1, array2):
"""
arguments:
array1: the array, size: (num_point, num_feature)
array2: the samples, size: (num_point, num_feature)
returns:
distances: each entry is the distance from a sample to array1
"""
n... | 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... | wendydidi/MISO-PCN | PointLoss | false | 4,544 | [
"MIT"
] | 0 | fdb8ed80d16ed5d019c3ca85e26ce23884067c0d | https://github.com/wendydidi/MISO-PCN/tree/fdb8ed80d16ed5d019c3ca85e26ce23884067c0d |
Dueling_DQN | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class Dueling_DQN(nn.Module):
def __init__(self, args):
super().__init__()
self.state_space = args.state_space
self.fc1 = nn.Linear(self.state_space, args.hidden_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | wotmd5731/pseudo_random_gen | Dueling_DQN | false | 4,545 | [
"MIT"
] | 0 | f79810cd5ac79afe0a73dee73aa21bd8c01aeb9b | https://github.com/wotmd5731/pseudo_random_gen/tree/f79810cd5ac79afe0a73dee73aa21bd8c01aeb9b |
DQN | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
def __init__(self, args):
super().__init__()
self.state_space = args.state_space
self.fc1 = nn.Linear(self.state_space, args.hidden_size)
self.fc2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | wotmd5731/pseudo_random_gen | DQN | false | 4,547 | [
"MIT"
] | 0 | f79810cd5ac79afe0a73dee73aa21bd8c01aeb9b | https://github.com/wotmd5731/pseudo_random_gen/tree/f79810cd5ac79afe0a73dee73aa21bd8c01aeb9b |
NearestNeighbourx4 | import torch
import torch.nn as nn
import torch.nn.functional as F
class NearestNeighbourx4(nn.Module):
def __init__(self, nf, bias, custom_init=False):
super(NearestNeighbourx4, self).__init__()
self.conv0 = nn.Conv2d(nf, nf, 3, 1, 1, bias=bias)
self.conv1 = nn.Conv2d(nf, nf, 3, 1, 1, bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | wsdea/EfficientSR | NearestNeighbourx4 | false | 4,548 | [
"MIT"
] | 0 | 077dea18c90e0d5bed722c609a776033c09f80e6 | https://github.com/wsdea/EfficientSR/tree/077dea18c90e0d5bed722c609a776033c09f80e6 |
Synthesis_prior_net | import math
import torch
import torch.nn as nn
import torch.utils.data
class Synthesis_prior_net(nn.Module):
"""
Decode synthesis prior
"""
def __init__(self, out_channel_N=192, out_channel_M=320):
super(Synthesis_prior_net, self).__init__()
self.deconv1 = nn.ConvTranspose2d(out_chann... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
import torch.utils.data
assert_size_stride = t... | wemozj/Image-Compression-based-GMM-and-Attention-Module | Synthesis_prior_net | false | 4,549 | [
"Apache-2.0"
] | 0 | 93f804dbcea8ffc1621456f3d104d0342c75373b | https://github.com/wemozj/Image-Compression-based-GMM-and-Attention-Module/tree/93f804dbcea8ffc1621456f3d104d0342c75373b |
baseline_upscale | import torch
import torch.nn as nn
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, torch.nn.Conv2d):
init.kaiming_normal_(m.weight, a=0, 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
import torch.nn as nn
import torch.nn.init as init
assert_size_stride = torch._C... | wsdea/EfficientSR | baseline_upscale | false | 4,550 | [
"MIT"
] | 0 | 077dea18c90e0d5bed722c609a776033c09f80e6 | https://github.com/wsdea/EfficientSR/tree/077dea18c90e0d5bed722c609a776033c09f80e6 |
QueryEncoding | import torch
import torch.nn as nn
class QueryEncoding(nn.Module):
def __init__(self, d_model):
super(QueryEncoding, self).__init__()
self.pe = nn.Embedding(2, d_model)
def forward(self, x):
B, N, L, _K = x.shape
idx = torch.ones((B, N, L), device=x.device).long()
idx... | 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... | wukevin/RoseTTAFold | QueryEncoding | false | 4,551 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
PCN1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class PCN1(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=2, dilation=1)
self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=2)
self.conv3 = nn.Conv2d(32, 64... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wkdhkr/pytorch-PCN | PCN1 | false | 4,552 | [
"BSD-2-Clause"
] | 0 | 4686c8fcda0b4fe7ecd7488f5554e19e8f6a8f68 | https://github.com/wkdhkr/pytorch-PCN/tree/4686c8fcda0b4fe7ecd7488f5554e19e8f6a8f68 |
LinearNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class LinearNet(nn.Module):
def __init__(self, n_feature, n_output):
super(LinearNet, self).__init__()
self.fc1 = nn.Linear(n_feature, 256)
self.fc2 = nn.Linear(256, 512)
self.fc3 = nn.Linear(512, 1024)
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_... | wslerry/regresstorch | LinearNet | false | 4,553 | [
"MIT"
] | 0 | b2e3507d8ed794e5d1d75ebfe910f74bbcb9a06b | https://github.com/wslerry/regresstorch/tree/b2e3507d8ed794e5d1d75ebfe910f74bbcb9a06b |
ResidualDenseBlock_3C | import torch
import torch.nn as nn
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, torch.nn.Conv2d):
init.kaiming_normal_(m.weight, a=0, 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
import torch.nn as nn
import torch.nn.init as init
assert_size_stride = torch._C... | wsdea/EfficientSR | ResidualDenseBlock_3C | false | 4,554 | [
"MIT"
] | 0 | 077dea18c90e0d5bed722c609a776033c09f80e6 | https://github.com/wsdea/EfficientSR/tree/077dea18c90e0d5bed722c609a776033c09f80e6 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-05):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(d_model))
self.b_2 = nn.Parameter(torch.zeros(d_model))
self.eps = eps
def forward(self, x):
mea... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | wukevin/RoseTTAFold | LayerNorm | false | 4,555 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
MultiHeadAttention | import torch
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, temperature, dropout=0.1):
super(ScaledDotProductAttention, self).__init__()
self.temperature = temperature
self.dropout = nn.Dropout(p=dropout)
def forward(self, q, k, v, mask=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.... | wu0004in/vedastr | MultiHeadAttention | false | 4,557 | [
"Apache-2.0"
] | 0 | 83511a408b68c264561a30daff5154cd0148bebd | https://github.com/wu0004in/vedastr/tree/83511a408b68c264561a30daff5154cd0148bebd |
FFN | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class FC(nn.Module):
def __init__(self, in_size, out_size, dropout_rate=0.0, use_relu=True):
super(FC, self).__init__()
self.dropout_r = dropout_rate
self.use_relu = use_relu
self.linear = nn.Linear(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
import torch.nn as nn
assert_... | Originofamonia/mcan-vqa | FFN | false | 4,558 | [
"Apache-2.0"
] | 0 | e7e9fdc654d72dbbcbc03e43ae8a59c16b6d10d1 | https://github.com/Originofamonia/mcan-vqa/tree/e7e9fdc654d72dbbcbc03e43ae8a59c16b6d10d1 |
CoevolExtractor | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-05):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(d_model))
self.b_2 = nn.Parameter(torch.zeros(d_model))
self.eps = eps
def forward(self, x):
mea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | wukevin/RoseTTAFold | CoevolExtractor | false | 4,559 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
DirectMultiheadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class DirectMultiheadAttention(nn.Module):
def __init__(self, d_in, d_out, heads, dropout=0.1):
super(DirectMultiheadAttention, self).__init__()
self.heads = heads
self.proj_pair = nn.Linear(d_in, heads)
self.drop ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | DirectMultiheadAttention | false | 4,560 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
PVABlock | import torch
import torch.nn as nn
def constant_init(module, val, bias=0):
nn.init.constant_(module.weight, val)
if hasattr(module, 'bias') and module.bias is not None:
nn.init.constant_(module.bias, bias)
def kaiming_init(module, a=0, is_rnn=False, mode='fan_in', nonlinearity=
'leaky_relu', bia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wu0004in/vedastr | PVABlock | false | 4,561 | [
"Apache-2.0"
] | 0 | 83511a408b68c264561a30daff5154cd0148bebd | https://github.com/wu0004in/vedastr/tree/83511a408b68c264561a30daff5154cd0148bebd |
MultiheadAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiheadAttention(nn.Module):
def __init__(self, d_model, heads, k_dim=None, v_dim=None, dropout=0.1):
super(MultiheadAttention, self).__init__()
if k_dim is None:
k_dim = d_model
if v_dim is... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | MultiheadAttention | false | 4,562 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
MaskedDirectMultiheadAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MaskedDirectMultiheadAttention(nn.Module):
def __init__(self, d_in, d_out, heads, d_k=32, dropout=0.1):
super(MaskedDirectMultiheadAttention, self).__init__()
self.heads = heads
self.scaling = 1 / math.sq... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | MaskedDirectMultiheadAttention | false | 4,563 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
SequenceWeight | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class SequenceWeight(nn.Module):
def __init__(self, d_model, heads, dropout=0.1):
super(SequenceWeight, self).__init__()
self.heads = heads
self.d_model = d_model
self.d_k = d_model // heads
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.... | wukevin/RoseTTAFold | SequenceWeight | false | 4,564 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
MFM2_1 | import torch
class MFM2_1(torch.nn.Module):
"""Max-Feature-Map (MFM) 2/1 operation. """
def forward(self, input):
input = input.reshape((input.shape[0], 2, -1, *input.shape[2:]))
output = input.max(dim=1)[0]
return output
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | x6rulin/TP-GAN | MFM2_1 | false | 4,565 | [
"MIT"
] | 0 | 1716cf06aaff8a6a2cee2548ec662dcdd68c0449 | https://github.com/x6rulin/TP-GAN/tree/1716cf06aaff8a6a2cee2548ec662dcdd68c0449 |
Spatial_Attention_layer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Spatial_Attention_layer(nn.Module):
"""
compute spatial attention scores
"""
def __init__(self, dropout=0.0):
super(Spatial_Attention_layer, self).__init__()
self.dropout = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | wxh453751461/Gformer | Spatial_Attention_layer | false | 4,566 | [
"Apache-2.0"
] | 0 | a033eb6fce59ceacc61a76430010805023ac230f | https://github.com/wxh453751461/Gformer/tree/a033eb6fce59ceacc61a76430010805023ac230f |
SubpixelConvolutionLayer | import torch
import torch.nn as nn
import torch.utils.data
class SubpixelConvolutionLayer(nn.Module):
def __init__(self, channels: 'int') ->None:
"""
Args:
channels (int): Number of channels in the input image.
"""
super(SubpixelConvolutionLayer, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | wuyushuwys/SRGAN-PyTorch | SubpixelConvolutionLayer | false | 4,567 | [
"Apache-2.0"
] | 0 | 3a4aaaf7b55692264fca8451e4401466fcb1f39a | https://github.com/wuyushuwys/SRGAN-PyTorch/tree/3a4aaaf7b55692264fca8451e4401466fcb1f39a |
Synthesis_net | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.utils.data
class LowerBound(Function):
@staticmethod
def forward(ctx, inputs, bound):
b = torch.ones_like(inputs) * bound
ctx.save_for_backward(inputs, b)
return torch.max(inputs, 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 import triton_helpers
from torch._inductor.runtime.... | wemozj/Image-Compression-based-GMM-and-Attention-Module | Synthesis_net | false | 4,568 | [
"Apache-2.0"
] | 0 | 93f804dbcea8ffc1621456f3d104d0342c75373b | https://github.com/wemozj/Image-Compression-based-GMM-and-Attention-Module/tree/93f804dbcea8ffc1621456f3d104d0342c75373b |
BertSelfAttention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.num_attention_heads = config.num_attention_heads
self.attention_head_size = int(config.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
from torch._inductor.runtime.... | SamarthMM/cs769-assignments | BertSelfAttention | false | 4,569 | [
"MIT"
] | 0 | bac2ad57c50043608276df8e0f21181ef62696c7 | https://github.com/SamarthMM/cs769-assignments/tree/bac2ad57c50043608276df8e0f21181ef62696c7 |
SFU | import torch
import torch.utils.data
import torch.nn.functional as F
class SFU(torch.nn.Module):
"""
only two input, one input vector and one fusion vector
Args:
- input_size:
- fusions_size:
Inputs:
- input: (seq_len, batch, input_size)
- fusions: (seq_len, batch, fus... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | xdong73S/Match_LSTM_v2.0 | SFU | false | 4,570 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
SpecialEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpecialEncoderLayer(nn.Module):
def __init__(self, heads, d_in, d_out, d_ff, p_drop=0.1):
super(SpecialEncoderLayer, self).__init__()
self.heads = heads
self.norm = nn.LayerNorm(d_in)
self.proj_pair_1 = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | SpecialEncoderLayer | false | 4,571 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
SeqToSeqAtten | import torch
import torch.utils.data
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim=True)[0])
if m is not None:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | xdong73S/Match_LSTM_v2.0 | SeqToSeqAtten | false | 4,572 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
EncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def orthogonal_matrix_chunk(cols, qr_uniform_q=False, device=None):
unstructured_block = torch.rand... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | EncoderLayer | false | 4,573 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
Analysis_prior_net | import math
import torch
import torch.nn as nn
import torch.utils.data
class Analysis_prior_net(nn.Module):
"""
Analysis prior net
"""
def __init__(self, out_channel_N=192, out_channel_M=320):
super(Analysis_prior_net, self).__init__()
self.conv1 = nn.Conv2d(out_channel_M, out_channel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
i... | wemozj/Image-Compression-based-GMM-and-Attention-Module | Analysis_prior_net | false | 4,574 | [
"Apache-2.0"
] | 0 | 93f804dbcea8ffc1621456f3d104d0342c75373b | https://github.com/wemozj/Image-Compression-based-GMM-and-Attention-Module/tree/93f804dbcea8ffc1621456f3d104d0342c75373b |
MatchRNNAttention | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | xdong73S/Match_LSTM_v2.0 | MatchRNNAttention | false | 4,575 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
AttentionPooling | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | xdong73S/Match_LSTM_v2.0 | AttentionPooling | false | 4,576 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
_MixPool2d | import torch
class _MixPool2d(torch.nn.Module):
def __init__(self, kernel_size, stride, padding=0, ceil_mode=False):
super(_MixPool2d, self).__init__()
self.max_pool = torch.nn.MaxPool2d(kernel_size, stride, padding,
ceil_mode=ceil_mode)
self.avg_pool = torch.nn.AvgPool2d(kern... | 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... | x6rulin/TP-GAN | _MixPool2d | false | 4,577 | [
"MIT"
] | 0 | 1716cf06aaff8a6a2cee2548ec662dcdd68c0449 | https://github.com/x6rulin/TP-GAN/tree/1716cf06aaff8a6a2cee2548ec662dcdd68c0449 |
SelfGated | import torch
import torch.utils.data
import torch.nn.functional as F
class SelfGated(torch.nn.Module):
"""
Self-Gated layer. math: \\sigmoid(W*x) * x
"""
def __init__(self, input_size):
super(SelfGated, self).__init__()
self.linear_g = torch.nn.Linear(input_size, input_size)
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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size... | xdong73S/Match_LSTM_v2.0 | SelfGated | false | 4,578 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
RingLoss | import torch
import warnings
import torch.nn as nn
from torchvision.transforms import *
class RingLoss(nn.Module):
"""Ring loss.
Reference:
Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018.
"""
def __init__(self):
super(RingLoss, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import warnings
import torch.nn as nn
from torchvision.transforms import *
asse... | xijiali/ABD_Net | RingLoss | false | 4,579 | [
"MIT"
] | 0 | 8d2d9b316b7c181ce441ceb4b1c62fb9a6d53153 | https://github.com/xijiali/ABD_Net/tree/8d2d9b316b7c181ce441ceb4b1c62fb9a6d53153 |
AxialEncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def orthogonal_matrix_chunk(cols, qr_uniform_q=False, device=None):
unstructured_block = torch.rand... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | AxialEncoderLayer | false | 4,580 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
PointerAttention | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | xdong73S/Match_LSTM_v2.0 | PointerAttention | false | 4,581 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
Enrichment | import torch
import torch.nn as nn
class Enrichment(nn.Module):
def __init__(self, c_in, rate=2):
super(Enrichment, self).__init__()
self.rate = rate
self.relu = nn.ReLU(inplace=True)
self.conv = nn.Conv2d(c_in, 32, 3, stride=1, padding=1)
dilation = self.rate * 1 if self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | xavysp/TIN_xsp | Enrichment | false | 4,582 | [
"MIT"
] | 0 | 9f68e03923f637f4d4ef885694dfc3aaaaad6cea | https://github.com/xavysp/TIN_xsp/tree/9f68e03923f637f4d4ef885694dfc3aaaaad6cea |
PredLayer | import torch
import torch.nn as nn
def module_test_print(var_input, var_inmed, var_ouput):
for var in (var_input, var_inmed, var_ouput):
None
for key, value in var.items():
None
None
class PredLayer(nn.Module):
def __init__(self, module_test=False):
super(Pre... | 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... | xlx0010/HGNN | PredLayer | false | 4,583 | [
"MIT"
] | 0 | 219352405db021c1f435f3aa55961adcf2a6df19 | https://github.com/xlx0010/HGNN/tree/219352405db021c1f435f3aa55961adcf2a6df19 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, gamma):
super().__init__()
self.gamma = gamma
def forward(self, input, target):
if not target.size() == input.size():
raise ValueError(
'Targe... | 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... | xkp793003821/kaggle-tgs-salt | FocalLoss | false | 4,584 | [
"MIT"
] | 0 | 4acd7f8b6aff914e2c8558677d6dac8b5ddc1f30 | https://github.com/xkp793003821/kaggle-tgs-salt/tree/4acd7f8b6aff914e2c8558677d6dac8b5ddc1f30 |
MyGlobalAvgPool2d | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
class MyGlobalAvgPool2d(nn.Module):
def __init__(self, keep_dim=True):
super(MyGlobalAvgPool2d, self).__init__()
self.keep_dim = keep_dim
def forward(self, x):
return x.mean(3, keep... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
assert_size_stride = torch._C._dynamo.guards.asser... | xmyqsh/once-for-all | MyGlobalAvgPool2d | false | 4,585 | [
"MIT"
] | 0 | 0bca1778b106d33460fc8d0f7d7e6ca4e1e937d9 | https://github.com/xmyqsh/once-for-all/tree/0bca1778b106d33460fc8d0f7d7e6ca4e1e937d9 |
MixedLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def dice_loss(input, target):
input = torch.sigmoid(input)
smooth = 1.0
iflat = input.view(-1)
tflat = target.view(-1)
intersection = (iflat * tflat).sum()
return (2.0 * intersection + smooth) / (iflat.sum() + tflat.sum() + smo... | 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... | xkp793003821/kaggle-tgs-salt | MixedLoss | false | 4,586 | [
"MIT"
] | 0 | 4acd7f8b6aff914e2c8558677d6dac8b5ddc1f30 | https://github.com/xkp793003821/kaggle-tgs-salt/tree/4acd7f8b6aff914e2c8558677d6dac8b5ddc1f30 |
SelfAttention | import torch
from torch.nn import init
from torch.nn.parameter import Parameter
class SelfAttention(torch.nn.Module):
def __init__(self, wv_dim: 'int', maxlen: 'int'):
super(SelfAttention, self).__init__()
self.wv_dim = wv_dim
self.maxlen = maxlen
self.M = Parameter(torch.empty(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.... | xlwreally/Graduation-project-ABAE | SelfAttention | false | 4,587 | [
"MIT"
] | 0 | 7c389acfff0fd207e4588b4333521e2dfbf12ec7 | https://github.com/xlwreally/Graduation-project-ABAE/tree/7c389acfff0fd207e4588b4333521e2dfbf12ec7 |
SoftDetectionModule | import torch
import torch.utils
import torch.nn as nn
import torch.nn.functional as F
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_... | 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.utils
imp... | xmlyqing00/d2-net | SoftDetectionModule | false | 4,588 | [
"BSD-3-Clause-Clear"
] | 0 | 3454a2862088682a6bdb2532ff049fd6cd82729c | https://github.com/xmlyqing00/d2-net/tree/3454a2862088682a6bdb2532ff049fd6cd82729c |
ForwardNet | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | xdong73S/Match_LSTM_v2.0 | ForwardNet | false | 4,589 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
Str2MSA | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-05):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(d_model))
self.b_2 = nn.Parameter(torch.zeros(d_model))
self.eps ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | Str2MSA | false | 4,590 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
LogitBinaryCrossEntropy | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class LogitBinaryCrossEntropy(nn.Module):
def __init__(self):
super(LogitBinaryCrossEntropy, self).__init__()
def forward(self, pred_score, target_score, weights=None):
loss = F.binary_cross_entropy_wi... | 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... | xymtxwd/OSDA_with_soft_rejection | LogitBinaryCrossEntropy | false | 4,591 | [
"MIT"
] | 0 | a71394ae755c663508b33d3dddb1204ce7cb3fc0 | https://github.com/xymtxwd/OSDA_with_soft_rejection/tree/a71394ae755c663508b33d3dddb1204ce7cb3fc0 |
Conv2dSame | import torch
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import torch.nn.functional as F
from typing import Optional
from typing import Tuple
import torch.nn.parallel
import torch.optim
def _calc_same_pad(input_: 'int', kernel: 'int', stride: 'int', dilation: 'int'
):
"""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
import torch.utils.data
import torch.utils.data.distributed
from torch import nn... | xmyyzy123/zen_nas | Conv2dSame | false | 4,592 | [
"Apache-2.0"
] | 0 | 4870eb0a030856bd67afe8529f65af8dc3bd81dc | https://github.com/xmyyzy123/zen_nas/tree/4870eb0a030856bd67afe8529f65af8dc3bd81dc |
DirectEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-05):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(d_model))
self.b_2 = nn.Parameter(torch.zeros(d_model))
self.eps = eps
d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | wukevin/RoseTTAFold | DirectEncoderLayer | false | 4,593 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
SEModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class SEModule(nn.Module):
def __init__(self, planes, compress_rate):
super(SEModule, self).__init__()
self.conv1 = nn.Conv2d(planes, planes // compress_rate, kernel_size
=1, stride=1, bias=True)
self.conv2 = 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_... | xuehaouwa/VGGFace2-pytorch | SEModule | false | 4,594 | [
"MIT"
] | 0 | c38e11f893e5bcc273a9b847530cd619019b636c | https://github.com/xuehaouwa/VGGFace2-pytorch/tree/c38e11f893e5bcc273a9b847530cd619019b636c |
Upsample4x | import torch
from torch import nn
class Upsample4x(nn.Module):
def __init__(self, n_channels):
super(Upsample4x, self).__init__()
self.conv = nn.Conv2d(n_channels, n_channels, 3, 1, 1)
def forward(self, x):
x = torch.nn.functional.interpolate(x, scale_factor=4, mode=
'bil... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | xqterry/lightweight-human-pose-estimation.pytorch | Upsample4x | false | 4,595 | [
"Apache-2.0"
] | 0 | e5ec9452c9bd9683451d3b2f97c6fe9e075b2d48 | https://github.com/xqterry/lightweight-human-pose-estimation.pytorch/tree/e5ec9452c9bd9683451d3b2f97c6fe9e075b2d48 |
MixPad2d | import torch
from itertools import product as product
import torch.nn as nn
class MixPad2d(nn.Module):
"""Mixed padding modes for H and W dimensions
Args:
padding (tuple): the size of the padding for x and y, ie (pad_x, pad_y)
modes (tuple): the padding modes for x and y, the values of each 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 itertools import product as product
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided... | xqyzjl/face_parsing | MixPad2d | false | 4,596 | [
"MIT"
] | 0 | 3d6c7b06d67c8fbf01bce22db199bc94a13a1a7c | https://github.com/xqyzjl/face_parsing/tree/3d6c7b06d67c8fbf01bce22db199bc94a13a1a7c |
GraphAttentionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
def module_test_print(var_input, var_inmed, var_ouput):
for var in (var_input, var_inmed, var_ouput):
None
for key, value in var.items():
None
None
class GraphAttentionLayer(nn.Module):
def __init__(s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | xlx0010/HGNN | GraphAttentionLayer | false | 4,597 | [
"MIT"
] | 0 | 219352405db021c1f435f3aa55961adcf2a6df19 | https://github.com/xlx0010/HGNN/tree/219352405db021c1f435f3aa55961adcf2a6df19 |
ReturnAsLoss | import torch
import torch.nn as nn
class ReturnAsLoss(nn.Module):
def __init__(self):
super(ReturnAsLoss, self).__init__()
def forward(self, output, y):
"""negative logarithm return"""
return -torch.sum(torch.log(torch.sum(output * (y + 1), dim=1)))
def get_inputs():
return [to... | 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... | yanxurui/portfolio | ReturnAsLoss | false | 4,598 | [
"MIT"
] | 0 | 032cf47ccac1c5815fd4827bf0d5f3cf43cec990 | https://github.com/yanxurui/portfolio/tree/032cf47ccac1c5815fd4827bf0d5f3cf43cec990 |
SqueezeExcitation | import torch
import torch.utils.data
def _make_divisible(width, divisor=8):
new_width = max(divisor, int(width + divisor / 2) // divisor * divisor)
if new_width < 0.9 * width:
new_width += divisor
return new_width
class SqueezeExcitation(torch.nn.Module):
""" [https://arxiv.org/abs/1709.0150... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
asser... | yakhyo/MobileNetV3-pt | SqueezeExcitation | false | 4,599 | [
"MIT"
] | 0 | 1fbc966036ed9f036090b3efe3e700f057aa7dde | https://github.com/yakhyo/MobileNetV3-pt/tree/1fbc966036ed9f036090b3efe3e700f057aa7dde |
Binary | import torch
import torch.nn as nn
class Binary(nn.Module):
def __init__(self):
super().__init__()
self._criteria = nn.BCELoss()
def forward(self, output, y):
y_copy = y.clone()
y_copy[y > 0] = 0.9
y_copy[y < 0] = 0
return self._criteria(output, y_copy)
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 libdevice, math as tl_math
import torc... | yanxurui/portfolio | Binary | false | 4,600 | [
"MIT"
] | 0 | 032cf47ccac1c5815fd4827bf0d5f3cf43cec990 | https://github.com/yanxurui/portfolio/tree/032cf47ccac1c5815fd4827bf0d5f3cf43cec990 |
CustomizedLoss | import torch
import torch.nn as nn
class CustomizedLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, output, y):
return -torch.mean(torch.sum(output * y, dim=1))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yanxurui/portfolio | CustomizedLoss | false | 4,601 | [
"MIT"
] | 0 | 032cf47ccac1c5815fd4827bf0d5f3cf43cec990 | https://github.com/yanxurui/portfolio/tree/032cf47ccac1c5815fd4827bf0d5f3cf43cec990 |
Model | import torch
import torch.nn.functional as F
from torch import nn
class Model(nn.Module):
def __init__(self, n_input: 'int', state_dict=None):
super(Model, self).__init__()
self.n_input = n_input
self.fc = nn.Linear(n_input, 20)
self.output = nn.Linear(20, 1)
nn.init.xavie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | y-kamiya/devnet | Model | false | 4,602 | [
"MIT"
] | 0 | f9562c97e1025949b48d433bd9f2114e56ac67e4 | https://github.com/y-kamiya/devnet/tree/f9562c97e1025949b48d433bd9f2114e56ac67e4 |
RegressionMLP | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class RegressionMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.fc1 = nn.Linear(config.d_z, config.d_z // 2)
self.fc2 = nn.Linear(config.d_z // 2, 1)
d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | yair-schiff/moses | RegressionMLP | false | 4,603 | [
"MIT"
] | 0 | 563c364acf6091bf1781f0f98743589ce4eb4195 | https://github.com/yair-schiff/moses/tree/563c364acf6091bf1781f0f98743589ce4eb4195 |
Net | import torch
import torch.nn as nn
import torch.nn.init
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=
3, padding=1)
self.conv2 = nn.Conv2d(in_channels=16... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | xuanyuyt/pytorch-tutorial | Net | false | 4,604 | [
"MIT"
] | 0 | 92076ac56d42da98ea61ce06708bb8c537a49af0 | https://github.com/xuanyuyt/pytorch-tutorial/tree/92076ac56d42da98ea61ce06708bb8c537a49af0 |
Oracle | import torch
import torch.nn as nn
class Oracle(nn.Module):
def __init__(self):
super().__init__()
self._criteria = nn.CrossEntropyLoss()
def forward(self, output, y):
y_copy = y.clone()
y_copy[:, 0] += 0.005
return self._criteria(output, y_copy.argmax(dim=1))
def g... | 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
... | yanxurui/portfolio | Oracle | false | 4,605 | [
"MIT"
] | 0 | 032cf47ccac1c5815fd4827bf0d5f3cf43cec990 | https://github.com/yanxurui/portfolio/tree/032cf47ccac1c5815fd4827bf0d5f3cf43cec990 |
CrossEncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def orthogonal_matrix_chunk(cols, qr_uniform_q=False, device=None):
unstructured_block = torch.rand... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | wukevin/RoseTTAFold | CrossEncoderLayer | false | 4,606 | [
"MIT"
] | 0 | e3c15dbf4bc1e4f8726e26c63aca1625188da803 | https://github.com/wukevin/RoseTTAFold/tree/e3c15dbf4bc1e4f8726e26c63aca1625188da803 |
FBACompLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import functools
impor... | yaochaorui/mmediting | FBACompLoss | false | 4,607 | [
"Apache-2.0"
] | 0 | e292abd1f86b1560856d8c4e8c40ababe8a90630 | https://github.com/yaochaorui/mmediting/tree/e292abd1f86b1560856d8c4e8c40ababe8a90630 |
GymDqn | from _paritybench_helpers import _mock_config
import torch
from torch.nn import functional as F
from torch import nn
class GymDqn(nn.Module):
def __init__(self, args, action_space):
super(GymDqn, self).__init__()
self.atoms = args.atoms
self.action_space = action_space
self.input_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import function... | xssstory/Rainbow | GymDqn | false | 4,608 | [
"MIT"
] | 0 | 919a48f5fd67b6860906188b02c1b4dbe729033e | https://github.com/xssstory/Rainbow/tree/919a48f5fd67b6860906188b02c1b4dbe729033e |
UpSample | import torch
import torch.nn as nn
class UpSample(nn.Module):
def __init__(self, n_chan, factor=2):
super(UpSample, self).__init__()
out_chan = n_chan * factor * factor
self.proj = nn.Conv2d(n_chan, out_chan, 1, 1, 0)
self.up = nn.PixelShuffle(factor)
self.init_weight()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ybchen97/BiSeNet | UpSample | false | 4,609 | [
"MIT"
] | 0 | 18a2ac93df65596fcd53c305a4d17bc818bf3cfa | https://github.com/ybchen97/BiSeNet/tree/18a2ac93df65596fcd53c305a4d17bc818bf3cfa |
PermEqui2_mean | import torch
from torch import nn
class PermEqui2_mean(nn.Module):
def __init__(self, in_dim, out_dim):
super().__init__()
self.Gamma = nn.Linear(in_dim, out_dim)
self.Lambda = nn.Linear(in_dim, out_dim, bias=False)
self.weight = self.Gamma.weight
self.bias = self.Gamma.bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | ydiller/NoMoreNMS | PermEqui2_mean | false | 4,610 | [
"Apache-2.0"
] | 0 | 1c1557357e5312c287f0971c840060deb1bcd039 | https://github.com/ydiller/NoMoreNMS/tree/1c1557357e5312c287f0971c840060deb1bcd039 |
AtLocPlusCriterion | import torch
import torch.nn as nn
import torch.nn.init
def calc_vos_simple(poses):
vos = []
for p in poses:
pvos = [(p[i + 1].unsqueeze(0) - p[i].unsqueeze(0)) for i in range(
len(p) - 1)]
vos.append(torch.cat(pvos, dim=0))
vos = torch.stack(vos, dim=0)
return vos
class ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.nn.init
assert_size_stride = torch._C.... | xunshengliuyin/ATwvo | AtLocPlusCriterion | false | 4,611 | [
"MIT"
] | 0 | 7d8b7aeb7893cb59d48864a9a35f7de9dce084b4 | https://github.com/xunshengliuyin/ATwvo/tree/7d8b7aeb7893cb59d48864a9a35f7de9dce084b4 |
DynamicModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class L2Norm(nn.Module):
def forward(self, x):
if len(x.size()) > 1:
return x / x.norm(p=2, dim=1, keepdim=True)
else:
return x / x.norm(p=2)
class NonLinearModel(nn.Module):
def __init__(self, input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ycsun2017/simple_transfer | DynamicModel | false | 4,612 | [
"Apache-2.0"
] | 0 | b807f7a9d818c5586c101f616d190fe9968fabbd | https://github.com/ycsun2017/simple_transfer/tree/b807f7a9d818c5586c101f616d190fe9968fabbd |
PMA | import math
import torch
import torch.nn.functional as F
from torch import nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
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.... | ydiller/NoMoreNMS | PMA | false | 4,613 | [
"Apache-2.0"
] | 0 | 1c1557357e5312c287f0971c840060deb1bcd039 | https://github.com/ydiller/NoMoreNMS/tree/1c1557357e5312c287f0971c840060deb1bcd039 |
MAB | import math
import torch
import torch.nn.functional as F
from torch import nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
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.... | ydiller/NoMoreNMS | MAB | false | 4,614 | [
"Apache-2.0"
] | 0 | 1c1557357e5312c287f0971c840060deb1bcd039 | https://github.com/ydiller/NoMoreNMS/tree/1c1557357e5312c287f0971c840060deb1bcd039 |
ComposeModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class L2Norm(nn.Module):
def forward(self, x):
if len(x.size()) > 1:
return x / x.norm(p=2, dim=1, keepdim=True)
else:
return x / x.norm(p=2)
class NonLinearModel(nn.Module):
def __init__(self, input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ycsun2017/simple_transfer | ComposeModel | false | 4,615 | [
"Apache-2.0"
] | 0 | b807f7a9d818c5586c101f616d190fe9968fabbd | https://github.com/ycsun2017/simple_transfer/tree/b807f7a9d818c5586c101f616d190fe9968fabbd |
ThetaEncoder | import torch
from torch import nn
class ThetaEncoder(nn.Module):
def __init__(self, encoder_len):
super(ThetaEncoder, self).__init__()
self.encoder_len = encoder_len
self.omega = 1
def forward(self, theta):
"""
:param theta: [B, lead_num, 2]
:return: [B, lead_... | 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_... | yhy489275918/Electrocardio-Panorama | ThetaEncoder | false | 4,616 | [
"MIT"
] | 0 | 1acdbb43d873ce98a0350b7912b6b190e026d3db | https://github.com/yhy489275918/Electrocardio-Panorama/tree/1acdbb43d873ce98a0350b7912b6b190e026d3db |
NonLinearModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class L2Norm(nn.Module):
def forward(self, x):
if len(x.size()) > 1:
return x / x.norm(p=2, dim=1, keepdim=True)
else:
return x / x.norm(p=2)
class NonLinearModel(nn.Module):
def __init__(self, input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ycsun2017/simple_transfer | NonLinearModel | false | 4,617 | [
"Apache-2.0"
] | 0 | b807f7a9d818c5586c101f616d190fe9968fabbd | https://github.com/ycsun2017/simple_transfer/tree/b807f7a9d818c5586c101f616d190fe9968fabbd |
MSELead | import torch
from torch import nn
class MSELead(nn.Module):
def __init__(self):
super(MSELead, self).__init__()
self.loss_func = nn.MSELoss()
def forward(self, input, target):
loss_list = []
for i in range(input.size(1)):
loss_list.append(self.loss_func(input[:, i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | yhy489275918/Electrocardio-Panorama | MSELead | false | 4,618 | [
"MIT"
] | 0 | 1acdbb43d873ce98a0350b7912b6b190e026d3db | https://github.com/yhy489275918/Electrocardio-Panorama/tree/1acdbb43d873ce98a0350b7912b6b190e026d3db |
IdentityMessage | import torch
import torch.utils.data
class IdentityMessage(torch.nn.Module):
def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'):
super(IdentityMessage, self).__init__()
self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim
def forward(self, z_src, z_dst, raw_msg... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | yinyee/pytorch_geometric | IdentityMessage | false | 4,619 | [
"MIT"
] | 0 | c61469c761b279047f162d2baba75f8c2155eb7a | https://github.com/yinyee/pytorch_geometric/tree/c61469c761b279047f162d2baba75f8c2155eb7a |
PixelNorm | import torch
import torch.nn as nn
def pixel_norm(x, eps=1e-06):
"""Pixel Normalization.
This normalization is proposed in:
Progressive Growing of GANs for Improved Quality, Stability, and Variation
Args:
x (torch.Tensor): Tensor to be normalized.
eps (float, optional): Epsilon to av... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | yivan-WYYGDSG/mmediting | PixelNorm | false | 4,620 | [
"Apache-2.0"
] | 0 | f9c9a953013b709ed59865d0fecbacbf5711e153 | https://github.com/yivan-WYYGDSG/mmediting/tree/f9c9a953013b709ed59865d0fecbacbf5711e153 |
Spatial_Attention | import torch
import torch.nn as nn
class Spatial_Attention(nn.Module):
def __init__(self, channels, length):
super(Spatial_Attention, self).__init__()
self.conv_3x3 = nn.Conv2d(in_channels=2, out_channels=2,
kernel_size=3, stride=2, padding=3 // 2)
self.resize_bilinear = nn.Up... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | yhf2022/APAN | Spatial_Attention | false | 4,621 | [
"MIT"
] | 0 | b4dd9a5585f42cccefe01e9525cdc8c59727bdf2 | https://github.com/yhf2022/APAN/tree/b4dd9a5585f42cccefe01e9525cdc8c59727bdf2 |
SAB | import math
import torch
import torch.nn.functional as F
from torch import nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
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.... | ydiller/NoMoreNMS | SAB | false | 4,622 | [
"Apache-2.0"
] | 0 | 1c1557357e5312c287f0971c840060deb1bcd039 | https://github.com/ydiller/NoMoreNMS/tree/1c1557357e5312c287f0971c840060deb1bcd039 |
GatedMaskedConv2d | import torch
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class GatedMaskedConv2d(nn.Module):
def __init__(self, in_dim, out_dim=None, kernel_size=3, mask='B'):
super(GatedMaskedConv2d, self).__init__()
if out_dim is None:
out_dim = in_dim
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.... | yining1023/vae-lagging-encoder | GatedMaskedConv2d | false | 4,624 | [
"MIT"
] | 0 | 88598b8400b3507090c05b9a6c01aa85b6e2cc87 | https://github.com/yining1023/vae-lagging-encoder/tree/88598b8400b3507090c05b9a6c01aa85b6e2cc87 |
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, 3)
self.conv2 = nn.Conv2d(32, 64, 3)
self.pool = nn.MaxPool2d(2, 2)
self.dropout1 = nn.Dropout2d()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | yito0427/pytorch-basic | Net | false | 4,626 | [
"MIT"
] | 0 | 316cf460edb24da5f25dea9426c1a123912719cf | https://github.com/yito0427/pytorch-basic/tree/316cf460edb24da5f25dea9426c1a123912719cf |
LayerNorm | import torch
class LayerNorm(torch.nn.Module):
def __init__(self, input_dim):
super(LayerNorm, self).__init__()
self.gamma = torch.nn.Parameter(torch.ones(input_dim))
self.beta = torch.nn.Parameter(torch.zeros(input_dim))
self.eps = 1e-06
def forward(self, x, mask):
m... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ydai94/TextWorld-Coin-Collector | LayerNorm | false | 4,627 | [
"MIT"
] | 0 | 71d5c535b1ab60636d941fba9061e4066772bc40 | https://github.com/ydai94/TextWorld-Coin-Collector/tree/71d5c535b1ab60636d941fba9061e4066772bc40 |
RPNHead | import torch
import torch.nn.functional as F
from torch import nn
class RPNHead(nn.Module):
def __init__(self, in_channels, num_anchors):
super().__init__()
self.conv = nn.Conv2d(in_channels, in_channels, 3, 1, 1)
self.cls_logits = nn.Conv2d(in_channels, num_anchors, 1)
self.bbox_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | yokosyun/instance-segmentation | RPNHead | false | 4,628 | [
"MIT"
] | 0 | 5779ae864b24c28300b0ddc4c314e63490215606 | https://github.com/yokosyun/instance-segmentation/tree/5779ae864b24c28300b0ddc4c314e63490215606 |
HGNN_conv | import math
import torch
from torch import nn
from torch.nn.parameter import Parameter
class HGNN_conv(nn.Module):
def __init__(self, in_ft, out_ft, bias=True):
super(HGNN_conv, self).__init__()
self.weight = Parameter(torch.Tensor(in_ft, out_ft))
if bias:
self.bias = Paramete... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
from torch.nn.parameter import Parameter
assert... | young917/HGNN | HGNN_conv | false | 4,629 | [
"MIT"
] | 0 | 41017f4315f459e1250830ca6c498b920d57e80a | https://github.com/young917/HGNN/tree/41017f4315f459e1250830ca6c498b920d57e80a |
FastRCNNPredictor | import torch
import torch.nn.functional as F
from torch import nn
class FastRCNNPredictor(nn.Module):
def __init__(self, in_channels, mid_channels, num_classes):
super().__init__()
self.fc1 = nn.Linear(in_channels, mid_channels)
self.fc2 = nn.Linear(mid_channels, mid_channels)
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 import nn
assert_s... | yokosyun/instance-segmentation | FastRCNNPredictor | false | 4,630 | [
"MIT"
] | 0 | 5779ae864b24c28300b0ddc4c314e63490215606 | https://github.com/yokosyun/instance-segmentation/tree/5779ae864b24c28300b0ddc4c314e63490215606 |
TimeStrech | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
class TimeStrech(nn.Module):
def __init__(self, scale):
super(TimeStrech, self).__init__()
self.scale = scale
def forward(self, x):
mel_size = x.size(-1)
x = F.interpolate(x, scale_factor=(1, sel... | 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... | yuangan/A2L | TimeStrech | false | 4,631 | [
"MIT"
] | 0 | 8cbc9b5f368924c8c75cbab53e9bb10dcf265c7e | https://github.com/yuangan/A2L/tree/8cbc9b5f368924c8c75cbab53e9bb10dcf265c7e |
HGNN_embedding | import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class HGNN_conv(nn.Module):
def __init__(self, in_ft, out_ft, bias=True):
super(HGNN_conv, self).__init__()
self.weight = Parameter(torch.Tensor(in_ft, out_ft))
if 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
import math
from torch import... | young917/HGNN | HGNN_embedding | false | 4,632 | [
"MIT"
] | 0 | 41017f4315f459e1250830ca6c498b920d57e80a | https://github.com/young917/HGNN/tree/41017f4315f459e1250830ca6c498b920d57e80a |
ChannelNorm | import torch
import torch.nn as nn
import torch._utils
import torch.optim
class ChannelNorm(nn.Module):
def __init__(self):
super(ChannelNorm, self).__init__()
def forward(self, featmap):
n, c, _h, _w = featmap.shape
featmap = featmap.reshape((n, c, -1))
featmap = featmap.sof... | 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
... | yubin1219/Semantic-Seg | ChannelNorm | false | 4,633 | [
"BSD-2-Clause"
] | 0 | c40bd43d3d7e44bc995b8d041736580dec084251 | https://github.com/yubin1219/Semantic-Seg/tree/c40bd43d3d7e44bc995b8d041736580dec084251 |
ZeroModule | import torch
import torch as th
from torch import nn
import torch.random
import torch
class ZeroModule(nn.Module):
"""Module that always returns zeros of same shape as input."""
def __init__(self, features_dim: 'int'):
"""Builds ZeroModule."""
super().__init__()
self.features_dim = fe... | 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
import torch.random
import torch
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = t... | yulonglin/imitation | ZeroModule | false | 4,634 | [
"MIT"
] | 0 | e5479b18f741b1d3591bec553ea84033fbd10ced | https://github.com/yulonglin/imitation/tree/e5479b18f741b1d3591bec553ea84033fbd10ced |
ISAB | import math
import torch
import torch.nn.functional as F
from torch import nn
class MAB(nn.Module):
def __init__(self, dim_Q, dim_K, dim_V, num_heads, ln=False):
super(MAB, self).__init__()
self.dim_V = dim_V
self.num_heads = num_heads
self.fc_q = nn.Linear(dim_Q, dim_V)
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.... | ydiller/NoMoreNMS | ISAB | false | 4,635 | [
"Apache-2.0"
] | 0 | 1c1557357e5312c287f0971c840060deb1bcd039 | https://github.com/ydiller/NoMoreNMS/tree/1c1557357e5312c287f0971c840060deb1bcd039 |
HGNN | import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class HGNN_conv(nn.Module):
def __init__(self, in_ft, out_ft, bias=True):
super(HGNN_conv, self).__init__()
self.weight = Parameter(torch.Tensor(in_ft, out_ft))
if 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
import math
from torch import... | young917/HGNN | HGNN | false | 4,636 | [
"MIT"
] | 0 | 41017f4315f459e1250830ca6c498b920d57e80a | https://github.com/young917/HGNN/tree/41017f4315f459e1250830ca6c498b920d57e80a |
ShiftBias | import torch
import torch.nn as nn
class ShiftBias(nn.Module):
def __init__(self, bias):
super(ShiftBias, self).__init__()
self.bias = bias
def forward(self, x):
return x + self.bias
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {'... | 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... | yuangan/A2L | ShiftBias | false | 4,637 | [
"MIT"
] | 0 | 8cbc9b5f368924c8c75cbab53e9bb10dcf265c7e | https://github.com/yuangan/A2L/tree/8cbc9b5f368924c8c75cbab53e9bb10dcf265c7e |
PitchShift | import torch
import torch.nn as nn
import torch.nn.functional as F
class PitchShift(nn.Module):
def __init__(self, shift):
super(PitchShift, self).__init__()
self.shift = shift
def forward(self, x):
if len(x.shape) == 2:
x = x.unsqueeze(0)
x = x.squeeze()
... | 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... | yuangan/A2L | PitchShift | false | 4,638 | [
"MIT"
] | 0 | 8cbc9b5f368924c8c75cbab53e9bb10dcf265c7e | https://github.com/yuangan/A2L/tree/8cbc9b5f368924c8c75cbab53e9bb10dcf265c7e |
NoiseInjection | import torch
import torch.utils.data
import torch
import torch.nn as nn
class NoiseInjection(nn.Module):
def __init__(self, channel):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1, channel, 1, 1))
def forward(self, image, noise):
return image + self.weight * noise.unsqu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | yuhongherald/pytorch-CycleGAN-and-pix2pix | NoiseInjection | false | 4,639 | [
"BSD-3-Clause"
] | 0 | 48cb3aa46fde39684db9c24586fcec6781138e2a | https://github.com/yuhongherald/pytorch-CycleGAN-and-pix2pix/tree/48cb3aa46fde39684db9c24586fcec6781138e2a |
AdaptiveInstanceNorm | import torch
import torch.utils.data
import torch
import torch.nn as nn
class AdaptiveInstanceNorm(nn.Module):
def __init__(self, in_channel, style_dim):
super().__init__()
self.norm = nn.InstanceNorm2d(in_channel)
self.style = nn.Linear(style_dim, in_channel * 2)
self.style.weigh... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | yuhongherald/pytorch-CycleGAN-and-pix2pix | AdaptiveInstanceNorm | false | 4,640 | [
"BSD-3-Clause"
] | 0 | 48cb3aa46fde39684db9c24586fcec6781138e2a | https://github.com/yuhongherald/pytorch-CycleGAN-and-pix2pix/tree/48cb3aa46fde39684db9c24586fcec6781138e2a |
CriterionAT | import torch
import torch.nn as nn
from torch.nn import functional as F
import torch._utils
import torch.optim
def at(x):
return F.normalize(x.pow(2).mean(0).reshape(1, -1), dim=1)
class CriterionAT(nn.Module):
def __init__(self):
super(CriterionAT, self).__init__()
self.at = at
def fo... | 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... | yubin1219/Semantic-Seg | CriterionAT | false | 4,641 | [
"BSD-2-Clause"
] | 0 | c40bd43d3d7e44bc995b8d041736580dec084251 | https://github.com/yubin1219/Semantic-Seg/tree/c40bd43d3d7e44bc995b8d041736580dec084251 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.