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 |
|---|---|---|---|---|---|---|---|---|---|---|
Res | import torch
from torch import nn
import torch.distributions
class Res(nn.Module):
def __init__(self, H):
super().__init__()
self.u1 = nn.Linear(H, H)
self.u2 = nn.Linear(H, H)
self.v1 = nn.Linear(H, H)
self.v2 = nn.Linear(H, H)
self.w = nn.Linear(H, H)
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
import t... | w-cheng/pytorch-struct | Res | false | 13,071 | [
"MIT"
] | 0 | e51fecc1473925e4c44de135c4a3240fcb20fa40 | https://github.com/w-cheng/pytorch-struct/tree/e51fecc1473925e4c44de135c4a3240fcb20fa40 |
DAInsHead | import torch
import torch.utils.data
from torchvision.transforms import functional as F
from torch import nn
import torch.nn.functional as F
class DAInsHead(nn.Module):
"""
Adds a simple Instance-level Domain Classifier head
"""
def __init__(self, in_channels):
"""
Arguments:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | thesuperorange/Domain-Adaptive-Faster-RCNN-PyTorch | DAInsHead | false | 13,072 | [
"MIT"
] | 0 | bcde744a486b25ec1d6e4b023da3ce0c8e5d72a7 | https://github.com/thesuperorange/Domain-Adaptive-Faster-RCNN-PyTorch/tree/bcde744a486b25ec1d6e4b023da3ce0c8e5d72a7 |
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, 1)
self.conv2 = nn.Conv2d(32, 64, 3, 1)
self.dropout1 = nn.Dropout2d(0.25)
self.dropout2 = 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
from torch._inductor.runtime.... | v01dXYZ/petastorm | Net | false | 13,073 | [
"Apache-2.0"
] | 0 | d6f4e82eb2c3a6c2b4c16c060c7350331b60a51a | https://github.com/v01dXYZ/petastorm/tree/d6f4e82eb2c3a6c2b4c16c060c7350331b60a51a |
GlobalAttention | import torch
import torch.nn as nn
import torch.cuda
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not all arguments have the same value: ' + str(args)
def se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | vvjn/MultimodalNMT | GlobalAttention | false | 13,074 | [
"MIT"
] | 0 | 2d69588a5b640290602b4f6d7e4120ae9742c1c2 | https://github.com/vvjn/MultimodalNMT/tree/2d69588a5b640290602b4f6d7e4120ae9742c1c2 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self).__init__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | vincentlux/TextBrewer | BertAttention | false | 13,075 | [
"Apache-2.0"
] | 0 | 51ffbf390a0b69ee51b6ad6f5045be63e21c98e3 | https://github.com/vincentlux/TextBrewer/tree/51ffbf390a0b69ee51b6ad6f5045be63e21c98e3 |
ConvNet | import torch
import torch.nn as nn
class ConvNet(nn.Module):
"""
A network with a single convolution layer. This is used for testing flop
count for convolution layers.
"""
def __init__(self, conv_dim: 'int', input_dim: 'int', output_dim: 'int',
kernel_size: 'int', spatial_dim: 'int', stri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | wangg12/fvcore | ConvNet | false | 13,076 | [
"Apache-2.0"
] | 0 | aca6e95b3319144ec3c66385ff348c1557a2147f | https://github.com/wangg12/fvcore/tree/aca6e95b3319144ec3c66385ff348c1557a2147f |
AEC | import torch
import numpy as np
import torch.nn.functional as F
from torch import nn
class AEC(nn.Module):
def __init__(self, hidden_nodes, conv_width, pixel_patchsize,
lambda_activation):
super(AEC, self).__init__()
self.hidden_nodes = hidden_nodes
self.conv_width = conv_width
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | vdutell/biophys_encoder | AEC | false | 13,077 | [
"Apache-2.0"
] | 0 | 2ca8011338c4f1eb6b50e7cb74e07d105d1e9669 | https://github.com/vdutell/biophys_encoder/tree/2ca8011338c4f1eb6b50e7cb74e07d105d1e9669 |
UpConv | import torch
import torch.nn as nn
from collections import OrderedDict
class UpConv(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.up_conv = nn.Sequential(OrderedDict([('up', nn.Upsample(
scale_factor=2)), ('conv', nn.Conv2d(in_channels, in_channels //
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from collections import OrderedDict
assert_size_stride = t... | wan2000/ssdf-perception | UpConv | false | 13,078 | [
"MIT"
] | 0 | df91bfb60f0d1b324fecada3d99d3498ca5794b0 | https://github.com/wan2000/ssdf-perception/tree/df91bfb60f0d1b324fecada3d99d3498ca5794b0 |
ThreeNet | import torch
import torch.nn as nn
class ThreeNet(nn.Module):
"""
A network with three layers. This is used for testing a network with more
than one operation. The network has a convolution layer followed by two
fully connected layers.
"""
def __init__(self, input_dim: 'int', conv_dim: 'int',... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | wangg12/fvcore | ThreeNet | false | 13,079 | [
"Apache-2.0"
] | 0 | aca6e95b3319144ec3c66385ff348c1557a2147f | https://github.com/wangg12/fvcore/tree/aca6e95b3319144ec3c66385ff348c1557a2147f |
Attention_layer | import torch
from torch import nn
class Attention_layer(nn.Module):
def __init__(self, sequence_length):
super(Attention_layer, self).__init__()
self.input_size = sequence_length
self.output_size = sequence_length
self.dense = nn.Linear(sequence_length, sequence_length)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | w6688j/ChatBot-PyTorch | Attention_layer | false | 13,080 | [
"Apache-2.0"
] | 0 | 84f5a3267d16c650b90727ce80e4952901faa902 | https://github.com/w6688j/ChatBot-PyTorch/tree/84f5a3267d16c650b90727ce80e4952901faa902 |
SPPNet | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
def spatial_pyramid_pool(previous_conv, num_sample, previous_conv_size,
out_pool_size):
"""
previous_conv: a tensor vector of previous convolution layer
num_sample: an int number of image in the batch
previous_conv_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.... | maj34/Deep-Learning-Papers | SPPNet | false | 13,081 | [
"MIT"
] | 0 | 2672d3426b3f4342f7d81cd5ae029f2485594b4c | https://github.com/maj34/Deep-Learning-Papers/tree/2672d3426b3f4342f7d81cd5ae029f2485594b4c |
CmapPafHeadAttention | import torch
import torch.utils.data
import torch.nn
import torch.optim
class UpsampleCBR(torch.nn.Sequential):
def __init__(self, input_channels, output_channels, count=1, num_flat=0):
layers = []
for i in range(count):
if i == 0:
inch = input_channels
els... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn
import torch.optim
assert_size_stride = ... | tucachmo2202/trt_pose | CmapPafHeadAttention | false | 13,082 | [
"MIT"
] | 0 | b847fc197c32219dc2d719c2b42906603da0988a | https://github.com/tucachmo2202/trt_pose/tree/b847fc197c32219dc2d719c2b42906603da0988a |
ParsingRelationLoss | import torch
import torch.nn.modules
import torch.nn as nn
class ParsingRelationLoss(nn.Module):
def __init__(self):
super(ParsingRelationLoss, self).__init__()
def forward(self, logits):
_n, _c, h, _w = logits.shape
loss_all = []
for i in range(0, h - 1):
loss_al... | 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.modules
import torch.nn as nn
assert_size_stride = torch.... | wangping984/Ultra-Fast-Lane-Detection | ParsingRelationLoss | false | 13,083 | [
"MIT"
] | 0 | b7559c1469d832bf5afe5d158dd3ad63b4df9d9c | https://github.com/wangping984/Ultra-Fast-Lane-Detection/tree/b7559c1469d832bf5afe5d158dd3ad63b4df9d9c |
FSP | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._utils
from itertools import product as product
import torch.utils.data.distributed
class FSP(nn.Module):
"""
A Gift from Knowledge Distillation: Fast Optimization, Network Minimization and Transfer Learning
http://openaccess.thecvf... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.nn as nn
import torch._utils
from i... | wangxianliang/FaceX-Zoo | FSP | false | 13,084 | [
"Apache-2.0"
] | 0 | b0555c88a0350fa7b59c317f3a171f551fef4e6e | https://github.com/wangxianliang/FaceX-Zoo/tree/b0555c88a0350fa7b59c317f3a171f551fef4e6e |
FT | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._utils
from itertools import product as product
import torch.utils.data.distributed
class FT(nn.Module):
"""
araphrasing Complex Network: Network Compression via Factor Transfer
http://papers.nips.cc/paper/7541-paraphrasing-complex-... | 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... | wangxianliang/FaceX-Zoo | FT | false | 13,085 | [
"Apache-2.0"
] | 0 | b0555c88a0350fa7b59c317f3a171f551fef4e6e | https://github.com/wangxianliang/FaceX-Zoo/tree/b0555c88a0350fa7b59c317f3a171f551fef4e6e |
Attention | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as F
from torch import nn
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.... | GeorgeKostenkov/ImageCaptioning.pytorch | Attention | false | 13,086 | [
"MIT"
] | 0 | 8f17433fdaba2f89774e45ad5a3a88b880932ee6 | https://github.com/GeorgeKostenkov/ImageCaptioning.pytorch/tree/8f17433fdaba2f89774e45ad5a3a88b880932ee6 |
Visual_Q_Network | import torch
import torch.nn as nn
import torch.nn.functional as F
class Visual_Q_Network(nn.Module):
"""
The input of this network should have shape (num_frame, 80, 80)
"""
def __init__(self, num_frame, num_action):
super(Visual_Q_Network, self).__init__()
self.conv1 = nn.Conv2d(in_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | wanghaodi/DQN_with_DDQN | Visual_Q_Network | false | 13,087 | [
"MIT"
] | 0 | 970ebf429c863debfd009b48e3bc4169fcbb05d4 | https://github.com/wanghaodi/DQN_with_DDQN/tree/970ebf429c863debfd009b48e3bc4169fcbb05d4 |
SoftTarget | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._utils
from itertools import product as product
import torch.utils.data.distributed
class SoftTarget(nn.Module):
"""
Distilling the Knowledge in a Neural Network
https://arxiv.org/pdf/1503.02531.pdf
"""
def __init__(self, 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... | wangxianliang/FaceX-Zoo | SoftTarget | false | 13,088 | [
"Apache-2.0"
] | 0 | b0555c88a0350fa7b59c317f3a171f551fef4e6e | https://github.com/wangxianliang/FaceX-Zoo/tree/b0555c88a0350fa7b59c317f3a171f551fef4e6e |
GCN | from torch.nn import Module
import torch
import torch.nn as nn
from torch.nn.modules.module import Module
import torch.nn.functional as F
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, out_features, bias=True):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | wangzefan666/pygcn | GCN | false | 13,089 | [
"MIT"
] | 0 | 2a5e4f299e3c9d3eafe3014622e8ec3742ba365c | https://github.com/wangzefan666/pygcn/tree/2a5e4f299e3c9d3eafe3014622e8ec3742ba365c |
GraphConvolution | from torch.nn import Module
import torch
import torch.nn as nn
from torch.nn.modules.module import Module
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, out_features, bias=True):
super(GraphConvolution, 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.nn import Module
import torch.nn as nn
from torch.nn.modules.module i... | wangzefan666/pygcn | GraphConvolution | false | 13,090 | [
"MIT"
] | 0 | 2a5e4f299e3c9d3eafe3014622e8ec3742ba365c | https://github.com/wangzefan666/pygcn/tree/2a5e4f299e3c9d3eafe3014622e8ec3742ba365c |
SqueezeExcite | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._utils
from itertools import product as product
import torch.utils.data.distributed
def _make_divisible(v, divisor, min_value=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a 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
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | wangxianliang/FaceX-Zoo | SqueezeExcite | false | 13,091 | [
"Apache-2.0"
] | 0 | b0555c88a0350fa7b59c317f3a171f551fef4e6e | https://github.com/wangxianliang/FaceX-Zoo/tree/b0555c88a0350fa7b59c317f3a171f551fef4e6e |
ArcFace | from torch.nn import Module
import math
import torch
from torch.nn import Parameter
import torch.nn.functional as F
import torch._utils
from itertools import product as product
import torch.utils.data.distributed
class ArcFace(Module):
"""Implementation for "ArcFace: Additive Angular Margin Loss for Deep Face Rec... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | wangxianliang/FaceX-Zoo | ArcFace | false | 13,092 | [
"Apache-2.0"
] | 0 | b0555c88a0350fa7b59c317f3a171f551fef4e6e | https://github.com/wangxianliang/FaceX-Zoo/tree/b0555c88a0350fa7b59c317f3a171f551fef4e6e |
GELU | import torch
from torch import nn
class GELU(nn.Module):
def forward(self, x):
return torch.sigmoid(1.702 * x) * x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | simonlevine/enformer-pytorch | GELU | false | 13,093 | [
"MIT"
] | 0 | 342915c3f9385f5f24ee4d1d9965d126d49ca279 | https://github.com/simonlevine/enformer-pytorch/tree/342915c3f9385f5f24ee4d1d9965d126d49ca279 |
MLP | import torch
import torch.nn as nn
class MLP(nn.Module):
"""
Create a multilayer perceptron model with variable hidden layers.
The network will have the specified number of layers and neurons,
with each layer using the leaky ReLU activation function.
Parameters
----------
input_dim : int... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | wfondrie/wefpy | MLP | false | 13,094 | [
"Apache-2.0"
] | 0 | 00691d453048203e1e3b1daea53879067ee4a395 | https://github.com/wfondrie/wefpy/tree/00691d453048203e1e3b1daea53879067ee4a395 |
PKTCosSim | import torch
import torch.nn as nn
import torch._utils
from itertools import product as product
import torch.utils.data.distributed
class PKTCosSim(nn.Module):
"""
Learning Deep Representations with Probabilistic Knowledge Transfer
http://openaccess.thecvf.com/content_ECCV_2018/papers/Nikolaos_Passalis_Learning... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | wangxianliang/FaceX-Zoo | PKTCosSim | false | 13,095 | [
"Apache-2.0"
] | 0 | b0555c88a0350fa7b59c317f3a171f551fef4e6e | https://github.com/wangxianliang/FaceX-Zoo/tree/b0555c88a0350fa7b59c317f3a171f551fef4e6e |
PDF | import math
import torch
import torch.nn as nn
def compute_negative_ln_prob(Y, mu, ln_var, pdf):
var = ln_var.exp()
if pdf == 'gauss':
negative_ln_prob = 0.5 * ((Y - mu) ** 2 / var).sum(1).mean(
) + 0.5 * Y.size(1) * math.log(2 * math.pi) + 0.5 * ln_var.sum(1
).mean()
elif ... | 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.nn as nn
assert_size_stride = torch._C._dynamo.g... | wangxuuu/Demo | PDF | false | 13,096 | [
"MIT"
] | 0 | f1d85a55525a4199d63ee7dfe0ae2f21d3066c7c | https://github.com/wangxuuu/Demo/tree/f1d85a55525a4199d63ee7dfe0ae2f21d3066c7c |
JointsMSELoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class JointsMSELoss(nn.Module):
def __init__(self, use_target_weight):
super(JointsMSELoss, self).__init__()
self.criterion = nn.MSELoss(reduction='sum')
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
assert_size_st... | wszsycn/DarkPose-for-VIP2021 | JointsMSELoss | false | 13,097 | [
"Apache-2.0"
] | 0 | 3658c74ed8bc76c497cb0269dbe10ed6898e07fb | https://github.com/wszsycn/DarkPose-for-VIP2021/tree/3658c74ed8bc76c497cb0269dbe10ed6898e07fb |
Offset | import torch
from torch import nn
class Offset(nn.Module):
def __init__(self, init_value=0.0):
super(Offset, self).__init__()
self.bias = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
return input + self.bias
def get_inputs():
return [torch.rand([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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | xaviolo99/dd3d | Offset | false | 13,098 | [
"MIT"
] | 0 | e83cbbc14986fe5c9e0d65c58085b4d0bc9330ff | https://github.com/xaviolo99/dd3d/tree/e83cbbc14986fe5c9e0d65c58085b4d0bc9330ff |
CompositePrior | import torch
import numpy as np
from torch import nn
from torch.nn import functional as F
def swish(x):
return x.mul(torch.sigmoid(x))
def log_norm_pdf(x, mu, logvar):
return -0.5 * (logvar + np.log(2 * np.pi) + (x - mu).pow(2) / logvar.exp())
class Encoder(nn.Module):
def __init__(self, hidden_dim, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | verachtertr/RecVAE | CompositePrior | false | 13,099 | [
"Apache-2.0"
] | 0 | 915bed7f537cac6fc918aac8c622112561d15f03 | https://github.com/verachtertr/RecVAE/tree/915bed7f537cac6fc918aac8c622112561d15f03 |
CBAM_Module | import torch
from torch import nn
from torchvision.transforms import *
class CBAM_Module(nn.Module):
def __init__(self, channels, reduction):
super(CBAM_Module, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPool2d(1)
self.fc1 = nn.Conv2d(ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | wangxing001/project-for-ReID | CBAM_Module | false | 13,100 | [
"MIT"
] | 0 | 68a216dbbc7f7036fa72e49e1a806edc9b8e152d | https://github.com/wangxing001/project-for-ReID/tree/68a216dbbc7f7036fa72e49e1a806edc9b8e152d |
PolicyNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
class PolicyNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003,
log_std_min=-20, log_std_max=2):
super(PolicyNetwork, self).__init__()
self.log_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | watermeleon/spot_mini_mini | PolicyNetwork | false | 13,101 | [
"MIT"
] | 0 | 8622d3b0e0a95f7c548cacb6722a94f61a7e2b4b | https://github.com/watermeleon/spot_mini_mini/tree/8622d3b0e0a95f7c548cacb6722a94f61a7e2b4b |
MLP_G | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
m.weight.data.normal_(0.0, 0.02)
m.bias.data.fill_(0)
elif classname.find('BatchNorm') != -1:
m.weight.data.norm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | tasfia/BMCoGAN | MLP_G | false | 13,102 | [
"MIT"
] | 0 | 0d400c2c71dbfb69af422afc487f65afb98de8af | https://github.com/tasfia/BMCoGAN/tree/0d400c2c71dbfb69af422afc487f65afb98de8af |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
"""
Applies an attention mechanism on the output features from the decoder.
.. math::
\\begin{array}{ll}
x = context*output \\\\
attn = exp(x_i) / sum_j exp(x_j) \\\\
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | woaksths/set2regex-baseline | Attention | false | 13,103 | [
"Apache-2.0"
] | 0 | be377593526ad664a727dd7152fcb186118adaa5 | https://github.com/woaksths/set2regex-baseline/tree/be377593526ad664a727dd7152fcb186118adaa5 |
ConditionalEntropyLoss | import torch
import torch.nn.functional as F
class ConditionalEntropyLoss(torch.nn.Module):
def __init__(self, model):
super(ConditionalEntropyLoss, self).__init__()
def forward(self, x, weight):
loss = F.softmax(x, dim=1) * F.log_softmax(x, dim=1) * weight
loss = loss.sum(dim=1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | tasfia/BMCoGAN | ConditionalEntropyLoss | false | 13,104 | [
"MIT"
] | 0 | 0d400c2c71dbfb69af422afc487f65afb98de8af | https://github.com/tasfia/BMCoGAN/tree/0d400c2c71dbfb69af422afc487f65afb98de8af |
SelfAttentionGPT2 | import torch
from torch import nn
def mask_(matrices, maskval=0.0, mask_diagonal=True):
"""
Masks out all values in the given batch of matrices where i <= j holds,
i < j if mask_diagonal is false
In place operation
:param tns:
:return:
"""
h, w = matrices.size(-2), matrices.size(-1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | wjeliot/former | SelfAttentionGPT2 | false | 13,105 | [
"MIT"
] | 0 | 38bd29b68b110e1e3eddae3106f7db2ffc0e5ce8 | https://github.com/wjeliot/former/tree/38bd29b68b110e1e3eddae3106f7db2ffc0e5ce8 |
SelfAttentionWide | import torch
from torch import nn
import torch.nn.functional as F
def mask_(matrices, maskval=0.0, mask_diagonal=True):
"""
Masks out all values in the given batch of matrices where i <= j holds,
i < j if mask_diagonal is false
In place operation
:param tns:
:return:
"""
h, w = matri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | wjeliot/former | SelfAttentionWide | false | 13,106 | [
"MIT"
] | 0 | 38bd29b68b110e1e3eddae3106f7db2ffc0e5ce8 | https://github.com/wjeliot/former/tree/38bd29b68b110e1e3eddae3106f7db2ffc0e5ce8 |
Discriminator | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
m.weight.data.normal_(0.0, 0.02)
m.bias.data.fill_(0)
elif classname.find('BatchNorm') != -1:
m.weight.data.norm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | tasfia/BMCoGAN | Discriminator | false | 13,107 | [
"MIT"
] | 0 | 0d400c2c71dbfb69af422afc487f65afb98de8af | https://github.com/tasfia/BMCoGAN/tree/0d400c2c71dbfb69af422afc487f65afb98de8af |
Mapping | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
m.weight.data.normal_(0.0, 0.02)
m.bias.data.fill_(0)
elif classname.find('BatchNorm') != -1:
m.weight.data.norm... | 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... | tasfia/BMCoGAN | Mapping | false | 13,108 | [
"MIT"
] | 0 | 0d400c2c71dbfb69af422afc487f65afb98de8af | https://github.com/tasfia/BMCoGAN/tree/0d400c2c71dbfb69af422afc487f65afb98de8af |
LinearEmbedder | import torch
import torch.nn as nn
class LinearEmbedder(torch.nn.Module):
def __init__(self, in_features, out_features):
super(LinearEmbedder, self).__init__()
self.fc = nn.Linear(in_features, out_features)
def forward(self, x):
o = self.fc(x)
o = self.l2_norm(o)
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.triton_helpers import libdevice
import torch.nn as ... | xiaonanzzz/ProxyAnchorLossSimple | LinearEmbedder | false | 13,109 | [
"MIT"
] | 0 | a501578142fd00bf001c840e8051c67dee873f67 | https://github.com/xiaonanzzz/ProxyAnchorLossSimple/tree/a501578142fd00bf001c840e8051c67dee873f67 |
ValueNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ValueNet(nn.Module):
def __init__(self, actions):
super(ValueNet, self).__init__()
self.conv1 = nn.Conv2d(4, 32, 8, stride=4, padding=2)
self.conv2 = nn.Conv2d(32, 64, 4, stride=2, padding=1)
self.conv3 = 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
assert_... | wondervictor/DeepQLearning | ValueNet | false | 13,110 | [
"MIT"
] | 0 | 48d1a5c9e3dff38845366a31830d9114e9eefedc | https://github.com/wondervictor/DeepQLearning/tree/48d1a5c9e3dff38845366a31830d9114e9eefedc |
DecoderBias | import torch
import torch.nn as nn
class DecoderBias(nn.Module):
def __init__(self, dim1_batch, latent_dim, bias=False):
super().__init__()
self.dim1_latent_decoder = nn.Parameter(torch.randn(latent_dim,
latent_dim))
self.dim2_latent_decoder = nn.Parameter(torch.randn(latent_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | xiaoyanLi629/single_cell_data_analysis | DecoderBias | false | 13,111 | [
"MIT"
] | 0 | 39d6bbd64249385d2005a775ea1d05e210f41fbe | https://github.com/xiaoyanLi629/single_cell_data_analysis/tree/39d6bbd64249385d2005a775ea1d05e210f41fbe |
ContextualCell | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def conv_bn_relu(C_in, C_out, kernel_size, stride, padding, affine=True):
return nn.Sequential(nn.Conv2d(C_in, C_out, kernel_size, stride=stride,
padding=padding, bias=False), nn.BatchNorm2d(C_out, affine=affine),
nn.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | xkp793003821/nas-segm-pytorch | ContextualCell | false | 13,112 | [
"BSD-2-Clause"
] | 0 | c4b59ab56bd539bf08493c6d85072849213a3d62 | https://github.com/xkp793003821/nas-segm-pytorch/tree/c4b59ab56bd539bf08493c6d85072849213a3d62 |
MLP_g | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
m.weight.data.normal_(0.0, 0.02)
m.bias.data.fill_(0)
elif classname.find('BatchNorm') != -1:
m.weight.data.norm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | tasfia/BMCoGAN | MLP_g | false | 13,113 | [
"MIT"
] | 0 | 0d400c2c71dbfb69af422afc487f65afb98de8af | https://github.com/tasfia/BMCoGAN/tree/0d400c2c71dbfb69af422afc487f65afb98de8af |
EncoderBias | import torch
import torch.nn as nn
class EncoderBias(nn.Module):
def __init__(self, input_dim1, input_dim2, batch_feature, latent_dim,
bias=False):
"""[summary]
Args:
input_dim1 ([type]): [mod1 dimemsion]
input_dim2 ([type]): [mod2 dimemsion]
batch_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | xiaoyanLi629/single_cell_data_analysis | EncoderBias | false | 13,114 | [
"MIT"
] | 0 | 39d6bbd64249385d2005a775ea1d05e210f41fbe | https://github.com/xiaoyanLi629/single_cell_data_analysis/tree/39d6bbd64249385d2005a775ea1d05e210f41fbe |
CIFAR10ConvNet | import torch
from random import *
import torch.nn.functional as F
import torch.nn as nn
class CIFAR10ConvNet(torch.nn.Module):
def __init__(self, num_conv_layers, num_filters_1, num_filters_2,
num_filters_3, dropout_rate, num_fc_units, kernel_size):
super().__init__()
self.conv1 = nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xinranzhu/GPTune-1 | CIFAR10ConvNet | false | 13,115 | [
"BSD-3-Clause-LBNL"
] | 0 | 1e502295e790ab68990f657492243fd4fb3dfc0a | https://github.com/xinranzhu/GPTune-1/tree/1e502295e790ab68990f657492243fd4fb3dfc0a |
maxout | import torch
import torch.nn as nn
import torch.utils.data
class maxout(nn.Module):
def __init__(self, in_feature, out_feature, pool_size):
super(maxout, self).__init__()
self.in_feature = in_feature
self.out_feature = out_feature
self.pool_size = pool_size
self.linear = 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
import ... | xuehuiping/Global-Encoding | maxout | false | 13,116 | [
"MIT"
] | 0 | 1cba2746162ac569b430aa1ba5bca58183416ee7 | https://github.com/xuehuiping/Global-Encoding/tree/1cba2746162ac569b430aa1ba5bca58183416ee7 |
Conv2d | import math
import torch
import torch.nn.functional
import torch.backends.cudnn
class Conv2d(torch.nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
dilation=1, groups=1, bias=False):
super().__init__(in_channels, out_channels, kernel_size, stride, 0,
di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.backends.cudnn
assert_size_stride = torc... | xolbynz/EfficientNetV2-PyTorch- | Conv2d | false | 13,117 | [
"Apache-2.0"
] | 0 | 4b5039755adbd0e5f8ee0611e3d6b5be8c13ecd2 | https://github.com/xolbynz/EfficientNetV2-PyTorch-/tree/4b5039755adbd0e5f8ee0611e3d6b5be8c13ecd2 |
MNISTConvNet | import torch
from random import *
import torch.nn.functional as F
import torch.nn as nn
class MNISTConvNet(torch.nn.Module):
def __init__(self, num_conv_layers, num_filters_1, num_filters_2,
num_filters_3, dropout_rate, num_fc_units, kernel_size):
super().__init__()
self.conv1 = nn.Conv2d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xinranzhu/GPTune-1 | MNISTConvNet | false | 13,118 | [
"BSD-3-Clause-LBNL"
] | 0 | 1e502295e790ab68990f657492243fd4fb3dfc0a | https://github.com/xinranzhu/GPTune-1/tree/1e502295e790ab68990f657492243fd4fb3dfc0a |
ConvBlockD | import torch
import torch.nn as nn
class ConvBlockD(nn.Module):
def __init__(self, in_channels, out_channels, groups=3, ker_size=2):
super(ConvBlockD, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.groups = groups
def wn(x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | wwjfsfs/wwjyyds | ConvBlockD | false | 13,119 | [
"MIT"
] | 0 | 80cd6267fde7cd98838078a0d5178a557ceb7414 | https://github.com/wwjfsfs/wwjyyds/tree/80cd6267fde7cd98838078a0d5178a557ceb7414 |
EmbedNet | from _paritybench_helpers import _mock_config
import torch
import torch.utils.data
import torch
from torchvision.transforms import functional as F
from torch import nn
import torch.nn.functional as F
class EmbedNet(nn.Module):
def __init__(self, cfg):
super(EmbedNet, self).__init__()
self.embed_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | ron5569/mega.pytorch | EmbedNet | false | 13,120 | [
"BSD-2-Clause"
] | 0 | b845b7050da307576cd98ab73eb7be4e9a9088bc | https://github.com/ron5569/mega.pytorch/tree/b845b7050da307576cd98ab73eb7be4e9a9088bc |
ESA | import torch
import torch.nn as nn
import torch.nn.functional as F
class ESA(nn.Module):
def __init__(self, channel=64, reduction=4, bias=True):
super(ESA, self).__init__()
self.r_nc = channel // reduction
self.conv1 = nn.Conv2d(channel, self.r_nc, kernel_size=1)
self.conv21 = 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
assert_... | wwjfsfs/wwjyyds | ESA | false | 13,121 | [
"MIT"
] | 0 | 80cd6267fde7cd98838078a0d5178a557ceb7414 | https://github.com/wwjfsfs/wwjyyds/tree/80cd6267fde7cd98838078a0d5178a557ceb7414 |
PolicyNetwork | import torch
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
class PolicyNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size, learning_rate=
0.0003):
super(PolicyNetwork, self).__init_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | xuzhiyuan1528/tf2basic | PolicyNetwork | false | 13,122 | [
"Apache-2.0"
] | 0 | 52ed7d8bcc72f16e198754f5f92a583fe16d544e | https://github.com/xuzhiyuan1528/tf2basic/tree/52ed7d8bcc72f16e198754f5f92a583fe16d544e |
FCUDown | import torch
import torch.nn as nn
from functools import partial
class FCUDown(nn.Module):
""" CNN feature maps -> Transformer patch embeddings
"""
def __init__(self, inplanes, outplanes, dw_stride, act_layer=nn.GELU,
norm_layer=partial(nn.LayerNorm, eps=1e-06)):
super(FCUDown, self).__in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | xuewengeophysics/Conformer | FCUDown | false | 13,123 | [
"Apache-2.0"
] | 0 | e769a1ac9ab110dae2a356a4de1e06ccd0e95041 | https://github.com/xuewengeophysics/Conformer/tree/e769a1ac9ab110dae2a356a4de1e06ccd0e95041 |
ConvBlock | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, groups=3):
super(ConvBlock, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.groups = groups
def wn(x):
return tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | wwjfsfs/wwjyyds | ConvBlock | false | 13,124 | [
"MIT"
] | 0 | 80cd6267fde7cd98838078a0d5178a557ceb7414 | https://github.com/wwjfsfs/wwjyyds/tree/80cd6267fde7cd98838078a0d5178a557ceb7414 |
TVLoss | import torch
import torch.utils.data
import torch
import torch.nn as nn
class TVLoss(nn.Module):
def __init__(self, TVLoss_weight=1.0):
super(TVLoss, self).__init__()
self.TVLoss_weight = TVLoss_weight
def forward(self, x):
batch_size = x.size()[0]
h_x = x.size()[2]
w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | xyp8023/pytorch-CycleGAN-and-pix2pix | TVLoss | false | 13,125 | [
"BSD-3-Clause"
] | 0 | dce720d985a951a3cfed470ef4c2ef206c0e0817 | https://github.com/xyp8023/pytorch-CycleGAN-and-pix2pix/tree/dce720d985a951a3cfed470ef4c2ef206c0e0817 |
C1 | import torch
import torch.nn as nn
from collections import OrderedDict
class C1(nn.Module):
def __init__(self):
super(C1, self).__init__()
self.c1 = nn.Sequential(OrderedDict([('c1', nn.Conv2d(1, 6,
kernel_size=(5, 5))), ('relu1', nn.ReLU()), ('s1', nn.MaxPool2d
(kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from co... | xxchenxx/otdd | C1 | false | 13,126 | [
"MIT"
] | 0 | e63d1d170fed36957052b7bb0a0af1553b980381 | https://github.com/xxchenxx/otdd/tree/e63d1d170fed36957052b7bb0a0af1553b980381 |
BoF_Pooling | import torch
import torch.nn as nn
import torch.nn.functional as F
class BoF_Pooling(nn.Module):
def __init__(self, n_codewords, features, spatial_level=0, **kwargs):
super(BoF_Pooling, self).__init__()
"""
Initializes a BoF Pooling layer
:param n_codewords: the number of the code... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xujli/cbof_torch | BoF_Pooling | false | 13,127 | [
"MIT"
] | 0 | ed8d67dd7a41b6345305d970d0f8fa0892f8ccee | https://github.com/xujli/cbof_torch/tree/ed8d67dd7a41b6345305d970d0f8fa0892f8ccee |
C2 | import torch
import torch.nn as nn
from collections import OrderedDict
class C2(nn.Module):
def __init__(self):
super(C2, self).__init__()
self.c2 = nn.Sequential(OrderedDict([('c2', nn.Conv2d(6, 16,
kernel_size=(5, 5))), ('relu2', nn.ReLU()), ('s2', nn.MaxPool2d
(kernel_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from co... | xxchenxx/otdd | C2 | false | 13,128 | [
"MIT"
] | 0 | e63d1d170fed36957052b7bb0a0af1553b980381 | https://github.com/xxchenxx/otdd/tree/e63d1d170fed36957052b7bb0a0af1553b980381 |
FirstBlock | import torch
import numpy as np
import torch.nn as nn
class BatchNormLayer(nn.Module):
"""Implements batch normalization layer."""
def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon
=1e-05):
"""Initializes with basic settings.
Args:
channels: Number of channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | thunguyenphuoc/idinvert_pytorch | FirstBlock | false | 13,129 | [
"MIT"
] | 0 | bf8a81e75d193c22a05d9c4457907dc468389766 | https://github.com/thunguyenphuoc/idinvert_pytorch/tree/bf8a81e75d193c22a05d9c4457907dc468389766 |
ConvCompress | import torch
from torch import nn
class ConvCompress(nn.Module):
def __init__(self, dim, ratio=4):
super().__init__()
self.conv = nn.Conv1d(dim, dim, ratio, stride=ratio)
def forward(self, mem):
mem = mem.transpose(1, 2)
compressed_mem = self.conv(mem)
return compress... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | yhgon/cmtf | ConvCompress | false | 13,130 | [
"MIT"
] | 0 | 7a3ffc3a59a7c546a00d3b73be58f7d1c2f1f0cf | https://github.com/yhgon/cmtf/tree/7a3ffc3a59a7c546a00d3b73be58f7d1c2f1f0cf |
_FakeMegatronMLP | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class _FakeMegatronMLP(nn.Module):
"""
A fake mlp without model parallelism for correctness testing
"""
def __init__(self, args, _):
super().__init__()
self.fc1 = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | xxchenxx/fastmoe | _FakeMegatronMLP | false | 13,131 | [
"Apache-2.0"
] | 0 | f60dd0e1f9f0447e56ff265c9ede304b88d0556b | https://github.com/xxchenxx/fastmoe/tree/f60dd0e1f9f0447e56ff265c9ede304b88d0556b |
C3 | import torch
import torch.nn as nn
from collections import OrderedDict
class C3(nn.Module):
def __init__(self):
super(C3, self).__init__()
self.c3 = nn.Sequential(OrderedDict([('c3', nn.Conv2d(16, 120,
kernel_size=(5, 5))), ('relu3', nn.ReLU())]))
def forward(self, img):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from co... | xxchenxx/otdd | C3 | false | 13,132 | [
"MIT"
] | 0 | e63d1d170fed36957052b7bb0a0af1553b980381 | https://github.com/xxchenxx/otdd/tree/e63d1d170fed36957052b7bb0a0af1553b980381 |
LastBlock | import torch
import numpy as np
import torch.nn as nn
class BatchNormLayer(nn.Module):
"""Implements batch normalization layer."""
def __init__(self, channels, gamma=False, beta=True, decay=0.9, epsilon
=1e-05):
"""Initializes with basic settings.
Args:
channels: Number of channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | thunguyenphuoc/idinvert_pytorch | LastBlock | false | 13,133 | [
"MIT"
] | 0 | bf8a81e75d193c22a05d9c4457907dc468389766 | https://github.com/thunguyenphuoc/idinvert_pytorch/tree/bf8a81e75d193c22a05d9c4457907dc468389766 |
MinMaxNorm | import torch
import torch.nn as nn
class MinMaxNorm(nn.Module):
def __init__(self, min, max, a=0, b=1):
super(MinMaxNorm, self).__init__()
self.min, self.max = min, max
self.a, self.b = a, b
def forward(self, x):
return self.a + (x - self.min) * (self.b - self.a) / (self.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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yhgon/speedyspeech | MinMaxNorm | false | 13,134 | [
"BSD-3-Clause"
] | 0 | 574c6a94091431f313e2aae8e154b8c80e6908ce | https://github.com/yhgon/speedyspeech/tree/574c6a94091431f313e2aae8e154b8c80e6908ce |
DisConvModule | import torch
import torch.nn as nn
from torch.nn.utils import spectral_norm as spectral_norm_fn
from torch.nn.utils import weight_norm as weight_norm_fn
def dis_conv(input_dim, output_dim, kernel_size=5, stride=2, padding=0,
rate=1, activation='lrelu'):
return Conv2dBlock(input_dim, output_dim, kernel_size, s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn.utils import spectral_norm as spectral_norm_... | xy-gao/generative-inpainting-pytorch | DisConvModule | false | 13,135 | [
"MIT"
] | 0 | 24f2183a11fd48a0383c9862e3d1a6354fbb6cda | https://github.com/xy-gao/generative-inpainting-pytorch/tree/24f2183a11fd48a0383c9862e3d1a6354fbb6cda |
CriticVanilla | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLPBase(nn.Module):
def __init__(self, num_inputs, num_outputs):
super(MLPBase, self).__init__()
self.l1 = nn.Linear(num_inputs, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, num_outputs)
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
import ... | yangfanthu/modular-rl | CriticVanilla | false | 13,136 | [
"BSD-2-Clause"
] | 0 | 25c599bab641a7e732dbaf116cd240fa2358f113 | https://github.com/yangfanthu/modular-rl/tree/25c599bab641a7e732dbaf116cd240fa2358f113 |
CFRB | import torch
import torch.nn as nn
from collections import OrderedDict
import torch.nn.functional as F
def sequential(*args):
"""Advanced nn.Sequential.
Args:
nn.Sequential, nn.Module
Returns:
nn.Sequential
"""
if len(args) == 1:
if isinstance(args[0], OrderedDict):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from co... | wwjfsfs/wwjyyds | CFRB | false | 13,137 | [
"MIT"
] | 0 | 80cd6267fde7cd98838078a0d5178a557ceb7414 | https://github.com/wwjfsfs/wwjyyds/tree/80cd6267fde7cd98838078a0d5178a557ceb7414 |
FFN | import torch
import torch.nn as nn
import torch as t
class Conv(nn.Module):
"""
Convolution Module
"""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=1, bias=True, w_init='linear'):
"""
:param in_channels: dimension of input
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | yhgon/Transformer-TTS | FFN | false | 13,138 | [
"MIT"
] | 0 | 5f34945cb5500d484275700c4e393ed125d5e753 | https://github.com/yhgon/Transformer-TTS/tree/5f34945cb5500d484275700c4e393ed125d5e753 |
MLP | import torch
import torch.autograd
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, n_in, n_out, dropout=0):
super().__init__()
self.linear = nn.Linear(n_in, n_out)
self.activation = nn.GELU()
self.dropout = nn.Dropout(dropout)
def forward(self, x):
x = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.autogr... | yifding/W2NER | MLP | false | 13,139 | [
"MIT"
] | 0 | d13128e45f3930a8b8faa794318939dc90a75974 | https://github.com/yifding/W2NER/tree/d13128e45f3930a8b8faa794318939dc90a75974 |
ActorDownAction | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLPBase(nn.Module):
def __init__(self, num_inputs, num_outputs):
super(MLPBase, self).__init__()
self.l1 = nn.Linear(num_inputs, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, num_outputs)
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.... | yangfanthu/modular-rl | ActorDownAction | false | 13,140 | [
"BSD-2-Clause"
] | 0 | 25c599bab641a7e732dbaf116cd240fa2358f113 | https://github.com/yangfanthu/modular-rl/tree/25c599bab641a7e732dbaf116cd240fa2358f113 |
Block | import torch
import torch.nn as nn
from functools import partial
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hidden_features = hidden_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | xuewengeophysics/Conformer | Block | false | 13,141 | [
"Apache-2.0"
] | 0 | e769a1ac9ab110dae2a356a4de1e06ccd0e95041 | https://github.com/xuewengeophysics/Conformer/tree/e769a1ac9ab110dae2a356a4de1e06ccd0e95041 |
Biaffine | import torch
import torch.autograd
import torch.nn as nn
class Biaffine(nn.Module):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True):
super(Biaffine, self).__init__()
self.n_in = n_in
self.n_out = n_out
self.bias_x = bias_x
self.bias_y = bias_y
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.autograd
import torch.nn as nn
assert_size_stride = torch._C._dynam... | yifding/W2NER | Biaffine | false | 13,142 | [
"MIT"
] | 0 | d13128e45f3930a8b8faa794318939dc90a75974 | https://github.com/yifding/W2NER/tree/d13128e45f3930a8b8faa794318939dc90a75974 |
SmoothBCEwLogits | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _WeightedLoss
class SmoothBCEwLogits(_WeightedLoss):
def __init__(self, weight=None, reduction='mean', smoothing=0.0):
super().__init__(weight=weight, reduction=reduction)
self.smoothing = smoothing
self.weight... | 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.... | yota-p/kaggle_titanic | SmoothBCEwLogits | false | 13,143 | [
"MIT"
] | 0 | 36d2c53711482195f519d9280abadf0d6afa9a15 | https://github.com/yota-p/kaggle_titanic/tree/36d2c53711482195f519d9280abadf0d6afa9a15 |
LayerNorm | import torch
import torch.autograd
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, input_dim, cond_dim=0, center=True, scale=True,
epsilon=None, conditional=False, hidden_units=None,
hidden_activation='linear', hidden_initializer='xaiver', **kwargs):
super(LayerNorm, ... | 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.autograd
import torch.nn as nn
assert_size_stride = torch._C._dyna... | yifding/W2NER | LayerNorm | false | 13,144 | [
"MIT"
] | 0 | d13128e45f3930a8b8faa794318939dc90a75974 | https://github.com/yifding/W2NER/tree/d13128e45f3930a8b8faa794318939dc90a75974 |
CriticDownAction | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLPBase(nn.Module):
def __init__(self, num_inputs, num_outputs):
super(MLPBase, self).__init__()
self.l1 = nn.Linear(num_inputs, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, num_outputs)
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.... | yangfanthu/modular-rl | CriticDownAction | false | 13,145 | [
"BSD-2-Clause"
] | 0 | 25c599bab641a7e732dbaf116cd240fa2358f113 | https://github.com/yangfanthu/modular-rl/tree/25c599bab641a7e732dbaf116cd240fa2358f113 |
Attention | import math
import torch
import torch.nn as nn
import torch as t
class Linear(nn.Module):
"""
Linear Module
"""
def __init__(self, in_dim, out_dim, bias=True, w_init='linear'):
"""
:param in_dim: dimension of input
:param out_dim: dimension of output
:param bias: boole... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | yhgon/Transformer-TTS | Attention | false | 13,146 | [
"MIT"
] | 0 | 5f34945cb5500d484275700c4e393ed125d5e753 | https://github.com/yhgon/Transformer-TTS/tree/5f34945cb5500d484275700c4e393ed125d5e753 |
SelfAttentionLayer | import torch
from torch import nn
from torch.nn import functional as F
class SelfAttentionLayer(nn.Module):
def __init__(self, dim, da, alpha=0.2, dropout=0.5):
super(SelfAttentionLayer, self).__init__()
self.dim = dim
self.da = da
self.alpha = alpha
self.dropout = dropout... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | yuka1369/KBRD | SelfAttentionLayer | false | 13,147 | [
"MIT"
] | 0 | fc0f723c448299f00eef6daabff675640a930c26 | https://github.com/yuka1369/KBRD/tree/fc0f723c448299f00eef6daabff675640a930c26 |
CRF | import torch
import torch.nn as nn
class CRF(nn.Module):
"""
Implements Conditional Random Fields that can be trained via
backpropagation.
"""
def __init__(self, num_tags):
super(CRF, self).__init__()
self.num_tags = num_tags
self.transitions = nn.Parameter(torch.Tensor(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... | yezhengli-Mr9/torchnlp | CRF | false | 13,148 | [
"Apache-2.0"
] | 0 | 0f2ad6d149a413da9f03c6f6694c429746de6551 | https://github.com/yezhengli-Mr9/torchnlp/tree/0f2ad6d149a413da9f03c6f6694c429746de6551 |
ScaledDotAttention | import torch
import torch.nn as nn
from torch.nn import LayerNorm
def scaled_dot_attention(q, k, v, mask=None, noise=0, dropout=lambda x: x):
"""
:param q: queries, (batch, time1, channels1)
:param k: keys, (batch, time2, channels1)
:param v: values, (batch, time2, channels2)
:param mask: boolean ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yhgon/speedyspeech | ScaledDotAttention | false | 13,149 | [
"BSD-3-Clause"
] | 0 | 574c6a94091431f313e2aae8e154b8c80e6908ce | https://github.com/yhgon/speedyspeech/tree/574c6a94091431f313e2aae8e154b8c80e6908ce |
CoPredictor | import torch
import torch.autograd
import torch.nn as nn
class Biaffine(nn.Module):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True):
super(Biaffine, self).__init__()
self.n_in = n_in
self.n_out = n_out
self.bias_x = bias_x
self.bias_y = bias_y
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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.autogr... | yifding/W2NER | CoPredictor | false | 13,150 | [
"MIT"
] | 0 | d13128e45f3930a8b8faa794318939dc90a75974 | https://github.com/yifding/W2NER/tree/d13128e45f3930a8b8faa794318939dc90a75974 |
CRFOutputLayer | import torch
import torch.nn as nn
class CRF(nn.Module):
"""
Implements Conditional Random Fields that can be trained via
backpropagation.
"""
def __init__(self, num_tags):
super(CRF, self).__init__()
self.num_tags = num_tags
self.transitions = nn.Parameter(torch.Tensor(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_... | yezhengli-Mr9/torchnlp | CRFOutputLayer | false | 13,151 | [
"Apache-2.0"
] | 0 | 0f2ad6d149a413da9f03c6f6694c429746de6551 | https://github.com/yezhengli-Mr9/torchnlp/tree/0f2ad6d149a413da9f03c6f6694c429746de6551 |
CondConv2D | import functools
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.modules.conv import _ConvNd
from torch.nn.modules.utils import _pair
from torch.nn.parameter import Parameter
class _routing(nn.Module):
def __init__(self, in_channels, num_experts, dropout_rate):
super(_rout... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 functools
from torch import nn
import torch.nn.functional as F
from torch... | yifanpu001/CondConv-pytorch | CondConv2D | false | 13,152 | [
"MIT"
] | 0 | d5198f1c53de97304f8a23f4ca287cf5b4d33561 | https://github.com/yifanpu001/CondConv-pytorch/tree/d5198f1c53de97304f8a23f4ca287cf5b4d33561 |
Router | import torch
import warnings
import torch.nn as nn
class Router(nn.Module):
"""Convolution + Relu + Global Average Pooling + Sigmoid"""
def __init__(self, input_nc, input_width, input_height, kernel_size=28,
soft_decision=True, stochastic=False, **kwargs):
super(Router, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import warnings
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guar... | yulinfeng000/AdaptiveNeuralTrees | Router | false | 13,153 | [
"MIT"
] | 0 | bbcb381b9cb0c91ae1af33ce43b43f352055041c | https://github.com/yulinfeng000/AdaptiveNeuralTrees/tree/bbcb381b9cb0c91ae1af33ce43b43f352055041c |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""Scaled dot-product attention mechanism."""
def __init__(self, attention_dropout=0.0):
"""Init.
Args:
attention_dropout: A scalar, dropout rate.
"""
super(ScaledDotPr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yumoh/pinyin2hanzi | ScaledDotProductAttention | false | 13,154 | [
"MIT"
] | 0 | 1cbb650d3dd3ec0a0f51be5822556634860ad612 | https://github.com/yumoh/pinyin2hanzi/tree/1cbb650d3dd3ec0a0f51be5822556634860ad612 |
LR | import torch
import torch.nn as nn
import torch.nn.functional as F
class LR(nn.Module):
""" Logistinc regression
"""
def __init__(self, input_nc, input_width, input_height, no_classes=10,
**kwargs):
super(LR, self).__init__()
self.fc = nn.Linear(input_nc * input_width * input_heig... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | yulinfeng000/AdaptiveNeuralTrees | LR | false | 13,155 | [
"MIT"
] | 0 | bbcb381b9cb0c91ae1af33ce43b43f352055041c | https://github.com/yulinfeng000/AdaptiveNeuralTrees/tree/bbcb381b9cb0c91ae1af33ce43b43f352055041c |
MySigmoidFocalLoss | import torch
import torch.utils.data
from torch import nn
class MySigmoidFocalLoss(nn.Module):
def __init__(self, gamma, alpha):
super().__init__()
self.gamma = gamma
self.alpha = alpha
def forward(self, confids, targets):
bias = 1e-07
num_classes = confids.shape[1]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | yuruiqi/FCOS | MySigmoidFocalLoss | false | 13,156 | [
"BSD-2-Clause"
] | 0 | f03f984a03f4e23a0c1c8b470e401d4319e56c3f | https://github.com/yuruiqi/FCOS/tree/f03f984a03f4e23a0c1c8b470e401d4319e56c3f |
SeqAttnMatch | import torch
import torch.nn as nn
import torch.nn.functional as F
class SeqAttnMatch(nn.Module):
"""Given sequences X and Y, match sequence Y to each element in X.
* o_i = sum(alpha_j * y_j) for i in X
* alpha_j = softmax(y_j * x_i)
"""
def __init__(self, input_size, identity=False):
su... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ys7yoo/DrQAKor | SeqAttnMatch | false | 13,157 | [
"BSD-3-Clause"
] | 0 | ed9a69dd2a95f8ccb81bd5d6db0fbd59aae0be50 | https://github.com/ys7yoo/DrQAKor/tree/ed9a69dd2a95f8ccb81bd5d6db0fbd59aae0be50 |
FCN_mse | import torch
import torch.nn as nn
class FCN_mse(nn.Module):
"""
Predict whether pixels are part of the object or the background.
"""
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=5, padding=2)
self.conv2 = nn.Conv2d(16, 32, kernel_size=5, pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | yuishihara/chainer-causal-info-gan | FCN_mse | false | 13,158 | [
"MIT"
] | 0 | 67ff8e66fb1f8762e6c7830be80730395d2eb22c | https://github.com/yuishihara/chainer-causal-info-gan/tree/67ff8e66fb1f8762e6c7830be80730395d2eb22c |
Solver_GAP_OneFClayers | import torch
import torch.nn as nn
import torch.nn.functional as F
class Solver_GAP_OneFClayers(nn.Module):
""" GAP + fc1 """
def __init__(self, input_nc, input_width, input_height, dropout_prob=
0.0, reduction_rate=2, **kwargs):
super(Solver_GAP_OneFClayers, self).__init__()
self.dro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yulinfeng000/AdaptiveNeuralTrees | Solver_GAP_OneFClayers | false | 13,159 | [
"MIT"
] | 0 | bbcb381b9cb0c91ae1af33ce43b43f352055041c | https://github.com/yulinfeng000/AdaptiveNeuralTrees/tree/bbcb381b9cb0c91ae1af33ce43b43f352055041c |
Conv_ReLU_Block | import torch
import torch.nn as nn
class Conv_ReLU_Block(nn.Module):
def __init__(self, channel_in):
super(Conv_ReLU_Block, self).__init__()
self.conv_0 = nn.Conv2d(in_channels=channel_in, out_channels=128,
kernel_size=1, stride=1, padding=0, bias=False)
self.conv_1 = nn.Conv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ypf780732/multi-staged-fusion-sr | Conv_ReLU_Block | false | 13,160 | [
"MIT"
] | 0 | 83d82c4310cc9314544793dc0b299a34956044e0 | https://github.com/ypf780732/multi-staged-fusion-sr/tree/83d82c4310cc9314544793dc0b299a34956044e0 |
RouterGAPwithDoubleConv | import torch
import warnings
import torch.nn as nn
class RouterGAPwithDoubleConv(nn.Module):
""" 2 x (Convolution + Relu) + Global Average Pooling + FC + Sigmoid """
def __init__(self, input_nc, input_width, input_height, ngf=32,
kernel_size=3, soft_decision=True, stochastic=False, **kwargs):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 warnings
import torch.... | yulinfeng000/AdaptiveNeuralTrees | RouterGAPwithDoubleConv | false | 13,161 | [
"MIT"
] | 0 | bbcb381b9cb0c91ae1af33ce43b43f352055041c | https://github.com/yulinfeng000/AdaptiveNeuralTrees/tree/bbcb381b9cb0c91ae1af33ce43b43f352055041c |
Attention | import torch
class Attention(torch.nn.Module):
def __init__(self):
super(Attention, self).__init__()
def forward(self, hl, hr):
hl = hl / hl.norm(dim=-1, keepdim=True)
hr = hr / hr.norm(dim=-1, keepdim=True)
a = (hl[:, None, :] * hr[None, :, :]).sum(dim=-1)
mu_lr = hr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yuanqing-wang/graca | Attention | false | 13,162 | [
"MIT"
] | 0 | 6934e3cfe219a7f866b1f9e4ebcc107d76b47585 | https://github.com/yuanqing-wang/graca/tree/6934e3cfe219a7f866b1f9e4ebcc107d76b47585 |
MLP_AlexNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP_AlexNet(nn.Module):
""" The last fully connected part of LeNet MNIST:
https://github.com/BVLC/caffe/blob/master/examples/mnist/lenet.prototxt
"""
def __init__(self, input_nc, input_width, input_height, dropout_prob=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yulinfeng000/AdaptiveNeuralTrees | MLP_AlexNet | false | 13,163 | [
"MIT"
] | 0 | bbcb381b9cb0c91ae1af33ce43b43f352055041c | https://github.com/yulinfeng000/AdaptiveNeuralTrees/tree/bbcb381b9cb0c91ae1af33ce43b43f352055041c |
MLP_LeNetMNIST | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP_LeNetMNIST(nn.Module):
""" The last fully connected part of LeNet MNIST:
https://github.com/BVLC/caffe/blob/master/examples/mnist/lenet.prototxt
"""
def __init__(self, input_nc, input_width, input_height, dropout_prob=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yulinfeng000/AdaptiveNeuralTrees | MLP_LeNetMNIST | false | 13,164 | [
"MIT"
] | 0 | bbcb381b9cb0c91ae1af33ce43b43f352055041c | https://github.com/yulinfeng000/AdaptiveNeuralTrees/tree/bbcb381b9cb0c91ae1af33ce43b43f352055041c |
LRN | import torch
import torch.nn as nn
class LRN(nn.Module):
def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=
False):
super(LRN, self).__init__()
self.ACROSS_CHANNELS = ACROSS_CHANNELS
if self.ACROSS_CHANNELS:
self.average = nn.AvgPool3d(kernel_size=... | 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_... | zenghui9977/AFL | LRN | false | 13,165 | [
"MIT"
] | 0 | 769d78be94ce8f80d376aceb2de9dc5a9d20a807 | https://github.com/zenghui9977/AFL/tree/769d78be94ce8f80d376aceb2de9dc5a9d20a807 |
SimpleMLPGen_with_meta_feature | import torch
import torch.optim
import torch.jit
import torch.nn as nn
class SimpleMLPGen_with_meta_feature(nn.Module):
def __init__(self, num_in_features, num_out_features, neurons_per_layer):
super(SimpleMLPGen_with_meta_feature, self).__init__()
self.l_in = nn.Linear(in_features=num_in_feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.optim
... | zhaofeng-shu33/deep_euler_tests | SimpleMLPGen_with_meta_feature | false | 13,166 | [
"MIT"
] | 0 | a3d0961af679d490b0c58873ee0726234122bc7a | https://github.com/zhaofeng-shu33/deep_euler_tests/tree/a3d0961af679d490b0c58873ee0726234122bc7a |
BertLMHead | from _paritybench_helpers import _mock_config
from torch.nn import Module
import torch
from torch.nn import LayerNorm
from torch.nn import Linear
from torch.nn.functional import gelu
class BertLMHead(Module):
def __init__(self, config):
super(BertLMHead, self).__init__()
hidden_size = config['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.triton_helpers import libdevice
from torch.nn impor... | yulonglin/bert | BertLMHead | false | 13,167 | [
"MIT"
] | 0 | 7f992e88f109e4267b0e84f8398cab0561a67f4f | https://github.com/yulonglin/bert/tree/7f992e88f109e4267b0e84f8398cab0561a67f4f |
NormedResidualLayer | from torch.nn import Module
import torch
from torch.nn import Dropout
from torch.nn import LayerNorm
from torch.nn import Linear
from torch.nn.functional import gelu
class NormedResidualLayer(Module):
def __init__(self, size, intermediate_size, dropout):
super(NormedResidualLayer, 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.triton_helpers import libdevice
from torch.nn impor... | yulonglin/bert | NormedResidualLayer | false | 13,168 | [
"MIT"
] | 0 | 7f992e88f109e4267b0e84f8398cab0561a67f4f | https://github.com/yulonglin/bert/tree/7f992e88f109e4267b0e84f8398cab0561a67f4f |
GLU | import torch
from torch import nn
class GLU(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
def forward(self, x):
out, gate = x.chunk(2, dim=self.dim)
return out * gate.sigmoid()
def get_inputs():
return [torch.rand([4, 4, 4, 4, 4])]
def get_ini... | 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... | zhengx18/conformer | GLU | false | 13,169 | [
"MIT"
] | 0 | a258c0b0cc70034f53d2b2040badf5d58aab95bc | https://github.com/zhengx18/conformer/tree/a258c0b0cc70034f53d2b2040badf5d58aab95bc |
TripletLogExpLoss | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
class TripletLogExpLoss(nn.Module):
"""Creates a criterion that measures the triplet loss given an input
tensors x1, x2, x3.
This is used for measuring a relative similarity between samples. A triplet
is composed by ... | 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 numpy as np
import torch.nn as nn
assert_size_stride = ... | zhangxue123/deep-image-retrieval | TripletLogExpLoss | false | 13,170 | [
"BSD-3-Clause"
] | 0 | ac188856fa5a034aed3f7ed3fb617d580da44462 | https://github.com/zhangxue123/deep-image-retrieval/tree/ac188856fa5a034aed3f7ed3fb617d580da44462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.