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 |
|---|---|---|---|---|---|---|---|---|---|---|
CIoULoss | import math
import torch
import torch.distributed
import torch
import torch.nn as nn
import torch.nn.functional
import torch.utils.data
import torch.optim
import torch.optim.lr_scheduler
def ciou(pred, target, eps=1e-07):
lt = torch.max(pred[:, :2], target[:, :2])
rb = torch.min(pred[:, 2:], target[:, 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
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.dis... | zhangzhengde0225/SwinTrack | CIoULoss | false | 16,808 | [
"MIT"
] | 143 | 526be17f8ef266cb924c6939bd8dda23e9b73249 | https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249 |
LWS | import torch
import torch.nn as nn
class LWS(nn.Module):
def __init__(self, num_features, num_classes, bias=True):
super(LWS, self).__init__()
self.fc = nn.Linear(num_features, num_classes, bias=bias)
self.scales = nn.Parameter(torch.ones(num_classes))
for param_name, param in 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | zhangyongshun/BagofTricks-LT | LWS | false | 16,809 | [
"MIT"
] | 115 | aec4d9a552236c32231374b7b00fa5bf4208dae3 | https://github.com/zhangyongshun/BagofTricks-LT/tree/aec4d9a552236c32231374b7b00fa5bf4208dae3 |
RNN | import torch
import torch.nn as nn
from torch.autograd import Variable
class RNN(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(RNN, self).__init__()
self.hidden_size = hidden_size
self.i2h = nn.Linear(input_size + hidden_size, hidden_size)
self.i2o = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 Variable
assert_size_stride = t... | zhiyongc/Graph_Convolutional_LSTM | RNN | false | 16,810 | [
"MIT"
] | 281 | a703b63e626b1e2563fe3f45d9714e468b1d4a0e | https://github.com/zhiyongc/Graph_Convolutional_LSTM/tree/a703b63e626b1e2563fe3f45d9714e468b1d4a0e |
CosineClassifier | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
def cosine_fully_connected_layer(x_in, weight, scale=None, bias=None,
normalize_x=True, normalize_w=True):
assert x_in.dim() == 2
assert weight.dim() == 2
assert x_in.size(1) == weight.size(0)
if normalize_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 import triton_helpers
from torch._inductor.runtime.... | zheang01/FACT | CosineClassifier | false | 16,811 | [
"MIT"
] | 65 | a877cc86acc4d29fb7589c8ac571c8aef09e5fd8 | https://github.com/zheang01/FACT/tree/a877cc86acc4d29fb7589c8ac571c8aef09e5fd8 |
GIoULoss | import torch
import torch.distributed
import torch
import torch.nn as nn
import torch.nn.functional
import torch.utils.data
import torch.optim
import torch.optim.lr_scheduler
def fp16_clamp(x, min=None, max=None):
if not x.is_cuda and x.dtype == torch.float16:
return x.float().clamp(min, max).half()
r... | 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.distributed
import torch
import torch.nn as nn
import torch.nn.functional
im... | zhangzhengde0225/SwinTrack | GIoULoss | false | 16,812 | [
"MIT"
] | 143 | 526be17f8ef266cb924c6939bd8dda23e9b73249 | https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249 |
BoundedIoULoss | import torch
import torch.distributed
import torch
import torch.nn as nn
import torch.nn.functional
import torch.utils.data
import torch.optim
import torch.optim.lr_scheduler
def bounded_iou_loss(pred, target, beta=0.2, eps=0.001):
"""BIoULoss.
This is an implementation of paper
`Improving Object Localiz... | 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.distribut... | zhangzhengde0225/SwinTrack | BoundedIoULoss | false | 16,813 | [
"MIT"
] | 143 | 526be17f8ef266cb924c6939bd8dda23e9b73249 | https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249 |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from queue import *
from math import *
class Attention(nn.Module):
def __init__(self, hidden_size):
super(Attention, self).__init__()
self.attn = nn.Linear(hidden_size * 2, hidden_size)
self.v = nn.Parameter(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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | zhongerqiandan/OpenDialog | Attention | false | 16,814 | [
"MIT"
] | 98 | f478b2a912c8c742da5ced510ac40da59217ddb3 | https://github.com/zhongerqiandan/OpenDialog/tree/f478b2a912c8c742da5ced510ac40da59217ddb3 |
segmentation_layer | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class segmentation_layer(nn.Module):
def __init__(self, args):
super(segmentation_layer, self).__init__()
self.segm_layer = nn.Conv2d(32, args.snumclass, kernel_size=1)
def forward(self, featMap):
segm =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | zhenpeiyang/RelativePose | segmentation_layer | false | 16,815 | [
"BSD-3-Clause"
] | 144 | 2e9fdf5003c5952cf610f8c6d891519b9e9e014b | https://github.com/zhenpeiyang/RelativePose/tree/2e9fdf5003c5952cf610f8c6d891519b9e9e014b |
MyUpsample2 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class MyUpsample2(nn.Module):
def forward(self, x):
return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x
.size(0), x.size(1), x.size(2) * 2, x.size(3) * 2)
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
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.... | zigonk/ReSC | MyUpsample2 | false | 16,816 | [
"MIT"
] | 57 | c816365b0410f521974060ef0cc6eaa1dd09b63a | https://github.com/zigonk/ReSC/tree/c816365b0410f521974060ef0cc6eaa1dd09b63a |
BCEFocalLoss | import torch
class BCEFocalLoss(torch.nn.Module):
"""
二分类的Focalloss alpha 固定
"""
def __init__(self, gamma=2, alpha=0.25, reduction='sum', loss_weight=1.0):
super().__init__()
self.gamma = gamma
self.alpha = alpha
self.reduction = reduction
self.loss_weight = loss_w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | zhiqi-li/Panoptic-SegFormer | BCEFocalLoss | false | 16,817 | [
"Apache-2.0"
] | 97 | cdb9b68059e9ef825a3f7079c37aa835b1711227 | https://github.com/zhiqi-li/Panoptic-SegFormer/tree/cdb9b68059e9ef825a3f7079c37aa835b1711227 |
LAM_Gconv | import torch
import torch.nn as nn
class LAM_Gconv(nn.Module):
def __init__(self, in_features, out_features, activation=nn.ReLU(
inplace=True)):
super(LAM_Gconv, self).__init__()
self.fc = nn.Linear(in_features=in_features, out_features=out_features)
self.activation = 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.... | zhaoweixi/GraFormer | LAM_Gconv | false | 16,818 | [
"BSD-2-Clause"
] | 384 | 0a0a04014cdf157c11ab8e952862efa27c6a1980 | https://github.com/zhaoweixi/GraFormer/tree/0a0a04014cdf157c11ab8e952862efa27c6a1980 |
IRHead | import torch
import torch.nn as nn
from queue import *
from math import *
class IRHead(nn.Module):
def __init__(self, hidden_size, dropout=0.5):
super(IRHead, self).__init__()
self.M = nn.Parameter(torch.randn(hidden_size, hidden_size))
self.hidden_layer = nn.Linear(hidden_size * 2 + 1, h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | zhongerqiandan/OpenDialog | IRHead | false | 16,819 | [
"MIT"
] | 98 | f478b2a912c8c742da5ced510ac40da59217ddb3 | https://github.com/zhongerqiandan/OpenDialog/tree/f478b2a912c8c742da5ced510ac40da59217ddb3 |
DenseBlock | import torch
import torch.nn as nn
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, nn.Conv2d):
init.kaiming_normal_(m.weight, a=0, mode='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
import torch.nn as nn
import torch.nn.init as init
assert_size_stride = torch._C... | yzxing87/Invertible-ISP | DenseBlock | false | 16,820 | [
"MIT"
] | 246 | 344dd333dd2a075f6a9e4ffc445dc387ca3014c4 | https://github.com/yzxing87/Invertible-ISP/tree/344dd333dd2a075f6a9e4ffc445dc387ca3014c4 |
LSTM | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.autograd import Variable
class LSTM(nn.Module):
def __init__(self, input_size, cell_size, hidden_size):
"""
cell_size is the size of cell_state.
hidden_size is the size of hidden_state, or say the output_state o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | zhiyongc/Graph_Convolutional_LSTM | LSTM | false | 16,821 | [
"MIT"
] | 281 | a703b63e626b1e2563fe3f45d9714e468b1d4a0e | https://github.com/zhiyongc/Graph_Convolutional_LSTM/tree/a703b63e626b1e2563fe3f45d9714e468b1d4a0e |
BG_loss | import torch
import torch.nn as nn
import torch.utils.data.distributed
class BG_loss(nn.Module):
def __init__(self):
super(BG_loss, self).__init__()
self.loss = nn.L1Loss()
def forward(self, real_imgs, fake_imgs, masks):
real_imgs_ = real_imgs.clone()
fake_imgs_ = fake_imgs.c... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ziqi-jin/OpenUnReID | BG_loss | false | 16,822 | [
"Apache-2.0"
] | 344 | 50eb516945c418398cac890029d1b366c27c0185 | https://github.com/ziqi-jin/OpenUnReID/tree/50eb516945c418398cac890029d1b366c27c0185 |
SmoothSoftmax | import torch
from torch import Tensor
from torch import nn
class SmoothSoftmax(nn.Module):
def forward(self, x: 'Tensor'):
logistic_value = torch.sigmoid(x)
return logistic_value / logistic_value.sum(dim=-1, keepdim=True)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | zsl24/voice-activity-detection | SmoothSoftmax | false | 16,823 | [
"MIT"
] | 74 | a034be23c6283121c6b72e778c6ff6711045cbe3 | https://github.com/zsl24/voice-activity-detection/tree/a034be23c6283121c6b72e778c6ff6711045cbe3 |
Quaternion | import torch
import torch.nn as nn
import torch.utils.data
class Quaternion(nn.Module):
def __init__(self):
super(Quaternion, self).__init__()
def forward(self, rvec):
theta = torch.sqrt(1e-05 + torch.sum(rvec ** 2, dim=1))
rvec = rvec / theta[:, None]
return torch.stack((1.0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dy... | zhuhao-nju/mofanerf | Quaternion | false | 16,824 | [
"MIT"
] | 55 | 0206526e25aab3dd8f0cc789f290c7559642676b | https://github.com/zhuhao-nju/mofanerf/tree/0206526e25aab3dd8f0cc789f290c7559642676b |
Rodrigues | import torch
import torch.nn as nn
import torch.utils.data
class Rodrigues(nn.Module):
def __init__(self):
super(Rodrigues, self).__init__()
def forward(self, rvec):
theta = torch.sqrt(1e-05 + torch.sum(rvec ** 2, dim=1))
rvec = rvec / theta[:, None]
costh = torch.cos(theta)
... | 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 torch.nn as nn
import torch.utils.data
assert_size_stri... | zhuhao-nju/mofanerf | Rodrigues | false | 16,825 | [
"MIT"
] | 55 | 0206526e25aab3dd8f0cc789f290c7559642676b | https://github.com/zhuhao-nju/mofanerf/tree/0206526e25aab3dd8f0cc789f290c7559642676b |
ChebConv | import torch
import torch.nn as nn
from torch.nn import init
class ChebConv(nn.Module):
"""
The ChebNet convolution operation.
:param in_c: int, number of input channels.
:param out_c: int, number of output channels.
:param K: int, the order of Chebyshev Polynomial.
"""
def __init__(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | zhaoweixi/GraFormer | ChebConv | false | 16,826 | [
"BSD-2-Clause"
] | 384 | 0a0a04014cdf157c11ab8e952862efa27c6a1980 | https://github.com/zhaoweixi/GraFormer/tree/0a0a04014cdf157c11ab8e952862efa27c6a1980 |
Attention | import torch
from torch import Tensor
from torch import nn
class Attention(nn.Module):
def forward(self, selected_input: 'Tensor', attention: 'Tensor'):
attended_input = selected_input * attention.unsqueeze(-1)
return attended_input
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.... | 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... | zsl24/voice-activity-detection | Attention | false | 16,827 | [
"MIT"
] | 74 | a034be23c6283121c6b72e778c6ff6711045cbe3 | https://github.com/zsl24/voice-activity-detection/tree/a034be23c6283121c6b72e778c6ff6711045cbe3 |
RerangeLayer | import torch
import torch.utils.data
import torch.nn as nn
class RerangeLayer(nn.Module):
def __init__(self):
super(RerangeLayer, self).__init__()
def forward(self, inp):
return (inp + 1.0) / 2.0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | zvict/HyperRIM | RerangeLayer | false | 16,828 | [
"Apache-2.0"
] | 92 | f3800196b59ea0f94561efa88ec2e6675e4c8b00 | https://github.com/zvict/HyperRIM/tree/f3800196b59ea0f94561efa88ec2e6675e4c8b00 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, focusing_param=2, balance_param=0.25):
super(FocalLoss, self).__init__()
self.focusing_param = focusing_param
self.balance_param = balance_param
def forward(self, output,... | 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
... | zwx8981/DBCNN-Pytorch | FocalLoss | false | 16,829 | [
"MIT"
] | 150 | 16c3156054a30a3eabb45dffcf538f42452a14f3 | https://github.com/zwx8981/DBCNN-Pytorch/tree/16c3156054a30a3eabb45dffcf538f42452a14f3 |
cross_entropy_prob | import torch
import torch.nn as nn
import torch.nn.functional as F
class cross_entropy_prob(nn.Module):
def __init__(self):
super(cross_entropy_prob, self).__init__()
def forward(self, pred, soft_targets):
pred = F.log_softmax(pred)
loss = torch.mean(torch.sum(-soft_targets * pred, 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.nn as nn
... | zwx8981/DBCNN-Pytorch | cross_entropy_prob | false | 16,830 | [
"MIT"
] | 150 | 16c3156054a30a3eabb45dffcf538f42452a14f3 | https://github.com/zwx8981/DBCNN-Pytorch/tree/16c3156054a30a3eabb45dffcf538f42452a14f3 |
SelfAttentionBlock | import torch
import torch.distributed
import torch
import torch.nn as nn
import torch.nn.functional
import torch.utils.data
import torch.optim
import torch.optim.lr_scheduler
class Mlp(nn.Module):
""" Multilayer perceptron."""
def __init__(self, in_features, hidden_features=None, out_features=None,
a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zhangzhengde0225/SwinTrack | SelfAttentionBlock | false | 16,831 | [
"MIT"
] | 143 | 526be17f8ef266cb924c6939bd8dda23e9b73249 | https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249 |
A2Block | import torch
import torch.nn as nn
class A2Block(nn.Module):
"""
Implementation of A2Block(NIPS 2018)
"""
def __init__(self, inplane, plane):
super(A2Block, self).__init__()
self.down = nn.Conv2d(inplane, plane, 1)
self.up = nn.Conv2d(plane, inplane, 1)
self.gather... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zj1008/GALD-DGCNet | A2Block | false | 16,832 | [
"MIT"
] | 127 | be7ebfe2b3d28ea28a2b4714852999d4af2a785e | https://github.com/zj1008/GALD-DGCNet/tree/be7ebfe2b3d28ea28a2b4714852999d4af2a785e |
BoundedSingleVar | import torch
class BoundedSingleVar(torch.nn.Module):
"""Wrapper a single parameter to represent an unknown coefficient in inverse problem with the upper and lower bound.
:param lower_bound: The lower bound for the parameter.
:type lower_bound: float
:param upper_bound: The upper bound for the parame... | 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... | zweien/idrlnet | BoundedSingleVar | false | 16,833 | [
"Apache-2.0"
] | 66 | 3a19a3301d565c0906aac84ff31eefcff75726a8 | https://github.com/zweien/idrlnet/tree/3a19a3301d565c0906aac84ff31eefcff75726a8 |
FcCat | import torch
import torch.nn as nn
class FcCat(nn.Module):
def __init__(self, nIn, nOut):
super(FcCat, self).__init__()
self.fc = nn.Linear(nIn, nOut, bias=False)
def forward(self, x):
out = torch.cat((x, self.fc(x)), 1)
return out
def get_inputs():
return [torch.rand([... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | zwh930712/densenet.pytorch | FcCat | false | 16,834 | [
"Apache-2.0"
] | 826 | d1cd5e1957975628286e516512c6d1c14430f810 | https://github.com/zwh930712/densenet.pytorch/tree/d1cd5e1957975628286e516512c6d1c14430f810 |
CrossAttentionBlock | import torch
import torch.distributed
import torch
import torch.nn as nn
import torch.nn.functional
import torch.utils.data
import torch.optim
import torch.optim.lr_scheduler
class Mlp(nn.Module):
""" Multilayer perceptron."""
def __init__(self, in_features, hidden_features=None, out_features=None,
a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zhangzhengde0225/SwinTrack | CrossAttentionBlock | false | 16,835 | [
"MIT"
] | 143 | 526be17f8ef266cb924c6939bd8dda23e9b73249 | https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249 |
Net | import torch
import torch.nn as nn
class FcCat(nn.Module):
def __init__(self, nIn, nOut):
super(FcCat, self).__init__()
self.fc = nn.Linear(nIn, nOut, bias=False)
def forward(self, x):
out = torch.cat((x, self.fc(x)), 1)
return out
class Net(nn.Module):
def __init__(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... | zwh930712/densenet.pytorch | Net | false | 16,836 | [
"Apache-2.0"
] | 826 | d1cd5e1957975628286e516512c6d1c14430f810 | https://github.com/zwh930712/densenet.pytorch/tree/d1cd5e1957975628286e516512c6d1c14430f810 |
SpatialSoftmaxBZ | import torch
import numpy as np
import torch.nn.functional as F
class SpatialSoftmaxBZ(torch.nn.Module):
"""
IMPORTANT:
i in [0, 1], where 0 is at the bottom, 1 is at the top
j in [-1, 1]
"""
def __init__(self, height, width):
super().__init__()
self.height = height
se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy as np
ass... | zwc662/SequentialAttack | SpatialSoftmaxBZ | false | 16,837 | [
"MIT"
] | 116 | 677b19c51ea76d794939ee126fccd75ffa0e6fe6 | https://github.com/zwc662/SequentialAttack/tree/677b19c51ea76d794939ee126fccd75ffa0e6fe6 |
AttentionLayer | import torch
import torch.nn.functional as F
import torch.utils.data
import torch.distributed
import torch.nn as nn
import torch.optim
import torch.optim.lr_scheduler
def Linear(in_features, out_features, bias=True, dropout=0):
"""Weight-normalized Linear layer (input: N x T x C)"""
m = nn.Linear(in_features,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | zsquaredz/XSum | AttentionLayer | false | 16,838 | [
"MIT"
] | 235 | 10f2fac2e70801e7a3973c864b5a24b61d3f8bfe | https://github.com/zsquaredz/XSum/tree/10f2fac2e70801e7a3973c864b5a24b61d3f8bfe |
PSNR | import torch
from torch.nn.modules.loss import _Loss
class PSNR(_Loss):
def __init__(self):
super(PSNR, self).__init__()
self.val_range = 255
def _quantize(self, img):
img = img * self.val_range
img = img.clamp(0, self.val_range).round()
return img
def forward(se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn.modules.loss i... | zzh-tech/RSCD | PSNR | false | 16,839 | [
"MIT"
] | 57 | b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e | https://github.com/zzh-tech/RSCD/tree/b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e |
DenseLayer | import torch
import torch.nn as nn
def actFunc(act, *args, **kwargs):
act = act.lower()
if act == 'relu':
return nn.ReLU()
elif act == 'relu6':
return nn.ReLU6()
elif act == 'leakyrelu':
return nn.LeakyReLU(0.1)
elif act == 'prelu':
return nn.PReLU()
elif act ==... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | zzh-tech/RSCD | DenseLayer | false | 16,840 | [
"MIT"
] | 57 | b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e | https://github.com/zzh-tech/RSCD/tree/b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e |
TxtNet | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class TxtNet(nn.Module):
def __init__(self, code_len, txt_feat_len):
super(TxtNet, self).__init__()
self.fc1 = nn.Linear(txt_feat_len, 4096)
self.fc2 = nn.Linear(4096, code_len)
self.alpha = 1.0
de... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | zzs1994/DJsRH | TxtNet | false | 16,841 | [
"MIT"
] | 53 | 6041c2df810723dd0052e2e5b7c6bd33033f0f21 | https://github.com/zzs1994/DJsRH/tree/6041c2df810723dd0052e2e5b7c6bd33033f0f21 |
FeatureFusion | import torch
import torch.distributed
import torch
import torch.nn as nn
import torch.nn.functional
import torch.utils.data
import torch.optim
import torch.optim.lr_scheduler
class Mlp(nn.Module):
""" Multilayer perceptron."""
def __init__(self, in_features, hidden_features=None, out_features=None,
a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zhangzhengde0225/SwinTrack | FeatureFusion | false | 16,842 | [
"MIT"
] | 143 | 526be17f8ef266cb924c6939bd8dda23e9b73249 | https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249 |
TargetQueryDecoderLayer | import torch
import torch.distributed
import torch
import torch.nn as nn
import torch.nn.functional
import torch.utils.data
import torch.optim
import torch.optim.lr_scheduler
class Mlp(nn.Module):
""" Multilayer perceptron."""
def __init__(self, in_features, hidden_features=None, out_features=None,
a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zhangzhengde0225/SwinTrack | TargetQueryDecoderLayer | false | 16,843 | [
"MIT"
] | 143 | 526be17f8ef266cb924c6939bd8dda23e9b73249 | https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249 |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, kernel_size):
super(Actor, self).__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=kernel_size)
self.conv2 = nn.Conv2d(16, 4, kernel_size=kernel_size)
self.pool1 = nn.M... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | zwc662/SequentialAttack | Actor | false | 16,844 | [
"MIT"
] | 116 | 677b19c51ea76d794939ee126fccd75ffa0e6fe6 | https://github.com/zwc662/SequentialAttack/tree/677b19c51ea76d794939ee126fccd75ffa0e6fe6 |
StdConv2dSame | import math
import torch
import torch.nn as nn
import torchvision.transforms.functional as F
import torch.nn.functional as F
import torch.utils.data.distributed
def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'):
return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0)
def pad_same(x, k, s, 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.triton_helpers import libdevice
import math
import ... | ziniuwan/maed | StdConv2dSame | false | 16,845 | [
"MIT"
] | 145 | 9e1f1c37eba81da86c8d9c62dc9be41a01abff5b | https://github.com/ziniuwan/maed/tree/9e1f1c37eba81da86c8d9c62dc9be41a01abff5b |
MDNHead | from torch.nn import Module
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
from torch.distributions import Categorical
from torch.nn.utils import vector_to_parameters
from torch.nn.utils import parameters_to_vector
def ortho_init(module, no... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn... | zuoxingdong/lagom | MDNHead | false | 16,846 | [
"MIT"
] | 383 | 3b6710804dbc79c6dffb369ac87c68f4055ab6cd | https://github.com/zuoxingdong/lagom/tree/3b6710804dbc79c6dffb369ac87c68f4055ab6cd |
_ASPPModule | import torch
import torch.nn as nn
class GCT(nn.Module):
def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False
):
super(GCT, self).__init__()
self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1))
self.gamma = nn.Parameter(torch.zeros(1, num_channels, 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.... | yoxu515/CFBI | _ASPPModule | false | 16,847 | [
"BSD-3-Clause"
] | 312 | 0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586 | https://github.com/yoxu515/CFBI/tree/0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586 |
Gaussian | import torch
from torch import Tensor
import torch.utils.tensorboard
import torch.utils.data
class Gaussian(torch.nn.Module):
"""Gaussian activation"""
def forward(self, x: 'Tensor') ->Tensor:
return torch.exp(-x * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.tensorboard
import torch.utils.data
assert_size_stride... | yangyinuo823/torchani | Gaussian | false | 16,848 | [
"MIT"
] | 305 | b0cd62eda59829d197b3c37f2215ba1af64f1c8d | https://github.com/yangyinuo823/torchani/tree/b0cd62eda59829d197b3c37f2215ba1af64f1c8d |
waspIntrinsicComposer | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class waspIntrinsicComposer(nn.Module):
def __init__(self, opt):
super(waspIntrinsicComposer, self).__init__()
self.ngpu = opt.ngpu
self.nc = opt.nc
def 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
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | zhixinshu/DeformingAutoencoders-pytorch | waspIntrinsicComposer | false | 16,849 | [
"BSD-2-Clause"
] | 112 | 72996c5d11ae25dd0051bb51df353fef88e65742 | https://github.com/zhixinshu/DeformingAutoencoders-pytorch/tree/72996c5d11ae25dd0051bb51df353fef88e65742 |
VGG16 | import torch
import torch.nn as nn
from torch.nn import functional as F
class VGG16(nn.Module):
def __init__(self, conv5_dilation=1):
super(VGG16, self).__init__()
None
self.conv1_1 = nn.Conv2d(3, 64, 3, padding=1)
self.conv1_2 = nn.Conv2d(64, 64, 3, padding=1)
self.pool1 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | yaoqi-zd/SGAN | VGG16 | false | 16,850 | [
"MIT"
] | 48 | 43d8a859b03967e2423a73ef1ba332ee71714ba4 | https://github.com/yaoqi-zd/SGAN/tree/43d8a859b03967e2423a73ef1ba332ee71714ba4 |
BridgeConnection | import torch
import torch.nn as nn
from torch.utils import tensorboard as tensorboard
class BridgeConnection(nn.Module):
def __init__(self, in_dim, out_dim, dout_p):
super(BridgeConnection, self).__init__()
self.norm = nn.LayerNorm(in_dim)
self.linear = nn.Linear(in_dim, out_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.... | valterlej/CustomBMT | BridgeConnection | false | 16,851 | [
"MIT"
] | 157 | c9326752d1355c81f845f2caab9c047be76067de | https://github.com/valterlej/CustomBMT/tree/c9326752d1355c81f845f2caab9c047be76067de |
FeatureEmbedder | import torch
import numpy as np
import torch.nn as nn
from torch.utils import tensorboard as tensorboard
class FeatureEmbedder(nn.Module):
def __init__(self, d_feat, d_model):
super(FeatureEmbedder, self).__init__()
self.d_model = d_model
self.embedder = nn.Linear(d_feat, d_model)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | valterlej/CustomBMT | FeatureEmbedder | false | 16,852 | [
"MIT"
] | 157 | c9326752d1355c81f845f2caab9c047be76067de | https://github.com/valterlej/CustomBMT/tree/c9326752d1355c81f845f2caab9c047be76067de |
SpatialCGNL | import torch
import torch.nn as nn
class SpatialCGNL(nn.Module):
"""Spatial CGNL block with dot production kernel for image classfication.
"""
def __init__(self, inplanes, planes, use_scale=False, groups=8):
self.use_scale = use_scale
self.groups = groups
super(SpatialCGNL, 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.... | zj1008/GALD-DGCNet | SpatialCGNL | false | 16,853 | [
"MIT"
] | 127 | be7ebfe2b3d28ea28a2b4714852999d4af2a785e | https://github.com/zj1008/GALD-DGCNet/tree/be7ebfe2b3d28ea28a2b4714852999d4af2a785e |
MultiheadedAttention | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
from torch.utils import tensorboard as tensorboard
def attention(Q, K, V, mask, dropout=None):
d_k = Q.size(-1)
QKt = Q.matmul(K.transpose(-1, -2))
sm_input = QKt / np.sqrt(d_k)
if mask is not None:
sm_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.... | valterlej/CustomBMT | MultiheadedAttention | false | 16,854 | [
"MIT"
] | 157 | c9326752d1355c81f845f2caab9c047be76067de | https://github.com/valterlej/CustomBMT/tree/c9326752d1355c81f845f2caab9c047be76067de |
SinkhornDistance | import torch
import torch.utils.data
class SinkhornDistance(torch.nn.Module):
"""
Given two empirical measures each with :math:`P_1` locations
:math:`x\\in\\mathbb{R}^{D_1}` and :math:`P_2` locations :math:`y\\in\\mathbb{R}^{D_2}`,
outputs an approximation of the regularized OT cost for po... | 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... | yjh0410/actionformer_release | SinkhornDistance | false | 16,855 | [
"MIT"
] | 61 | 7a97422111d3e29c8d2e14088c850c6975855ea7 | https://github.com/yjh0410/actionformer_release/tree/7a97422111d3e29c8d2e14088c850c6975855ea7 |
FCN8s | import torch
import numpy as np
import torch.nn as nn
class FCN8s(nn.Module):
def __init__(self, n_class=3):
super(FCN8s, self).__init__()
self.conv1_1 = nn.Conv2d(3, 64, 3, padding=100)
self.relu1_1 = nn.ReLU(inplace=True)
self.conv1_2 = nn.Conv2d(64, 64, 3, padding=1)
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
import numpy as np
import tor... | twni2016/OrganSegRSTN_PyTorch | FCN8s | false | 16,856 | [
"MIT"
] | 100 | bf571320e718c8f138e04d48645e3b4dfe75801d | https://github.com/twni2016/OrganSegRSTN_PyTorch/tree/bf571320e718c8f138e04d48645e3b4dfe75801d |
LayoutNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class LayoutNet(nn.Module):
def __init__(self):
super(LayoutNet, self).__init__()
self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1, stride=1)
self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1, stride=1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | wellowdata/pytorch-layoutnet | LayoutNet | false | 16,857 | [
"MIT"
] | 155 | 3d4352f94ed00d3c37890e9119452811d4f0893f | https://github.com/wellowdata/pytorch-layoutnet/tree/3d4352f94ed00d3c37890e9119452811d4f0893f |
ClassNetVideoConv | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Unit3D(nn.Module):
"""Basic unit containing Conv3D + BatchNorm + non-linearity."""
def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1),
stride=(1, 1, 1), padding=0, activation_fn=F.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
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
as... | SheffieldAI/pykale | ClassNetVideoConv | false | 16,858 | [
"MIT"
] | 324 | be7670941fb06835883c80477b26702d407017db | https://github.com/SheffieldAI/pykale/tree/be7670941fb06835883c80477b26702d407017db |
single_param | import torch
import torch.nn as nn
import torch.distributions
class single_param(nn.Module):
def __init__(self, value):
super(single_param, self).__init__()
self.p = nn.Parameter(torch.FloatTensor([value]))
def forward(self):
return torch.abs(self.p)
def get_inputs():
return []... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.distributions
assert_size_stride = tor... | AaltoML/PeriodicBNN | single_param | false | 16,859 | [
"MIT"
] | 9 | 1638edb365641e7fe2ea2ab3c15b9439473f9cf3 | https://github.com/AaltoML/PeriodicBNN/tree/1638edb365641e7fe2ea2ab3c15b9439473f9cf3 |
VertexDirectEmbedder | import torch
import torch.utils.data
from torch import nn
def normalize_embeddings(embeddings: 'torch.Tensor', epsilon: 'float'=1e-06
) ->torch.Tensor:
"""
Normalize N D-dimensional embedding vectors arranged in a tensor [N, D]
Args:
embeddings (tensor [N, D]): N D-dimensional embedding vecto... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
from... | AbirKhan96/facebook-detectron2 | VertexDirectEmbedder | false | 16,860 | [
"Apache-2.0"
] | 5 | 6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 | https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 |
IIDIsotropicGaussianUVLoss | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class IIDIsotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of iid residuals with isotropic covariance:
$Sigma_i = sigma_i^2 I$
The loss (negative log likelihood) is then:
$1/2 sum_{i=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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import math... | AbirKhan96/facebook-detectron2 | IIDIsotropicGaussianUVLoss | false | 16,861 | [
"Apache-2.0"
] | 5 | 6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 | https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 |
LastLevelMaxPool | import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class LastLevelMaxPool(nn.Module):
"""
This module is used in the original FPN to generate a downsampled
P6 feature from P5.
"""
def __init__(self):
super().__init__()
self.num_levels = 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.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | AbirKhan96/facebook-detectron2 | LastLevelMaxPool | false | 16,862 | [
"Apache-2.0"
] | 5 | 6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 | https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 |
HardSigmoid | import torch
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
def hard_sigmoid(input_, inplace: 'bool'=False):
"""hard sigmoid function"""
if inplace:
return input_.add_(3.0).clamp_(0.0, 6.0).di... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import t... | Adlik/zen_nas | HardSigmoid | false | 16,863 | [
"Apache-2.0"
] | 7 | d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 | https://github.com/Adlik/zen_nas/tree/d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 |
ResizeTransform | import torch
import torch.nn as nn
import torch.nn.functional as nnf
import torch.utils
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.... | 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... | Alison-brie/AutoReg | ResizeTransform | false | 16,864 | [
"MIT"
] | 10 | a23d45a6f7c6e47f61430e1565dda316452a4418 | https://github.com/Alison-brie/AutoReg/tree/a23d45a6f7c6e47f61430e1565dda316452a4418 |
Conv2d | import torch
import torch.utils.data
import torch.nn.functional as F
class Conv2d(torch.nn.Conv2d):
"""
A wrapper around :class:`torch.nn.Conv2d` to support empty inputs and more features.
"""
def __init__(self, *args, **kwargs):
"""
Extra keyword arguments supported in addition to th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | AbirKhan96/facebook-detectron2 | Conv2d | false | 16,865 | [
"Apache-2.0"
] | 5 | 6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 | https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 |
Linear_softmax | import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear_softmax(nn.Module):
def __init__(self, inp, out):
super(Linear_softmax, self).__init__()
self.f1 = nn.Linear(inp, out)
def forward(self, x):
x = self.f1(x)
return F.softmax(x, dim=1)
def get_inp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Alfo5123/ConcreteDropout | Linear_softmax | false | 16,866 | [
"MIT"
] | 7 | c442871553e20a2de078c0fbac7fa52302d50abf | https://github.com/Alfo5123/ConcreteDropout/tree/c442871553e20a2de078c0fbac7fa52302d50abf |
IndepAnisotropicGaussianUVLoss | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class IndepAnisotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of independent residuals with anisotropic covariances:
$Sigma_i = sigma_i^2 I + r_i r_i^T$
The loss (negative log likelihood) is ... | 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 math... | AbirKhan96/facebook-detectron2 | IndepAnisotropicGaussianUVLoss | false | 16,867 | [
"Apache-2.0"
] | 5 | 6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 | https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87 |
TrueDynamics | import torch
import numpy as np
import torch.nn as nn
from torch.autograd import Variable
class TrueDynamics(nn.Module):
def __init__(self, env, hidden_size=200, drop_prob=0.0):
super().__init__()
self.env = env
self.hidden_size = hidden_size
self.drop_prob = drop_prob
sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Alfo5123/ConcreteDropout | TrueDynamics | false | 16,868 | [
"MIT"
] | 7 | c442871553e20a2de078c0fbac7fa52302d50abf | https://github.com/Alfo5123/ConcreteDropout/tree/c442871553e20a2de078c0fbac7fa52302d50abf |
EqualConv2d | import torch
from torch import nn
from math import sqrt
def equal_lr(module, name='weight'):
EqualLR.apply(module, name)
return module
class EqualLR:
def __init__(self, name):
self.name = name
def compute_weight(self, module):
weight = getattr(module, self.name + '_orig')
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 import nn
from math import sqrt
assert_size_stride = torch._C._dynamo... | AaltoVision/balanced-pioneer | EqualConv2d | false | 16,869 | [
"MIT"
] | 5 | 51f58080fd2db3159de3e1ccb47f38e03220faf0 | https://github.com/AaltoVision/balanced-pioneer/tree/51f58080fd2db3159de3e1ccb47f38e03220faf0 |
PixelNorm | import torch
from torch import nn
class PixelNorm(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
return input / torch.sqrt(torch.mean(input ** 2, dim=1, keepdim=
True) + 1e-08)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AaltoVision/balanced-pioneer | PixelNorm | false | 16,870 | [
"MIT"
] | 5 | 51f58080fd2db3159de3e1ccb47f38e03220faf0 | https://github.com/AaltoVision/balanced-pioneer/tree/51f58080fd2db3159de3e1ccb47f38e03220faf0 |
EmbeddingModule | import torch
import torch.nn as nn
class EmbeddingModule(nn.Module):
def __init__(self, in_channels, desc_channels):
super(EmbeddingModule, self).__init__()
self.pool = nn.AdaptiveAvgPool2d((1, 1))
self.fc = nn.Linear(in_channels, desc_channels)
def forward(self, x):
x = self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ActiveVisionLab/LaLaLoc | EmbeddingModule | false | 16,872 | [
"MIT"
] | 5 | 21a0da94fbe7ef6cce3d34c6a5f47cc09d072f45 | https://github.com/ActiveVisionLab/LaLaLoc/tree/21a0da94fbe7ef6cce3d34c6a5f47cc09d072f45 |
DiceLoss | import torch
import torch.nn as nn
def flatten_channels(inputs, targets, channel_dim):
"""
Helper function to flatten inputs and targets for each channel
E.g., (1, 3, 10, 256, 256) --> (3, 655360)
Parameters
----------
inputs: torch.Tensor
U-net output
targets: torch.Tensor
... | 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... | AbigailMcGovern/iterseg | DiceLoss | false | 16,873 | [
"BSD-3-Clause"
] | 4 | d23af04c52c8d1711a474a58060abea664a82637 | https://github.com/AbigailMcGovern/iterseg/tree/d23af04c52c8d1711a474a58060abea664a82637 |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64,
fc2_units=64):
"""Initialize parameters and build model.
Params
======
state_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | AlexS28/SABER | QNetwork | false | 16,874 | [
"BSD-3-Clause"
] | 4 | 91f74319a41f473b8e8f9eff6b7d9b604b94c7da | https://github.com/AlexS28/SABER/tree/91f74319a41f473b8e8f9eff6b7d9b604b94c7da |
Capsule_conv | import torch
import torch.nn as nn
def Squash(x):
l2norm = x.norm(dim=-1, keepdim=True)
unit_v = x / l2norm
squashed_v = l2norm.pow(2) / (1 + l2norm.pow(2))
x = unit_v * squashed_v
return x
class Capsule_conv(nn.Module):
def __init__(self, in_channels, out_channels, cap_dim):
super(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | AahanSingh/Capsule-Networks | Capsule_conv | false | 16,875 | [
"MIT"
] | 5 | 798014b6ff5fe27abdc64d3af364fb7681f292fc | https://github.com/AahanSingh/Capsule-Networks/tree/798014b6ff5fe27abdc64d3af364fb7681f292fc |
DuelingMLP | import torch
import torch.nn as nn
import torch.nn.functional as F
class DuelingMLP(nn.Module):
def __init__(self, state_size, num_actions):
super().__init__()
self.linear = nn.Linear(state_size, 256)
self.value_head = nn.Linear(256, 1)
self.advantage_head = nn.Linear(256, num_act... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | AlexHermansson/hindsight-experience-replay | DuelingMLP | false | 16,876 | [
"MIT"
] | 5 | 65468d523bb803123d7aab9bb83abc7a3d5db3c8 | https://github.com/AlexHermansson/hindsight-experience-replay/tree/65468d523bb803123d7aab9bb83abc7a3d5db3c8 |
NMFNet | import torch
import torch.nn as nn
from numpy.random import uniform
from numpy.linalg import pinv
class NMFNet(nn.Module):
"""NMF implemented as a neural network"""
def __init__(self, X_height, k):
"""Params
X_height: TODO INSERT DESC HERE
k: TODO INSERT DESC HERE
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Aaron09/torchfactor | NMFNet | false | 16,877 | [
"MIT"
] | 5 | 66782a183c583e3056e2c40d8d95568f4abb9537 | https://github.com/Aaron09/torchfactor/tree/66782a183c583e3056e2c40d8d95568f4abb9537 |
PolicyNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class PolicyNet(nn.Module):
def __init__(self):
super(PolicyNet, self).__init__()
self.fc1 = nn.Linear(4, 24)
self.fc2 = nn.Linear(24, 36)
self.fc3 = nn.Linear(36, 1)
def forward(self, x):
x = F.relu(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
assert_... | Alfo5123/ConcreteDropout | PolicyNet | false | 16,878 | [
"MIT"
] | 7 | c442871553e20a2de078c0fbac7fa52302d50abf | https://github.com/Alfo5123/ConcreteDropout/tree/c442871553e20a2de078c0fbac7fa52302d50abf |
Conv2dSame | import torch
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import torch.nn.functional as F
from typing import Optional
from typing import Tuple
import torch.nn.parallel
import torch.optim
def _calc_same_pad(input_: 'int', kernel: 'int', stride: 'int', dilation: 'int'
):
"""c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.utils.data.distributed
from torch import nn... | Adlik/zen_nas | Conv2dSame | false | 16,879 | [
"Apache-2.0"
] | 7 | d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 | https://github.com/Adlik/zen_nas/tree/d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 |
TokenEmbedding | import torch
import torch.nn as nn
class TokenEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model,
kernel_size=3, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AdamLohSg/GTA | TokenEmbedding | false | 16,882 | [
"Apache-2.0"
] | 8 | bf6a745a6e28e365466e76360a15ca10ce61e009 | https://github.com/AdamLohSg/GTA/tree/bf6a745a6e28e365466e76360a15ca10ce61e009 |
FactorizedReduce | import torch
import torch.nn as nn
import torch.utils
class FactorizedReduce(nn.Module):
def __init__(self, C_in, C_out, affine=True):
super(FactorizedReduce, self).__init__()
assert C_out % 2 == 0
self.relu = nn.ReLU(inplace=False)
self.conv_1 = nn.Conv3d(C_in, C_out // 2, 1, str... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Alison-brie/AutoReg | FactorizedReduce | false | 16,883 | [
"MIT"
] | 10 | a23d45a6f7c6e47f61430e1565dda316452a4418 | https://github.com/Alison-brie/AutoReg/tree/a23d45a6f7c6e47f61430e1565dda316452a4418 |
TransitionUp | import torch
import torch.nn as nn
def center_crop(layer, max_height, max_width):
_, _, h, w = layer.size()
xy1 = (w - max_width) // 2
xy2 = (h - max_height) // 2
return layer[:, :, xy2:xy2 + max_height, xy1:xy1 + max_width]
class TransitionUp(nn.Module):
def __init__(self, in_channels, out_cha... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Alfo5123/ConcreteDropout | TransitionUp | false | 16,885 | [
"MIT"
] | 7 | c442871553e20a2de078c0fbac7fa52302d50abf | https://github.com/Alfo5123/ConcreteDropout/tree/c442871553e20a2de078c0fbac7fa52302d50abf |
PositionwiseFeedForward | import torch
import torch.nn as nn
class PositionwiseFeedForward(nn.Module):
"""Implements FFN equation."""
def __init__(self, d_model, d_ff, dropout=0.1):
super(PositionwiseFeedForward, self).__init__()
self.w_1 = nn.Linear(d_model, d_ff)
self.w_2 = nn.Linear(d_ff, d_model)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Aminah92/saint | PositionwiseFeedForward | false | 16,886 | [
"MIT"
] | 7 | e18f5d5d093dce458c7d427eed4a375021c05bb9 | https://github.com/Aminah92/saint/tree/e18f5d5d093dce458c7d427eed4a375021c05bb9 |
FF | import torch
from torch import nn
class FF(nn.Module):
"""
Feed-forward in a transformer layer.
"""
def __init__(self, input_size, hidden_size):
super().__init__()
self.lin_1 = nn.Linear(input_size, hidden_size)
self.lin_2 = nn.Linear(hidden_size, input_size)
self.relu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Altair-inc/behaviour-seq-transformer | FF | false | 16,887 | [
"MIT"
] | 10 | 74185eb5588b1e57a936de9901313dddcc10acf4 | https://github.com/Altair-inc/behaviour-seq-transformer/tree/74185eb5588b1e57a936de9901313dddcc10acf4 |
AdaptiveAvgPool | import torch
import uuid
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import torch.nn.parallel
import torch.optim
def _get_right_parentheses_index_(struct_str):
"""get the position of the first right parenthese in string"""
left_paren_count = 0
for index, single_char in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import uuid
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import torch.nn.parallel
import torch.optim
ass... | Adlik/zen_nas | AdaptiveAvgPool | false | 16,888 | [
"Apache-2.0"
] | 7 | d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 | https://github.com/Adlik/zen_nas/tree/d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 |
Mish | import torch
import torch.nn as nn
import torch.nn.functional as F
class Mish(nn.Module):
@staticmethod
def forward(x):
return x * F.softplus(x).tanh()
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | Aditya239233/MDP | Mish | false | 16,889 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""Construct a layernorm module (See citation for details)."""
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(torch.zeros(fe... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Aminah92/saint | LayerNorm | false | 16,890 | [
"MIT"
] | 7 | e18f5d5d093dce458c7d427eed4a375021c05bb9 | https://github.com/Aminah92/saint/tree/e18f5d5d093dce458c7d427eed4a375021c05bb9 |
GCN | import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import torch.nn.parallel
import torch.optim
from math import *
class GraphConvolution(nn.Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
from torch import... | Alvin-Zeng/GCM | GCN | false | 16,891 | [
"BSD-3-Clause"
] | 6 | 521de2a290ace289cdc5935195d0284f717504c3 | https://github.com/Alvin-Zeng/GCM/tree/521de2a290ace289cdc5935195d0284f717504c3 |
TemporalEmbedding | import math
import torch
import torch.nn as nn
class FixedEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(FixedEmbedding, self).__init__()
w = torch.zeros(c_in, d_model).float()
w.require_grad = False
position = torch.arange(0, c_in).float().unsqueeze(1)
div... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | AdamLohSg/GTA | TemporalEmbedding | false | 16,892 | [
"Apache-2.0"
] | 8 | bf6a745a6e28e365466e76360a15ca10ce61e009 | https://github.com/AdamLohSg/GTA/tree/bf6a745a6e28e365466e76360a15ca10ce61e009 |
Hardswish | import torch
import torch.nn as nn
import torch.nn.functional as F
class Hardswish(nn.Module):
@staticmethod
def forward(x):
return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Aditya239233/MDP | Hardswish | false | 16,893 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
MDN | from torch.nn import Module
import torch
from torch.nn.modules import Module
from torch.nn.modules import Linear
class MDN(Module):
def __init__(self, input_size, num_mixtures):
super(MDN, self).__init__()
self.input_size = input_size
self.num_mixtures = num_mixtures
self.paramete... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AnesBenmerzoug/Handwriting-Model | MDN | false | 16,894 | [
"MIT"
] | 7 | 925a8d43174cccd58e01d41fdc513343df09d000 | https://github.com/AnesBenmerzoug/Handwriting-Model/tree/925a8d43174cccd58e01d41fdc513343df09d000 |
MetaAconC | import torch
import torch.nn as nn
class MetaAconC(nn.Module):
""" ACON activation (activate or not).
MetaAconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is generated by a small network
according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>.
"... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Aditya239233/MDP | MetaAconC | false | 16,895 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
Classify | import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Classify(nn.Module):
def __init__(self, c1, c2, k=1, s=1, p=None, g=1):
super().__init__()
self.aap = nn.AdaptiveAvgPool2d(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Aditya239233/MDP | Classify | false | 16,896 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
FirstKernelTensorTrain | import torch
from torch import nn
import torch.nn.functional as F
class FirstKernelTensorTrain(nn.Module):
def __init__(self, m, r_j):
super(FirstKernelTensorTrain, self).__init__()
self.fc1 = nn.Linear(m, r_j, bias=False)
self.m = m
self.r_j = r_j
def forward(self, tensor):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | AndresOtero/TensorDecompositionMachineLearning | FirstKernelTensorTrain | false | 16,897 | [
"MIT"
] | 3 | 455f16b405ec9d031999b0ebf9c5a68d3c20b233 | https://github.com/AndresOtero/TensorDecompositionMachineLearning/tree/455f16b405ec9d031999b0ebf9c5a68d3c20b233 |
TemporalBlock | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
class TemporalBlock(nn.Module):
def __init__(self, n_inputs, n_outputs, kernel_size=3, stride=1,
dilation=1, padding=1, dropout=0.2):
super(TemporalBlock, self).__init__()
self.conv1 = weight_norm(nn.Conv1d(n_inputs... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | AdamLohSg/GTA | TemporalBlock | false | 16,898 | [
"Apache-2.0"
] | 8 | bf6a745a6e28e365466e76360a15ca10ce61e009 | https://github.com/AdamLohSg/GTA/tree/bf6a745a6e28e365466e76360a15ca10ce61e009 |
AdaptiveAvgMaxPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch._utils
import torch.optim
def adaptive_avgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_max_pool2d(x, output_size)
return 0.5 * (x_avg + x_max)
class ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import tor... | Alicegaz/torchok | AdaptiveAvgMaxPool2d | false | 16,899 | [
"Apache-2.0"
] | 8 | 7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 | https://github.com/Alicegaz/torchok/tree/7b8f95df466a25b1ad8ee93bed1a3c7516440cf4 |
AconC | import torch
import torch.nn as nn
class AconC(nn.Module):
""" ACON activation (activate or not).
AconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is a learnable parameter
according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>.
"""
def __i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Aditya239233/MDP | AconC | false | 16,900 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
Conv2dSameExport | import torch
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
def _calc_same_pad(input_: 'int', kernel: 'int', stride: 'int', dilation: 'int'
):
"""calculate same padding"""
return max((-(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
import torch.utils.data
import torch.utils.data.distributed
from torch import nn... | Adlik/zen_nas | Conv2dSameExport | false | 16,901 | [
"Apache-2.0"
] | 7 | d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 | https://github.com/Adlik/zen_nas/tree/d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57 |
BCEBlurWithLogitsLoss | import torch
import torch.nn as nn
class BCEBlurWithLogitsLoss(nn.Module):
def __init__(self, alpha=0.05):
super(BCEBlurWithLogitsLoss, self).__init__()
self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none')
self.alpha = alpha
def forward(self, pred, true):
loss = self.loss_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, math as tl_math
import torc... | Aditya239233/MDP | BCEBlurWithLogitsLoss | false | 16,902 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
Lookahead | import torch
import torch.nn as nn
import torch.nn.functional as F
class Lookahead(nn.Module):
def __init__(self, n_features, context):
super(Lookahead, self).__init__()
assert context > 0
self.context = context
self.n_features = n_features
self.pad = 0, self.context - 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Anwarvic/RasaChatbot-with-ASR-and-TTS | Lookahead | false | 16,903 | [
"MIT"
] | 7 | 57009f55d1ac8e4b347e81d9b8e33a08b4fd5618 | https://github.com/Anwarvic/RasaChatbot-with-ASR-and-TTS/tree/57009f55d1ac8e4b347e81d9b8e33a08b4fd5618 |
Sum | import torch
import torch.nn as nn
class Sum(nn.Module):
def __init__(self, n, weight=False):
super().__init__()
self.weight = weight
self.iter = range(n - 1)
if weight:
self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=True
)
def forw... | 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... | Aditya239233/MDP | Sum | false | 16,904 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
TTKernel | import torch
from torch import nn
import torch.nn.functional as F
class TTKernel(nn.Module):
def __init__(self, r_i, m, r_j):
super(TTKernel, self).__init__()
self.fc1 = nn.Bilinear(r_i, m, r_j, bias=False)
def forward(self, input_tensor_1, input_tensor_2):
tensor_transformed = self.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | AndresOtero/TensorDecompositionMachineLearning | TTKernel | false | 16,905 | [
"MIT"
] | 3 | 455f16b405ec9d031999b0ebf9c5a68d3c20b233 | https://github.com/AndresOtero/TensorDecompositionMachineLearning/tree/455f16b405ec9d031999b0ebf9c5a68d3c20b233 |
Expand | import torch
import torch.nn as nn
class Expand(nn.Module):
def __init__(self, gain=2):
super().__init__()
self.gain = gain
def forward(self, x):
b, c, h, w = x.size()
s = self.gain
x = x.view(b, s, s, c // s ** 2, h, w)
x = x.permute(0, 3, 4, 1, 5, 2).contigu... | 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... | Aditya239233/MDP | Expand | false | 16,906 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
Contract | import torch
import torch.nn as nn
class Contract(nn.Module):
def __init__(self, gain=2):
super().__init__()
self.gain = gain
def forward(self, x):
b, c, h, w = x.size()
s = self.gain
x = x.view(b, c, h // s, s, w // s, s)
x = x.permute(0, 3, 5, 1, 2, 4).conti... | 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... | Aditya239233/MDP | Contract | false | 16,907 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
GlobalAvgPool2d | import torch
import torch.nn as nn
class GlobalAvgPool2d(nn.Module):
def __init__(self):
"""Global average pooling over the input's spatial dimensions"""
super(GlobalAvgPool2d, self).__init__()
def forward(self, inputs):
in_size = inputs.size()
return inputs.view((in_size[0],... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Anikily/CDinkNet | GlobalAvgPool2d | false | 16,908 | [
"MIT"
] | 4 | 490736855475a51bb2984412e88ac7d50d817a3c | https://github.com/Anikily/CDinkNet/tree/490736855475a51bb2984412e88ac7d50d817a3c |
SiLU | import torch
import torch.nn as nn
class SiLU(nn.Module):
@staticmethod
def forward(x):
return x * torch.sigmoid(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Aditya239233/MDP | SiLU | false | 16,909 | [
"MIT"
] | 4 | 87491e1d67e547c11f4bdd5d784d120473429eae | https://github.com/Aditya239233/MDP/tree/87491e1d67e547c11f4bdd5d784d120473429eae |
QAConvSDSLayer | import torch
import torch.nn as nn
class QAConvSDSLayer(nn.Module):
"""Conv SDS layer for qa output"""
def __init__(self, input_size: 'int', hidden_dim: 'int'):
"""
Args:
input_size (int): max sequence lengths
hidden_dim (int): backbones's hidden dimension
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Amber-Chaeeunk/Open-Domain-Question-Answering | QAConvSDSLayer | false | 16,910 | [
"MIT"
] | 5 | 725e369a4409c54bf11bcfb9db53865d8fc1f935 | https://github.com/Amber-Chaeeunk/Open-Domain-Question-Answering/tree/725e369a4409c54bf11bcfb9db53865d8fc1f935 |
FeatureMap | import torch
from torch import nn
import torch.nn.functional as F
class FeatureMap(nn.Module):
def __init__(self, n, m, amount_of_division, batch_size):
super(FeatureMap, self).__init__()
self.m = m
self.n = n
self.amount_of_division = amount_of_division
self.batch_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 import nn
assert_s... | AndresOtero/TensorDecompositionMachineLearning | FeatureMap | false | 16,911 | [
"MIT"
] | 3 | 455f16b405ec9d031999b0ebf9c5a68d3c20b233 | https://github.com/AndresOtero/TensorDecompositionMachineLearning/tree/455f16b405ec9d031999b0ebf9c5a68d3c20b233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.