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 |
|---|---|---|---|---|---|---|---|---|---|---|
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, M, H, D):
super().__init__()
self.D = D
self.M = M
self.H = H
self.dec1 = nn.Linear(in_features=self.M, out_features=self.H)
self.dec2 = nn.Linear(in_features=self.H, out_features=self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | le0x99/deep-generative-modeling | Decoder | false | 7,071 | [
"MIT"
] | 1 | 40ffd1640dc3e5a6a2b4ba16a1d767034f081475 | https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475 |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(1, 32, kernel_size=5)
self.conv2 = nn.Conv2d(32, 32, kernel_size=5)
self.conv3 = nn.Conv2d(32, 64, kernel_size=5)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | krishnachaitanya7/Manifolk | CNN | false | 7,072 | [
"MIT"
] | 1 | 779a044af8ce82c913957ce341b9c9f2f1d1e815 | https://github.com/krishnachaitanya7/Manifolk/tree/779a044af8ce82c913957ce341b9c9f2f1d1e815 |
NetPart1 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class NetPart1(nn.Module):
def __init__(self):
super(NetPart1, self).__init__()
d1 = 768
self.conv1 = nn.Conv2d(1, d1,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | lancelee82/necklace | NetPart1 | false | 7,073 | [
"MIT"
] | 1 | 7a7cfbc05284c1a7ae0a923c8b9a3efdd0037579 | https://github.com/lancelee82/necklace/tree/7a7cfbc05284c1a7ae0a923c8b9a3efdd0037579 |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, D, H, M):
super().__init__()
self.D = D
self.M = M
self.H = H
self.enc1 = nn.Linear(in_features=self.D, out_features=self.H)
self.enc2 = nn.Linear(in_features=self.H, out_features=self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | le0x99/deep-generative-modeling | Encoder | false | 7,074 | [
"MIT"
] | 1 | 40ffd1640dc3e5a6a2b4ba16a1d767034f081475 | https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475 |
Invertible1x1Conv | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import torch.utils.data
import torch.nn
class Invertible1x1Conv(torch.nn.Module):
"""
The layer outputs both the convolution, and the log determinant
of its weight matrix. If reverse=True it does convolution with
inverse... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.functional as F
from torch.autograd import Variable
import torch... | leo0519/TensorRT | Invertible1x1Conv | false | 7,075 | [
"Apache-2.0"
] | 1 | 498dcb009fe4c2dedbe9c61044d3de4f3c04a41b | https://github.com/leo0519/TensorRT/tree/498dcb009fe4c2dedbe9c61044d3de4f3c04a41b |
NN_softmax | import torch
from torch import nn
import torch.nn.functional as F
class NN_logsoftmax(nn.Module):
"""Build a new class for the network you want to run, returning log
softmax"""
def set_parameters(self, initializers):
"""Set the parameter values obtained from vanilla NN as initializers"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | laravomfell/tvd_loss | NN_softmax | false | 7,076 | [
"MIT"
] | 1 | b30a925f95985a03ff70bfa40a6ec3662432779d | https://github.com/laravomfell/tvd_loss/tree/b30a925f95985a03ff70bfa40a6ec3662432779d |
_ShiftedSoftPlus | import math
import torch
import torch.jit
import torch.nn.functional
import torch.nn
class _ShiftedSoftPlus(torch.nn.Module):
"""
Shifted softplus as defined in SchNet, NeurIPS 2017.
:param beta: value for the a more general softplus, default = 1
:param threshold: values above are linear function, de... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import math
import torch.jit
import torch.nn.functional
import... | leoil/nequip | _ShiftedSoftPlus | false | 7,077 | [
"MIT"
] | 1 | 83b888797025c94b9963a508bc213a7c98da5bcb | https://github.com/leoil/nequip/tree/83b888797025c94b9963a508bc213a7c98da5bcb |
BesselBasis | import math
import torch
import torch.jit
import torch.nn.functional
from torch import nn
import torch.nn
class BesselBasis(nn.Module):
r_max: 'float'
prefactor: 'float'
def __init__(self, r_max, num_basis=8, trainable=True):
"""Radial Bessel Basis, as proposed in DimeNet: https://arxiv.org/abs/2... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
import torch.jit
import torch.nn.functional
from torch import... | leoil/nequip | BesselBasis | false | 7,078 | [
"MIT"
] | 1 | 83b888797025c94b9963a508bc213a7c98da5bcb | https://github.com/leoil/nequip/tree/83b888797025c94b9963a508bc213a7c98da5bcb |
Decoder3 | import torch
import torch.nn as nn
class Decoder3(nn.Module):
def __init__(self, M, H, D):
super().__init__()
self.D = D
self.M = M
self.H = H
self.dec1 = nn.Linear(in_features=self.M, out_features=self.H)
self.dec2 = nn.Linear(in_features=self.H, out_features=self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | le0x99/deep-generative-modeling | Decoder3 | false | 7,079 | [
"MIT"
] | 1 | 40ffd1640dc3e5a6a2b4ba16a1d767034f081475 | https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475 |
GainesMul | import torch
class GainesMul(torch.nn.Module):
"""
this module is for Gaines stochastic multiplication, supporting unipolar/bipolar
"""
def __init__(self, mode='bipolar', stype=torch.float):
super(GainesMul, self).__init__()
self.mode = mode
self.stype = stype
def UnaryMu... | 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... | libingzheren/Stochastic_Computing | GainesMul | false | 7,080 | [
"MIT"
] | 1 | c02461454618e9ce0c86ce695fad9e95d1ca5e00 | https://github.com/libingzheren/Stochastic_Computing/tree/c02461454618e9ce0c86ce695fad9e95d1ca5e00 |
Encoder3 | import torch
import torch.nn as nn
class Encoder3(nn.Module):
def __init__(self, D, H, M):
super().__init__()
self.D = D
self.M = M
self.H = H
self.enc1 = nn.Linear(in_features=self.D, out_features=self.H * 2)
self.enc2 = nn.Linear(in_features=self.H * 2, out_featu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | le0x99/deep-generative-modeling | Encoder3 | false | 7,081 | [
"MIT"
] | 1 | 40ffd1640dc3e5a6a2b4ba16a1d767034f081475 | https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475 |
ProtectedMultiheadAttention | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.utils.data
from torch.nn import Parameter
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class ProtectedMultiheadAttention(nn.Module):
"""Multi-headed attention.
See "Attention Is All You Need" for... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | laiguokun/fairseq | ProtectedMultiheadAttention | false | 7,082 | [
"MIT"
] | 1 | 6c01c91aac81eb2e3173add4463dfa45c404ffa5 | https://github.com/laiguokun/fairseq/tree/6c01c91aac81eb2e3173add4463dfa45c404ffa5 |
CustomGruCell | import torch
import numpy as np
import torch.nn as nn
class CustomGruCell(nn.Module):
"""
A forward only GRU cell.
Input should be: (sequence length x batch size x input_size).
The output is the output of the final forward call.
It's not clear if it would be possible to use the output from each ce... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | li4112/PySyft | CustomGruCell | false | 7,083 | [
"Apache-2.0"
] | 1 | e593cad25d6831623e6a2b6d34bcb04adcbe00f9 | https://github.com/li4112/PySyft/tree/e593cad25d6831623e6a2b6d34bcb04adcbe00f9 |
MNIST_FC | import torch
import torch.nn as nn
import torch.nn.functional as F
class MNIST_FC(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(28 * 28, 32)
self.fc2 = nn.Linear(32, 10)
def forward(self, xb):
xb = xb.view(-1, 28 * 28)
xb = F.relu(self.fc1(xb... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | lihebi/AdvAE | MNIST_FC | false | 7,084 | [
"MIT"
] | 1 | 56dea2a33c7da64bcc577b0c061a38406fdde101 | https://github.com/lihebi/AdvAE/tree/56dea2a33c7da64bcc577b0c061a38406fdde101 |
SpatialAttentionModule | import torch
import torch.nn as nn
import torch.utils.data
class SpatialAttentionModule(nn.Module):
def __init__(self):
super(SpatialAttentionModule, self).__init__()
self.conv2d = nn.Conv2d(in_channels=2, out_channels=1, kernel_size=
7, stride=1, padding=3)
self.sigmoid = 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
import torch.nn as nn
import ... | lidawei0124/ISD_yolo_dual | SpatialAttentionModule | false | 7,085 | [
"Apache-2.0"
] | 1 | a4617a6ad20b3988f3b422df7a1b8533e32e241b | https://github.com/lidawei0124/ISD_yolo_dual/tree/a4617a6ad20b3988f3b422df7a1b8533e32e241b |
Net | import torch
from torch import nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(28 * 28, 512)
self.fc2 = nn.Linear(512, 512)
self.fc3 = nn.Linear(512, 10)
self.droput = nn.Dropout(0.2)
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | liguodongIOT/nlp-app-samples | Net | false | 7,086 | [
"Apache-2.0"
] | 1 | e0cc747e88c7b5c701b5099462d2dd6277c23381 | https://github.com/liguodongIOT/nlp-app-samples/tree/e0cc747e88c7b5c701b5099462d2dd6277c23381 |
Attention_ElementWiseProduct | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention_ElementWiseProduct(nn.Module):
"""
Input:
behavior: 3D tensor with shape: ``(batch_size,field_size,embedding_size)``.
candidate: 3D tensor with shape: ``(batch_size,1,embedding_size)``.
Output:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | liangzhang-lz/SparrowRecSys | Attention_ElementWiseProduct | false | 7,087 | [
"Apache-2.0"
] | 1 | 9fe1a27d3903117e6e2b5487c0689c0bd9281473 | https://github.com/liangzhang-lz/SparrowRecSys/tree/9fe1a27d3903117e6e2b5487c0689c0bd9281473 |
AlexNet | import torch
import torch.nn as nn
class LRN(nn.Module):
"""
Local Response Normalization
"""
def __init__(self, kernel_size, alpha, beta):
super(LRN, self).__init__()
self.avg_pool = nn.AvgPool2d(kernel_size=kernel_size, stride=1,
padding=int(kernel_size / 2))
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.... | jjeamin/obJDetection | AlexNet | false | 7,088 | [
"MIT"
] | 1 | eb7fbc410beb00fad1a6477e827e9ce2d8efbac5 | https://github.com/jjeamin/obJDetection/tree/eb7fbc410beb00fad1a6477e827e9ce2d8efbac5 |
AttentionConv | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class AttentionConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=False):
super(AttentionConv, self).__init__()
self.out_channels = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | likui01/DRFuser | AttentionConv | false | 7,089 | [
"MIT"
] | 1 | 06539a6fa9203b1e9dc9d4d944cfcd5f7603f5e9 | https://github.com/likui01/DRFuser/tree/06539a6fa9203b1e9dc9d4d944cfcd5f7603f5e9 |
Split | import torch
import torch.nn as nn
class Split(nn.Module):
def __init__(self):
super(Split, self).__init__()
def forward(self, x):
n = int(x.size(1) / 2)
x1 = x[:, :n, :, :].contiguous()
x2 = x[:, n:, :, :].contiguous()
return x1, x2
def inverse(self, x1, x2):
... | 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... | lingzenan/invertible-resnet | Split | false | 7,090 | [
"MIT"
] | 1 | 57b1c0de51a885aed074b77628f3b0c85c548e70 | https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70 |
squeeze | import torch
import torch.nn as nn
class squeeze(nn.Module):
def __init__(self, block_size):
super(squeeze, self).__init__()
self.block_size = block_size
self.block_size_sq = block_size * block_size
def inverse(self, input):
output = input.permute(0, 2, 3, 1)
batch_si... | 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... | lingzenan/invertible-resnet | squeeze | false | 7,091 | [
"MIT"
] | 1 | 57b1c0de51a885aed074b77628f3b0c85c548e70 | https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70 |
Conv2dZeroInit | import torch
import torch.nn as nn
class Conv2dZeroInit(nn.Conv2d):
def __init__(self, channels_in, channels_out, filter_size, stride=1,
padding=0, logscale=3.0):
super().__init__(channels_in, channels_out, filter_size, stride=
stride, padding=padding)
self.register_parameter(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | lingzenan/invertible-resnet | Conv2dZeroInit | false | 7,092 | [
"MIT"
] | 1 | 57b1c0de51a885aed074b77628f3b0c85c548e70 | https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70 |
DQN | import torch
import torch.nn.functional as F
from torch import nn
class DQN(nn.Module):
def __init__(self, observation_size, action_size, H1=200, H2=160, H3=
120, H4=60):
"""
:param observation_size: Size of belief as defined in belief_agent.py
:param action_size: Model has 1 out... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | lilianluong/multitask-card-games | DQN | false | 7,093 | [
"MIT"
] | 1 | ae32e85583c61cc27a44946a6b5fa7c1e2c152ff | https://github.com/lilianluong/multitask-card-games/tree/ae32e85583c61cc27a44946a6b5fa7c1e2c152ff |
MaxMinGroup | import torch
import torch.nn as nn
def process_maxmin_groupsize(x, group_size, axis=-1):
size = list(x.size())
num_channels = size[axis]
if num_channels % group_size:
raise ValueError(
'number of features({}) is not a multiple of group_size({})'.
format(num_channels, num_un... | 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... | lingzenan/invertible-resnet | MaxMinGroup | false | 7,094 | [
"MIT"
] | 1 | 57b1c0de51a885aed074b77628f3b0c85c548e70 | https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70 |
SpatialGate | import math
import torch
import torch.nn as nn
import torch.utils.data
from itertools import product as product
from math import sqrt as sqrt
class SpatialGate(nn.Module):
def __init__(self, in_channels: 'int', num_groups: 'int'=1, kernel_size:
'int'=1, padding: 'int'=0, stride: 'int'=1, gate_activation:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | lingtengqiu/LearnableTreeFilterV2 | SpatialGate | false | 7,095 | [
"Apache-2.0"
] | 1 | 3814a5a84c0a5c33d6538749eaf5aed4827366de | https://github.com/lingtengqiu/LearnableTreeFilterV2/tree/3814a5a84c0a5c33d6538749eaf5aed4827366de |
ClassificationCircleLoss | import torch
import torch.nn as nn
import torch.utils.data
from typing import Tuple
from torch.nn.functional import cross_entropy
from itertools import product as product
from math import sqrt as sqrt
class ClassificationCircleLoss(nn.Module):
"""Circle loss for class-level labels as described in the paper
`"... | 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
... | lingtengqiu/LearnableTreeFilterV2 | ClassificationCircleLoss | false | 7,096 | [
"Apache-2.0"
] | 1 | 3814a5a84c0a5c33d6538749eaf5aed4827366de | https://github.com/lingtengqiu/LearnableTreeFilterV2/tree/3814a5a84c0a5c33d6538749eaf5aed4827366de |
MeanVarFC | import torch
import torch.nn as nn
class MeanVarFC(nn.Module):
def __init__(self, input_shape):
super(MeanVarFC, self).__init__()
shape = list(input_shape)
shape[0] = 1
shape[1] *= 2
self.param = nn.Parameter(0.01 * torch.randn(shape))
def forward(self, 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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | lingzenan/invertible-resnet | MeanVarFC | false | 7,097 | [
"MIT"
] | 1 | 57b1c0de51a885aed074b77628f3b0c85c548e70 | https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70 |
SeparableConvBlock | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from itertools import product as product
from math import sqrt as sqrt
class Conv2dSamePadding(torch.nn.Conv2d):
"""
A wrapper around :class:`torch.nn.Conv2d` to support "SAME" padding mode and more features.
"""
def __i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.utils.data
import torch.nn.functional as F
from itertoo... | lingtengqiu/LearnableTreeFilterV2 | SeparableConvBlock | false | 7,098 | [
"Apache-2.0"
] | 1 | 3814a5a84c0a5c33d6538749eaf5aed4827366de | https://github.com/lingtengqiu/LearnableTreeFilterV2/tree/3814a5a84c0a5c33d6538749eaf5aed4827366de |
MultiHeadAttention | import math
import torch
import numpy as np
from torch import nn
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, input_dim, embed_dim, val_dim=None, key_dim
=None):
super(MultiHeadAttention, self).__init__()
if val_dim is None:
val_dim = embed_dim // n_heads
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | lin-bo/RL_back2depot_VRP | MultiHeadAttention | false | 7,099 | [
"MIT"
] | 1 | 2a159d1df221ff314d98d79b8fde2b739a454ff7 | https://github.com/lin-bo/RL_back2depot_VRP/tree/2a159d1df221ff314d98d79b8fde2b739a454ff7 |
EDMLoss | import torch
import torch.nn as nn
import torch.optim
class EDMLoss(nn.Module):
def __init__(self):
super(EDMLoss, self).__init__()
def forward(self, p_target: 'torch.Tensor', p_estimate: 'torch.Tensor'):
assert p_target.shape == p_estimate.shape
cdf_target = torch.cumsum(p_target, d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | lishiyu0088/Neural_Bradley-Terry | EDMLoss | false | 7,100 | [
"MIT"
] | 1 | ea2108267cf24c1fcfdf432e70810283d90495af | https://github.com/lishiyu0088/Neural_Bradley-Terry/tree/ea2108267cf24c1fcfdf432e70810283d90495af |
ActNorm | import torch
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parameter import Parameter
class ActNorm(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super(ActNorm, self).__init__()
self.eps = eps
self.num_channels = num_channels
self._log_scale = Param... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parame... | lingzenan/invertible-resnet | ActNorm | false | 7,101 | [
"MIT"
] | 1 | 57b1c0de51a885aed074b77628f3b0c85c548e70 | https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70 |
ActNorm2D | import torch
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parameter import Parameter
class ActNorm2D(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super(ActNorm2D, self).__init__()
self.eps = eps
self.num_channels = num_channels
self._log_scale = P... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
from torch.nn import Parameter
from torch.nn.parame... | lingzenan/invertible-resnet | ActNorm2D | false | 7,102 | [
"MIT"
] | 1 | 57b1c0de51a885aed074b77628f3b0c85c548e70 | https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70 |
SigmoidFocalClassificationLoss | import torch
import torch.nn as nn
def _sigmoid_cross_entropy_with_logits(logits, labels):
loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits)
loss += torch.log1p(torch.exp(-torch.abs(logits)))
return loss
class SigmoidFocalClassificationLoss(nn.Module):
"""Sigmoid focal cross entrop... | 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... | liuhuaijjin/rpn_rois_proposals_layers | SigmoidFocalClassificationLoss | false | 7,103 | [
"MIT"
] | 1 | c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 | https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 |
GAT | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLay... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | leiloong/PaperRobot | GAT | false | 7,104 | [
"MIT"
] | 1 | 070972dc1548571c28d89d2c54fb379e87d172c7 | https://github.com/leiloong/PaperRobot/tree/070972dc1548571c28d89d2c54fb379e87d172c7 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, ignore_target=-1):
super().__init__()
self.ignore_target = ignore_target
def forward(self, input, target):
"""
:param input: (N), logit
:param target: (N), {0, 1}
:return:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | liuhuaijjin/rpn_rois_proposals_layers | DiceLoss | false | 7,105 | [
"MIT"
] | 1 | c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 | https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 |
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/rpn_rois_proposals_layers | SmoothL1Loss | false | 7,106 | [
"MIT"
] | 1 | c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 | https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 |
LR_PAD | import torch
from torch import nn
def lr_pad(x, padding=1):
return torch.cat([x[..., -padding:], x, x[..., :padding]], dim=3)
class LR_PAD(nn.Module):
def __init__(self, padding=1):
super(LR_PAD, self).__init__()
self.padding = padding
def forward(self, x):
return lr_pad(x, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | lixuran/Room_Layout_Estimation_new | LR_PAD | false | 7,107 | [
"MIT"
] | 1 | 8e73b66e1418675e5bb82f3780091c406fe721d8 | https://github.com/lixuran/Room_Layout_Estimation_new/tree/8e73b66e1418675e5bb82f3780091c406fe721d8 |
Attention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import *
class Attention(nn.Module):
def __init__(self, opt):
super(Attention, self).__init__()
self.rnn_size = opt.rnn_size
self.att_hid_size = opt.att_hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | liuqihan/NeuralBabyTalk | Attention | false | 7,108 | [
"MIT"
] | 1 | 4a2ef428ec9f251a1eb898cc0c828a6ef1c55e69 | https://github.com/liuqihan/NeuralBabyTalk/tree/4a2ef428ec9f251a1eb898cc0c828a6ef1c55e69 |
RewardCriterion | import torch
import torch.nn as nn
from torch.autograd import *
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(self, input, seq, reward):
input = input.gather(2, seq.unsqueeze(2)).squeeze(2)
input = input.reshape(-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
import torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | linzhlalala/self-critical.pytorch | RewardCriterion | false | 7,109 | [
"MIT"
] | 1 | b856250ac52ba63656b1b03cdc3d7e830ed43f68 | https://github.com/linzhlalala/self-critical.pytorch/tree/b856250ac52ba63656b1b03cdc3d7e830ed43f68 |
MaskLoss | import torch
import torch.nn as nn
import torch.hub
class MaskLoss(nn.Module):
def __init__(self, size_average=None, reduce=None, reduction='mean'):
super(MaskLoss, self).__init__()
self.reduction = reduction
def forward(self, input, target):
N, _W = input.size()
torch.min(in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | lisadunlap/explainable-nbdt | MaskLoss | false | 7,110 | [
"MIT"
] | 1 | e045bfd0b55b21fd87c9a233b73a0ca77672efff | https://github.com/lisadunlap/explainable-nbdt/tree/e045bfd0b55b21fd87c9a233b73a0ca77672efff |
rbbox_corners_aligned | import torch
import torch.nn as nn
class rbbox_corners_aligned(nn.Module):
def _init_(self, gboxes):
super(rbbox_corners_aligned, self)._init_()
self.corners_gboxes = gboxes
return
def forward(ctx, gboxes):
"""
There is no rotation performed here. As axis are alig... | 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... | liuhuaijjin/rpn_rois_proposals_layers | rbbox_corners_aligned | false | 7,111 | [
"MIT"
] | 1 | c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 | https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 |
SpatialAttention | import torch
import torch.utils.data
from torch import nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=3):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv = 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
import torch.utils.data
from ... | ljjyxz123/CenterMask | SpatialAttention | false | 7,112 | [
"BSD-2-Clause"
] | 1 | 443eebde30e209eeb3b953f7ef35d3f7f14aaca5 | https://github.com/ljjyxz123/CenterMask/tree/443eebde30e209eeb3b953f7ef35d3f7f14aaca5 |
coRNNCell | import torch
from torch import nn
import torch.nn.utils
class coRNNCell(nn.Module):
def __init__(self, n_inp, n_hid, dt, gamma, epsilon):
super(coRNNCell, self).__init__()
self.dt = dt
self.gamma = gamma
self.epsilon = epsilon
self.i2h = nn.Linear(n_inp + n_hid + n_hid, 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.triton_helpers import libdevice
from torch import n... | lkampoli/coRNN | coRNNCell | false | 7,113 | [
"MIT"
] | 1 | c9c2edfebab289f3053eb48030f273e4b977a187 | https://github.com/lkampoli/coRNN/tree/c9c2edfebab289f3053eb48030f273e4b977a187 |
CatCombine | import torch
import torch.nn as nn
import torch.utils
class CatCombine(nn.Module):
def __init__(self, C):
super(CatCombine, self).__init__()
self.compress = nn.Linear(C * 2, C)
def forward(self, x, y):
return self.compress(torch.cat((x, y), dim=-1))
def get_inputs():
return [to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils
assert_size_stride = torch._C._dynamo.g... | lorylei/DARTS-et | CatCombine | false | 7,114 | [
"Apache-2.0"
] | 1 | f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8 | https://github.com/lorylei/DARTS-et/tree/f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8 |
FBANKNormalizer | from _paritybench_helpers import _mock_config
import torch
import torch.utils.data
class FBANKNormalizer(torch.nn.Module):
def __init__(self, config):
super(FBANKNormalizer, self).__init__()
self.num_mel_bins = config.num_mel_bins
self.weight = torch.nn.Parameter(torch.tensor([1 / 10] * 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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | lorenlugosch/autoregressive-models | FBANKNormalizer | false | 7,115 | [
"Apache-2.0"
] | 1 | 2c50bc331d3b68cc7144f7456591bbc2321cc658 | https://github.com/lorenlugosch/autoregressive-models/tree/2c50bc331d3b68cc7144f7456591bbc2321cc658 |
CNNLayerNorm | import torch
import torch.nn as nn
class CNNLayerNorm(nn.Module):
"""Layer normalization built for cnns input"""
def __init__(self, n_feats: 'int'):
super(CNNLayerNorm, self).__init__()
self.layer_norm = nn.LayerNorm(n_feats)
def forward(self, x: 'torch.tensor') ->torch.tensor:
x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | loopdigga96/numbers_recognition | CNNLayerNorm | false | 7,116 | [
"Apache-2.0"
] | 1 | dd1110d3fd18b5ca20278a010c550aeaad495e19 | https://github.com/loopdigga96/numbers_recognition/tree/dd1110d3fd18b5ca20278a010c550aeaad495e19 |
CausalPad | import torch
import torch.utils.data
class CausalPad(torch.nn.Module):
def __init__(self):
super(CausalPad, self).__init__()
def forward(self, input):
return torch.nn.functional.pad(input, (0, 0, 1, 0))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
re... | 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_... | lorenlugosch/autoregressive-models | CausalPad | false | 7,117 | [
"Apache-2.0"
] | 1 | 2c50bc331d3b68cc7144f7456591bbc2321cc658 | https://github.com/lorenlugosch/autoregressive-models/tree/2c50bc331d3b68cc7144f7456591bbc2321cc658 |
_Residual_Block | import torch
import torch.nn as nn
class _Residual_Block(nn.Module):
def __init__(self):
super(_Residual_Block, self).__init__()
self.conv1 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size
=3, stride=1, padding=1, bias=False)
self.in1 = nn.InstanceNorm2d(64, affine=Tru... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | liruilong940607/SRResnet | _Residual_Block | false | 7,118 | [
"MIT"
] | 1 | 928b1c076bfa051dffd5165ea966af5dfd9c372d | https://github.com/liruilong940607/SRResnet/tree/928b1c076bfa051dffd5165ea966af5dfd9c372d |
FC_Layer | import torch
import torch.nn as nn
def standardize(param, assert_length):
if type(param) is not list and type(param) is not tuple:
param = [param] * assert_length
assert len(param
) == assert_length, 'expect %s input params, got %s input parameter' % (
assert_length, len(param))
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | loveorchids/omni_torch | FC_Layer | false | 7,119 | [
"Apache-2.0"
] | 1 | 9bd654387619c0cbc6aee9e91482ecc9200138ef | https://github.com/loveorchids/omni_torch/tree/9bd654387619c0cbc6aee9e91482ecc9200138ef |
Conv | import torch
import torch.utils.data
import torch.utils
import torch.utils.checkpoint
class Conv(torch.nn.Module):
def __init__(self, in_dim, out_dim, filter_length, stride):
super(Conv, self).__init__()
self.conv = torch.nn.Conv1d(in_channels=in_dim, out_channels=
out_dim, kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.utils
import torch.utils.checkpoint
assert_... | lorenlugosch/graves-transducers | Conv | false | 7,120 | [
"Apache-2.0"
] | 1 | 489f46d58eba35d34163bb8b887c31d6e043c990 | https://github.com/lorenlugosch/graves-transducers/tree/489f46d58eba35d34163bb8b887c31d6e043c990 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.LayerNorm):
def __init__(self, normalized_shape, eps=1e-05, elementwise_affine=True):
"""Layer Norm."""
super(LayerNorm, self).__init__(normalized_shape, eps=eps,
elementwise_affine=elementwise_affine)
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | lorinczb/pytorch-dc-tts | LayerNorm | false | 7,121 | [
"MIT"
] | 1 | 9dae50678113e2f60ad0752b99b959bb0b11dfc9 | https://github.com/lorinczb/pytorch-dc-tts/tree/9dae50678113e2f60ad0752b99b959bb0b11dfc9 |
mbr_convex_hull | import torch
import torch.nn as nn
class mbr_convex_hull(nn.Module):
"""
Miminum Bounding Rectangle (MBR)
Algorithm core: The orientation of the MBR is the same as the one of one of the edges of the point cloud convex hull, which means
the result rectangle must overlap with at least one of... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | liuhuaijjin/rpn_rois_proposals_layers | mbr_convex_hull | false | 7,122 | [
"MIT"
] | 1 | c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 | https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1 |
Joiner | from _paritybench_helpers import _mock_config
import torch
import torch.utils.data
import torch.utils
import torch.utils.checkpoint
class Joiner(torch.nn.Module):
def __init__(self, config):
super(Joiner, self).__init__()
self.tanh = torch.nn.Tanh()
self.num_outputs = config.num_tokens + ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | lorenlugosch/graves-transducers | Joiner | false | 7,123 | [
"Apache-2.0"
] | 1 | 489f46d58eba35d34163bb8b887c31d6e043c990 | https://github.com/lorenlugosch/graves-transducers/tree/489f46d58eba35d34163bb8b887c31d6e043c990 |
Upsample | import torch
import torch.nn as nn
class Upsample(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.conv1x1 = nn.Conv2d(in_channels, in_channels, kernel_size=1,
stride=1, padding=0)
self.conv3x3 = nn.Conv2d(in_channels, out_channels, kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | loong8888/TextSnake.pytorch | Upsample | false | 7,124 | [
"MIT"
] | 1 | 49c24f71043c1895b91f8c7379995037fcc644f7 | https://github.com/loong8888/TextSnake.pytorch/tree/49c24f71043c1895b91f8c7379995037fcc644f7 |
AR | import torch
import torch.nn as nn
class AR(nn.Module):
def __init__(self, window: 'int', hidden_size: 'int'):
super(AR, self).__init__()
self.linear = nn.Linear(window, hidden_size)
def forward(self, x):
x = torch.transpose(x, 1, 2)
x = self.linear(x)
x = torch.trans... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | lucianolorenti/rul_pm | AR | false | 7,125 | [
"MIT"
] | 1 | da9dfad79129dd47d24923cfd6c833869ef7b6a7 | https://github.com/lucianolorenti/rul_pm/tree/da9dfad79129dd47d24923cfd6c833869ef7b6a7 |
JS_Divergence | import torch
import torch.nn as nn
class JS_Divergence(nn.Module):
def __init__(self):
super().__init__()
self.engine = nn.KLDivLoss()
def forward(self, x, y):
return self.engine(x, y) + self.engine(y, x)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 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, math as tl_math
import torc... | loveorchids/omni_torch | JS_Divergence | false | 7,126 | [
"Apache-2.0"
] | 1 | 9bd654387619c0cbc6aee9e91482ecc9200138ef | https://github.com/loveorchids/omni_torch/tree/9bd654387619c0cbc6aee9e91482ecc9200138ef |
mlp | import torch
import torch.nn as nn
class mlp(nn.Module):
def __init__(self, seq_len):
super(mlp, self).__init__()
self.lin1 = nn.Linear(seq_len, 2048)
self.lin2 = nn.Linear(2048, 2048)
self.lin3 = nn.Linear(2048, seq_len)
self.relu = nn.ReLU()
def forward(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
import torch.nn as nn
assert_... | liuziyang1106/TSAN-brain-age-estimation | mlp | false | 7,127 | [
"MIT"
] | 1 | 374b481291edb9516ee9871a53f7acb6a2eeaebc | https://github.com/liuziyang1106/TSAN-brain-age-estimation/tree/374b481291edb9516ee9871a53f7acb6a2eeaebc |
Swish | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
self.beta = nn.Parameter(torch.ones(1))
def forward(self, x):
return x * F.sigmoid(self.beta * x)
def get_inputs():
re... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | lorylei/DARTS-et | Swish | false | 7,128 | [
"Apache-2.0"
] | 1 | f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8 | https://github.com/lorylei/DARTS-et/tree/f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8 |
SpatialAttention | import torch
from torch import nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super().__init__()
self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding=
kernel_size // 2)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
max_result,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | lulor/project_vg | SpatialAttention | false | 7,129 | [
"MIT"
] | 1 | 27b0c3b3038c5a666dde516a0a265ae8ddf2059f | https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f |
Predict_Network1 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class LayerNorm(nn.Module):
"""
Simple 1D LayerNorm.
""... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ltzheng/CDS | Predict_Network1 | false | 7,130 | [
"Apache-2.0"
] | 1 | 397282147498647a9f26577adfa451e8478de76d | https://github.com/ltzheng/CDS/tree/397282147498647a9f26577adfa451e8478de76d |
MLP | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self, in_features, out_features):
super().__init__()
self.in_features = in_features
self.out_features = out_features
self.fc1 = nn.Linear(in_features, in_features // 2)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | luogan1234/movie-dialog-project | MLP | false | 7,131 | [
"MIT"
] | 1 | 17ac4a10c069c6b4c41bb675b98a35b2182cf504 | https://github.com/luogan1234/movie-dialog-project/tree/17ac4a10c069c6b4c41bb675b98a35b2182cf504 |
MLPLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLPLayer(nn.Module):
def __init__(self, in_dim, out_dim):
super().__init__()
self.in_dim = in_dim
mid_dim = in_dim // 2
self.out_dim = out_dim
self.fc1 = nn.Linear(in_dim, mid_dim)
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | luogan1234/prerequisite-prediction-co-training | MLPLayer | false | 7,132 | [
"MIT"
] | 1 | 28e3f241ada5afe75a73525375087be230735c2a | https://github.com/luogan1234/prerequisite-prediction-co-training/tree/28e3f241ada5afe75a73525375087be230735c2a |
ANN | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class ANN(nn.Module):
def __init__(self, args, name):
super(ANN, self).__init__()
self.name = name
self.len = 0
self.loss = 0
self.fc1 = nn.Linear(args.input_dim, 20)
self.relu = nn.ReL... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | luoyang97/FedProx-PyTorch | ANN | false | 7,133 | [
"MIT"
] | 1 | b19263e22420251ad8c3a9701951a37b5c0a3569 | https://github.com/luoyang97/FedProx-PyTorch/tree/b19263e22420251ad8c3a9701951a37b5c0a3569 |
Predict_Network1_combine | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class LayerNorm(nn.Module):
"""
Simple 1D LayerNorm.
""... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ltzheng/CDS | Predict_Network1_combine | false | 7,134 | [
"Apache-2.0"
] | 1 | 397282147498647a9f26577adfa451e8478de76d | https://github.com/ltzheng/CDS/tree/397282147498647a9f26577adfa451e8478de76d |
GeM | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class GeM(nn.Module):
def __init__(self, p=3, eps=1e-06):
super(GeM, self).__init__()
self.p = Parameter(torch.ones(1) * p)
self.eps = eps
def forward(self, x):
return F... | 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
from to... | lulor/project_vg | GeM | false | 7,135 | [
"MIT"
] | 1 | 27b0c3b3038c5a666dde516a0a265ae8ddf2059f | https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f |
SEModule | import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
retu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 torchvision.transforms i... | ljjyxz123/CenterMask | SEModule | false | 7,136 | [
"BSD-2-Clause"
] | 1 | 443eebde30e209eeb3b953f7ef35d3f7f14aaca5 | https://github.com/ljjyxz123/CenterMask/tree/443eebde30e209eeb3b953f7ef35d3f7f14aaca5 |
Conv2d | import torch
import torch.nn as nn
import torch.utils
class Conv2d(nn.Module):
def __init__(self, C_in, C_out, kernel_size, padding):
super(Conv2d, self).__init__()
self.conv = nn.Conv2d(C_in, C_out, kernel_size=kernel_size, stride=
1, padding=padding)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils
assert_size_stride = torch._C._dynamo.g... | lorylei/DARTS-et | Conv2d | false | 7,137 | [
"Apache-2.0"
] | 1 | f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8 | https://github.com/lorylei/DARTS-et/tree/f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8 |
GeneralizedMeanPooling | import torch
from torch import nn
from torch.optim.lr_scheduler import *
from torch.optim import *
class GeneralizedMeanPooling(nn.Module):
"""Applies a 2D power-average adaptive pooling over an input signal composed of several input planes.
The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)`
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | lxc86739795/fast-reid | GeneralizedMeanPooling | false | 7,138 | [
"Apache-2.0"
] | 1 | 29178d70c591ef64021f10767eb606f3053156b9 | https://github.com/lxc86739795/fast-reid/tree/29178d70c591ef64021f10767eb606f3053156b9 |
net2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class net2(nn.Module):
"""
"""
def __init__(self, n_classes=2):
super(net2, self).__init__()
if torch.cuda.is_available():
torch.device('cuda')
else:
torch.device('cpu')
self.n_class... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | luisesanmartin/dwelling-recognition | net2 | false | 7,139 | [
"MIT"
] | 1 | b2437b64088a26746947c1c88077c96332e7b9c6 | https://github.com/luisesanmartin/dwelling-recognition/tree/b2437b64088a26746947c1c88077c96332e7b9c6 |
LSTM | import torch
import torch.utils.data
import torch.nn
import torch.optim
import torch.nn as nn
from torch.autograd import Variable
class LSTM(nn.Module):
def __init__(self, input_size, hidden_size, output_size=1, cell_size=2):
super(LSTM, self).__init__()
self.hidden_size = hidden_size
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.... | lwaekfjlk/Light-the-Torch | LSTM | false | 7,140 | [
"MIT"
] | 1 | eed1df3d28016aee86385959b5e94e2108ee0571 | https://github.com/lwaekfjlk/Light-the-Torch/tree/eed1df3d28016aee86385959b5e94e2108ee0571 |
Attloss | import torch
import torch.nn as nn
import torch.nn.functional
class Attloss(nn.Module):
def __init__(self):
super(Attloss, self).__init__()
self.bce = nn.BCEWithLogitsLoss()
def forward(self, x_org, y_mask, att):
loss_att = ((x_org * y_mask[:, 1, ...].unsqueeze(dim=1) - att) ** 2
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.functional
assert_size_stride = torch._C._dynamo.gu... | lvxiuwang/ferattention | Attloss | false | 7,141 | [
"MIT"
] | 1 | 02e97df4a12129ed6706bddf0d2109650eae8765 | https://github.com/lvxiuwang/ferattention/tree/02e97df4a12129ed6706bddf0d2109650eae8765 |
SOSLoss | import torch
from torch import nn
class SOSLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, anchors, positives, negatives):
dist_an = torch.sum(torch.pow(anchors - negatives, 2), dim=1)
dist_pn = torch.sum(torch.pow(positives - negatives, 2), dim=1)
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.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | lulor/project_vg | SOSLoss | false | 7,142 | [
"MIT"
] | 1 | 27b0c3b3038c5a666dde516a0a265ae8ddf2059f | https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f |
AttentionLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
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)
self.linear2 = nn.Linear(hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | lost-person/AREL | AttentionLayer | false | 7,143 | [
"MIT"
] | 1 | cee8bc542a2226f41fcbf65ed805fd585512689d | https://github.com/lost-person/AREL/tree/cee8bc542a2226f41fcbf65ed805fd585512689d |
MultiHeadAttention | import math
import torch
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, dropout=0.0):
super(ScaledDotProductAttention, self).__init__()
self.dropout = nn.Dropout(dropout)
def forward(self, query, key, value):
assert query.size()[-1] == key.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.... | luyu-fan/LRCM | MultiHeadAttention | false | 7,144 | [
"MIT"
] | 1 | 6b0e4d7998bc4969afa764eb753077e3f858f1ba | https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba |
ComprehensionLayer_step3 | import math
import torch
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, dropout=0.0):
super(ScaledDotProductAttention, self).__init__()
self.dropout = nn.Dropout(dropout)
def forward(self, query, key, value):
assert query.size()[-1] == key.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.... | luyu-fan/LRCM | ComprehensionLayer_step3 | false | 7,145 | [
"MIT"
] | 1 | 6b0e4d7998bc4969afa764eb753077e3f858f1ba | https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba |
Tanh | import torch
import torch.utils.data
import torch.nn as nn
import torch._utils
from torch import optim as optim
import torch.nn.parallel
class Tanh(nn.Module):
def __init__(self, inplace=False):
super(Tanh, self).__init__()
self.inplace = inplace
def forward(self, x):
return x.tanh_(... | 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.utils.data
import torch.nn as nn
import torch._utils
from torch im... | lovelinability/pytorch_image_models | Tanh | false | 7,146 | [
"Apache-2.0"
] | 1 | 7c54200f3de7611ab1222a37088eb7f66ae2858f | https://github.com/lovelinability/pytorch_image_models/tree/7c54200f3de7611ab1222a37088eb7f66ae2858f |
LayerNormalization | import torch
import torch.nn as nn
class LayerNormalization(nn.Module):
def __init__(self, d_hid, eps=0.001):
super(LayerNormalization, self).__init__()
self.gamma = nn.Parameter(torch.ones(d_hid), requires_grad=True)
self.beta = nn.Parameter(torch.zeros(d_hid), requires_grad=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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | lz-chen/ner-bert | LayerNormalization | false | 7,147 | [
"MIT"
] | 1 | 86e73c1e7124a4fb6ee65d42b72333573841fe5b | https://github.com/lz-chen/ner-bert/tree/86e73c1e7124a4fb6ee65d42b72333573841fe5b |
Conv2dUntiedBias | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
class Conv2dUntiedBias(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, input_len,
stride=1, padding=0, dilation=1, groups=1):
super(Conv2dUntiedBias, 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 math
import torch.nn as nn
from torch.nn.modules.utils import _pair
asser... | lzamparo/SeqDemote | Conv2dUntiedBias | false | 7,148 | [
"MIT"
] | 1 | 3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a | https://github.com/lzamparo/SeqDemote/tree/3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a |
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, reduce=True, gamma=1.5, alpha=0.7):
super(FocalLoss, self).__init__()
self.reduce = reduce
self.gamma = gamma
self.alpha = alpha
def _get_weights(self, x, t):
"""
Helper to get t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | lzamparo/SeqDemote | FocalLoss | false | 7,149 | [
"MIT"
] | 1 | 3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a | https://github.com/lzamparo/SeqDemote/tree/3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a |
SoftTargetCrossEntropy | import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
import torch._utils
from torch import optim as optim
import torch.nn.parallel
class SoftTargetCrossEntropy(nn.Module):
def __init__(self):
super(SoftTargetCrossEntropy,... | 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.dat... | lovelinability/pytorch_image_models | SoftTargetCrossEntropy | false | 7,150 | [
"Apache-2.0"
] | 1 | 7c54200f3de7611ab1222a37088eb7f66ae2858f | https://github.com/lovelinability/pytorch_image_models/tree/7c54200f3de7611ab1222a37088eb7f66ae2858f |
SimpleConv | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleConv(nn.Module):
def __init__(self):
super(SimpleConv, self).__init__()
self.conv1 = nn.Conv2d(3, 50, 5, 1)
self.conv2 = nn.Conv2d(50, 100, 5, 1)
self.fc1 = nn.Linear(21 * 21 * 100, 1600)
self.f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | junoon53/pcam_challenge | SimpleConv | false | 7,151 | [
"MIT"
] | 1 | 283c98b2d2e211424cdcb56d8230a7a29dc5af46 | https://github.com/junoon53/pcam_challenge/tree/283c98b2d2e211424cdcb56d8230a7a29dc5af46 |
BilinearConvLayer | import torch
def setup_conv(in_channels, out_channels, kernel_size, bias, padding_mode,
stride=1, Conv=torch.nn.Conv2d):
return Conv(in_channels=in_channels, out_channels=out_channels,
kernel_size=kernel_size, padding=(kernel_size - 1) // 2, stride=
stride, bias=bias)
class BilinearConvLayer... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | m-dml/lil2021swe | BilinearConvLayer | false | 7,152 | [
"Apache-2.0"
] | 1 | 45352f214ec28c9f91dd24ed3669f492d8b68382 | https://github.com/m-dml/lil2021swe/tree/45352f214ec28c9f91dd24ed3669f492d8b68382 |
FFN | import math
import torch
import torch.nn as nn
class GELU(nn.Module):
"""
Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU
came from : https://github.com/codertimo/BERT-pytorch/blob/master/bert_pytorch/model/utils/gelu.py
"""
def __init__(self):
super(GELU,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | luyu-fan/LRCM | FFN | false | 7,153 | [
"MIT"
] | 1 | 6b0e4d7998bc4969afa764eb753077e3f858f1ba | https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba |
CRN | import torch
import torch.nn.functional as F
class CRN(torch.nn.Module):
def __init__(self, dim):
super(CRN, self).__init__()
self.h_w = 13, 13
self.downsample = torch.nn.AdaptiveAvgPool2d(self.h_w)
n_filters = [32, 32, 20]
self.conv1 = torch.nn.Conv2d(dim, n_filters[0], 3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | lulor/project_vg | CRN | false | 7,154 | [
"MIT"
] | 1 | 27b0c3b3038c5a666dde516a0a265ae8ddf2059f | https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f |
DeepLiftRegressor | import torch
import torch.nn as nn
import torch.nn.functional as F
class DeepLiftRegressor(nn.Module):
def __init__(self):
super(DeepLiftRegressor, self).__init__()
self.conv1 = nn.Conv2d(in_channels=4, out_channels=50, kernel_size=
(1, 11))
self.conv2 = nn.Conv2d(in_channels=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | lzamparo/SeqDemote | DeepLiftRegressor | false | 7,155 | [
"MIT"
] | 1 | 3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a | https://github.com/lzamparo/SeqDemote/tree/3eaf18e88c9dc6a3d1a69444ecdba9f9b5d9682a |
MultiHeadAttention | import math
import torch
import numpy as np
import torch.nn as nn
def logistic(x, c=1, a=20, b=np.e):
return c / (1 + a * b ** -x)
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(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
import ... | lysecret2/explainability-simulation | MultiHeadAttention | false | 7,156 | [
"MIT"
] | 1 | e558f6f527ac2ff66f00fcb37aeeaf404c32ff66 | https://github.com/lysecret2/explainability-simulation/tree/e558f6f527ac2ff66f00fcb37aeeaf404c32ff66 |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
"""l2-normalization as layer. """
def __init__(self, *, eps: float=1e-10) ->None:
super().__init__()
self.eps = eps
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
norm = torch.sqrt(torch.sum(x * x, dim=-1) + self.e... | 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_... | manyids2/mkd_pytorch | L2Norm | false | 7,157 | [
"MIT"
] | 1 | fb97c4285f93f38371b2aac904a133f970be247e | https://github.com/manyids2/mkd_pytorch/tree/fb97c4285f93f38371b2aac904a133f970be247e |
MLP_VAE | import torch
from torch import nn
class MLP_VAE(nn.Module):
def __init__(self, ZDIMS):
super().__init__()
self.z_dims = ZDIMS
self.fc1 = nn.Linear(1024, 400)
self.relu = nn.ReLU()
self.fc21 = nn.Linear(400, ZDIMS)
self.fc22 = nn.Linear(400, ZDIMS)
self.fc3 ... | 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... | manuelladron/artistic_style_robotic_painting | MLP_VAE | false | 7,158 | [
"MIT"
] | 1 | 3769fc470bb4f69d2ea77d2713e4eb9bf0eaa4e9 | https://github.com/manuelladron/artistic_style_robotic_painting/tree/3769fc470bb4f69d2ea77d2713e4eb9bf0eaa4e9 |
SoftDiceLoss | import torch
import torch.nn as nn
class SoftDiceLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logits, labels):
probs = torch.sigmoid(logits)
num = labels.size(0)
m1 = probs.view(num, -1)
m2 = labels.view(num, -1)
intersection = m1 ... | 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... | marcomatteo/steel-segmentation-nbdev | SoftDiceLoss | false | 7,159 | [
"Apache-2.0"
] | 1 | dde19b0b3bf7657ab575e691bca1751592aecc67 | https://github.com/marcomatteo/steel-segmentation-nbdev/tree/dde19b0b3bf7657ab575e691bca1751592aecc67 |
ResizeTransform | import torch
import torch.nn as nn
import torch.nn.functional as nnf
class ResizeTransform(nn.Module):
"""
Resize a transform, which involves resizing the vector field *and* rescaling it.
"""
def __init__(self, vel_resize, ndims):
super().__init__()
self.factor = 1.0 / vel_resize
... | 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... | mariakesa/ZebraFishRegistrationPipeline | ResizeTransform | false | 7,160 | [
"MIT"
] | 1 | 4955044eb69dc04c579f59ccb24e02e4451aebcc | https://github.com/mariakesa/ZebraFishRegistrationPipeline/tree/4955044eb69dc04c579f59ccb24e02e4451aebcc |
BahdanauAttention | import torch
from torch import Tensor
import torch.nn as nn
from typing import Tuple
import torch.nn.functional as F
class BahdanauAttention(nn.Module):
def __init__(self, dec_dim: 'int', enc_dim: 'int', num_hiddens: 'int'):
super().__init__()
self.W1 = nn.Linear(dec_dim, num_hiddens, 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 import triton_helpers
from torch._inductor.runtime.... | manhtrantienhn/Sentiment-with-pretrain-model | BahdanauAttention | false | 7,161 | [
"MIT"
] | 1 | bbbbaa94cf481afcfe704cbcb27b602308f43de5 | https://github.com/manhtrantienhn/Sentiment-with-pretrain-model/tree/bbbbaa94cf481afcfe704cbcb27b602308f43de5 |
CRF | import torch
import torch.utils.data.dataloader
import torch.nn
class CRF(torch.nn.Module):
"""
Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod).
Classifier which predicts single tag / class / label for given word based on not just the word,
but also on previ... | 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.dataloader
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | marleneDebatin/flair | CRF | false | 7,162 | [
"MIT"
] | 1 | 4d17509f358158f66d43e85db1b6990523b0b095 | https://github.com/marleneDebatin/flair/tree/4d17509f358158f66d43e85db1b6990523b0b095 |
FocalLoss | import torch
import torch.nn.functional as F
from torch import nn as nn
class FocalLoss(nn.Module):
"""Focal loss function for imbalanced dataset.
Args:
alpha (float): weighing factor between 0 and 1. Alpha may be set by inverse
class frequency
gamma (float): modulati... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | marshuang80/pe-slice-finder | FocalLoss | false | 7,163 | [
"Apache-2.0"
] | 1 | 2426a55c404e8eb694110351d604d6bdd613e5ae | https://github.com/marshuang80/pe-slice-finder/tree/2426a55c404e8eb694110351d604d6bdd613e5ae |
TFBCELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class TFBCELoss(nn.Module):
def __init__(self, pos_weight):
super().__init__()
self.pos_weight = pos_weight
def forward(self, logits, targets):
relu_logits = F.relu(logits)
neg_abs_logits = -torch.abs(logits)
... | 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... | marload/DAFT | TFBCELoss | false | 7,164 | [
"Apache-2.0"
] | 1 | 22ebe1cc1d1ca8d4b1f7557bf5833983c63ba330 | https://github.com/marload/DAFT/tree/22ebe1cc1d1ca8d4b1f7557bf5833983c63ba330 |
PyramidDown | import torch
import torch.nn as nn
from torch.nn import functional as F
class PyramidDown(nn.Module):
def __init__(self) ->None:
super(PyramidDown, self).__init__()
self.filter = nn.Parameter(torch.tensor([[1, 4, 6, 4, 1], [4, 16,
24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 16, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | masanorihirano/pytorch_extra_mhirano | PyramidDown | false | 7,165 | [
"MIT"
] | 1 | d19e07445567c069793b7ca1a22a846d7cbce58d | https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d |
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(3, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = 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
from torch._inductor.runtime.... | lzhbrian/FashionAI-1 | Net | false | 7,166 | [
"MIT"
] | 1 | 1fede16044c8a4516ba4dd6766add44d47245f6b | https://github.com/lzhbrian/FashionAI-1/tree/1fede16044c8a4516ba4dd6766add44d47245f6b |
DotProductAttention | import math
import torch
import warnings
from typing import Optional
from typing import Tuple
import torch.nn as nn
class DotProductAttention(nn.Module):
"""DotProductAttention.
.. math::
\\mathrm{DotProductAttention}(Q, K, V) &=& \\mathrm{softmax}(qk^T) v
q &=& QW_1 + b_1
k &=& KW... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | masanorihirano/pytorch_extra_mhirano | DotProductAttention | false | 7,167 | [
"MIT"
] | 1 | d19e07445567c069793b7ca1a22a846d7cbce58d | https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d |
KLDivLoss | import torch
from typing import Optional
from torch.nn import functional as F
from torch.nn.modules.loss import _Loss
class KLDivLoss(_Loss):
def __init__(self, size_average: 'Optional[bool]'=None, reduce:
'Optional[bool]'=None, reduction: 'str'='mean') ->None:
super(KLDivLoss, self).__init__(siz... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from typing... | masanorihirano/pytorch_extra_mhirano | KLDivLoss | false | 7,168 | [
"MIT"
] | 1 | d19e07445567c069793b7ca1a22a846d7cbce58d | https://github.com/masanorihirano/pytorch_extra_mhirano/tree/d19e07445567c069793b7ca1a22a846d7cbce58d |
VGGBase | import torch
import torchvision
from torch import nn
import torch.nn.functional as F
from itertools import product as product
import torch.optim
import torch.utils.data
def decimate(tensor, m):
"""
Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value.
This is used when we conve... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 torchvision
from torch... | dee-walia20/SSD-Implementation-using-Pytorch | VGGBase | false | 7,169 | [
"MIT"
] | 1 | 2a7dcdcea2787f4bffd45f335819f08af2b525dd | https://github.com/dee-walia20/SSD-Implementation-using-Pytorch/tree/2a7dcdcea2787f4bffd45f335819f08af2b525dd |
ComprehensionLayer_step1 | import math
import torch
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, dropout=0.0):
super(ScaledDotProductAttention, self).__init__()
self.dropout = nn.Dropout(dropout)
def forward(self, query, key, value):
assert query.size()[-1] == key.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.... | luyu-fan/LRCM | ComprehensionLayer_step1 | false | 7,170 | [
"MIT"
] | 1 | 6b0e4d7998bc4969afa764eb753077e3f858f1ba | https://github.com/luyu-fan/LRCM/tree/6b0e4d7998bc4969afa764eb753077e3f858f1ba |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.