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 |
|---|---|---|---|---|---|---|---|---|---|---|
My_loss | import torch
import torch.nn as nn
class My_loss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, y, batch_size):
return torch.sum(torch.pow(x - y, 2)) / batch_size / 2
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand(
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | H-Liu1997/Pytorch_Pose_Estimation_Framework | My_loss | false | 5,250 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
conv | import torch
import torch.nn as nn
from torch.nn import init
class conv(nn.Module):
"""
n*n conv with relu
"""
def __init__(self, in_dim, out_dim, kernal_size, stride, padding):
super(conv, self).__init__()
self.con_layer = nn.Conv2d(in_dim, out_dim, kernal_size, stride,
p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | H-Liu1997/Pytorch_Pose_Estimation_Framework | conv | false | 5,251 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
My_loss_focus2 | import torch
import torch.nn as nn
class My_loss_focus2(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, y, batch_size):
return torch.sum(torch.log1p(torch.abs(x - y))) / batch_size / 4
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]),... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | H-Liu1997/Pytorch_Pose_Estimation_Framework | My_loss_focus2 | false | 5,252 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
MiniBatchStddevLayer | import torch
import torch.nn as nn
import torch.distributed as dist
import torch.autograd as autograd
class AllGatherLayer(autograd.Function):
"""All gather layer with backward propagation path.
Indeed, this module is to make ``dist.all_gather()`` in the backward graph.
Such kind of operation has been wi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.distributed as dist
import torch.autograd as... | HXWAndCL/mmgeneration | MiniBatchStddevLayer | false | 5,253 | [
"Apache-2.0"
] | 1 | 9afb1d740bf56a4ecde5064d5bb2a4e2d777638b | https://github.com/HXWAndCL/mmgeneration/tree/9afb1d740bf56a4ecde5064d5bb2a4e2d777638b |
ConvBlock | import torch
class ResBlock(torch.nn.Module):
def __init__(self, num_channel):
super(ResBlock, self).__init__()
self.conv1 = torch.nn.Conv2d(num_channel, num_channel, kernel_size=
3, stride=1, padding=1)
self.conv2 = torch.nn.Conv2d(num_channel, num_channel, kernel_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
assert_size_stride = torch._C... | Gregory-Eales/mban | ConvBlock | false | 5,254 | [
"Apache-2.0"
] | 1 | d8b35db51c7e601b1db777d9a80343600374250b | https://github.com/Gregory-Eales/mban/tree/d8b35db51c7e601b1db777d9a80343600374250b |
DenseSAGEConv | import math
import torch
import torch.nn.functional as F
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
class DenseSAGEConv(torch.nn.Module):
"""See :class:`torch_geometric... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | GrumpyZhou/pytorch_geometric | DenseSAGEConv | false | 5,255 | [
"MIT"
] | 1 | 88c54e72d3e26ad48e9ccd99e5696c7f19269d94 | https://github.com/GrumpyZhou/pytorch_geometric/tree/88c54e72d3e26ad48e9ccd99e5696c7f19269d94 |
ModMBStddevLayer | import torch
import torch.nn as nn
import torch.distributed as dist
import torch.autograd as autograd
class AllGatherLayer(autograd.Function):
"""All gather layer with backward propagation path.
Indeed, this module is to make ``dist.all_gather()`` in the backward graph.
Such kind of operation has been wi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.distributed as dist
import torch.autograd as... | HXWAndCL/mmgeneration | ModMBStddevLayer | false | 5,256 | [
"Apache-2.0"
] | 1 | 9afb1d740bf56a4ecde5064d5bb2a4e2d777638b | https://github.com/HXWAndCL/mmgeneration/tree/9afb1d740bf56a4ecde5064d5bb2a4e2d777638b |
Upsampler | import math
import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_si... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch.... | Haabibi/RBPN-PyTorch | Upsampler | false | 5,257 | [
"MIT"
] | 1 | 0b04420b384fcc8f78a7b9afeca179fa6c0332c2 | https://github.com/Haabibi/RBPN-PyTorch/tree/0b04420b384fcc8f78a7b9afeca179fa6c0332c2 |
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 ... | Flsahkong/Domain-Adaptive-Faster-RCNN-PyTorch | DAInsHead | false | 5,258 | [
"MIT"
] | 1 | 2d3ed73714ea5d5ff52d0b2ea51396a498ae6abe | https://github.com/Flsahkong/Domain-Adaptive-Faster-RCNN-PyTorch/tree/2d3ed73714ea5d5ff52d0b2ea51396a498ae6abe |
L2 | import torch
import torch.nn as nn
from torchvision.transforms import *
class L2(nn.Module):
def __init__(self):
super(L2, self).__init__()
def forward(self, output, target):
lossvalue = torch.norm(output - target, p=2, dim=1).mean()
return lossvalue
def get_inputs():
return [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.triton_helpers import libdevice
import torch.nn as nn
from torchvision.transforms import *
assert_size_stride =... | Haabibi/RBPN-PyTorch | L2 | false | 5,259 | [
"MIT"
] | 1 | 0b04420b384fcc8f78a7b9afeca179fa6c0332c2 | https://github.com/Haabibi/RBPN-PyTorch/tree/0b04420b384fcc8f78a7b9afeca179fa6c0332c2 |
EqualLinearActModule | import torch
import torch.nn as nn
from copy import deepcopy
from functools import partial
from torch.nn.init import _calculate_correct_fan
def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in',
lr_mul=1.0):
"""Equalized Learning Rate.
This trick is proposed in:
Progressive Growing of ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from copy import deepcopy
from functools import partial
fr... | HXWAndCL/mmgeneration | EqualLinearActModule | false | 5,260 | [
"Apache-2.0"
] | 1 | 9afb1d740bf56a4ecde5064d5bb2a4e2d777638b | https://github.com/HXWAndCL/mmgeneration/tree/9afb1d740bf56a4ecde5064d5bb2a4e2d777638b |
HuberLoss | import torch
from torch import nn as nn
import torch.utils.data
class HuberLoss(nn.Module):
def __init__(self, delta=1):
super().__init__()
self.huber_loss_delta1 = nn.SmoothL1Loss()
self.delta = delta
def forward(self, x, x_hat):
loss = self.huber_loss_delta1(x / self.delta,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn a... | HamzaHz2/rlkit | HuberLoss | false | 5,261 | [
"MIT"
] | 1 | 55f30c2f1830693624bc5d4085ab9a1ac80b30c4 | https://github.com/HamzaHz2/rlkit/tree/55f30c2f1830693624bc5d4085ab9a1ac80b30c4 |
LayerNorm | import torch
from torch import nn as nn
import torch.utils.data
class LayerNorm(nn.Module):
"""
Simple 1D LayerNorm.
"""
def __init__(self, features, center=True, scale=False, eps=1e-06):
super().__init__()
self.center = center
self.scale = scale
self.eps = eps
... | 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 as nn
import torch.utils.data
assert_size_stride = torch._... | HamzaHz2/rlkit | LayerNorm | false | 5,262 | [
"MIT"
] | 1 | 55f30c2f1830693624bc5d4085ab9a1ac80b30c4 | https://github.com/HamzaHz2/rlkit/tree/55f30c2f1830693624bc5d4085ab9a1ac80b30c4 |
MultiHead | import math
import torch
from torch import Tensor
from torch.nn import Linear
import torch.nn.functional as F
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
def kaiming_uniform... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | GrumpyZhou/pytorch_geometric | MultiHead | false | 5,263 | [
"MIT"
] | 1 | 88c54e72d3e26ad48e9ccd99e5696c7f19269d94 | https://github.com/GrumpyZhou/pytorch_geometric/tree/88c54e72d3e26ad48e9ccd99e5696c7f19269d94 |
InteractiveKLLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
class InteractiveKLLoss(nn.Module):
def __init__(self, temperature):
super().__init__()
self.temperature = temperature
self.kl_loss = nn.KLDivLoss()
... | 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... | HarshCasper/nni | InteractiveKLLoss | false | 5,264 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
UpBlock | import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_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 torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guard... | Haabibi/RBPN-PyTorch | UpBlock | false | 5,265 | [
"MIT"
] | 1 | 0b04420b384fcc8f78a7b9afeca179fa6c0332c2 | https://github.com/Haabibi/RBPN-PyTorch/tree/0b04420b384fcc8f78a7b9afeca179fa6c0332c2 |
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... | HarryPham0123/FPT_data_centric_competition | AconC | false | 5,266 | [
"Apache-2.0"
] | 1 | 3fa1e0ac48fdae2649b639229d9a74f75e461878 | https://github.com/HarryPham0123/FPT_data_centric_competition/tree/3fa1e0ac48fdae2649b639229d9a74f75e461878 |
D_UpBlock | import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_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 torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guard... | Haabibi/RBPN-PyTorch | D_UpBlock | false | 5,267 | [
"MIT"
] | 1 | 0b04420b384fcc8f78a7b9afeca179fa6c0332c2 | https://github.com/Haabibi/RBPN-PyTorch/tree/0b04420b384fcc8f78a7b9afeca179fa6c0332c2 |
D_DownBlock | import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_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 torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guard... | Haabibi/RBPN-PyTorch | D_DownBlock | false | 5,268 | [
"MIT"
] | 1 | 0b04420b384fcc8f78a7b9afeca179fa6c0332c2 | https://github.com/Haabibi/RBPN-PyTorch/tree/0b04420b384fcc8f78a7b9afeca179fa6c0332c2 |
GlobalAvgPool1d | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from abc import abstractmethod
from torch.nn import functional
class AvgPool(nn.Module):
"""
AvgPool Module.
"""
def __init__(self):
super().__init__()
@abstractmethod
def forward(s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from abc import abstractmethod
assert_size_stride ... | HarshCasper/nni | GlobalAvgPool1d | false | 5,269 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
SpatialAttentionGate | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
class SpatialAttentionGate(nn.Module):
def __init__(self, channel, reduction=16):
super(SpatialAttentionGate, self).__init__()
self.fc1 = nn.Conv2d(channel, reduc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | HarshCasper/nni | SpatialAttentionGate | false | 5,270 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
stage_n_block | import torch
import torch.nn as nn
from torch.nn import init
class conv(nn.Module):
"""
n*n conv with relu
"""
def __init__(self, in_dim, out_dim, kernal_size, stride, padding):
super(conv, self).__init__()
self.con_layer = nn.Conv2d(in_dim, out_dim, kernal_size, stride,
p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | H-Liu1997/Pytorch_Pose_Estimation_Framework | stage_n_block | false | 5,271 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
stage_1_block | import torch
import torch.nn as nn
from torch.nn import init
class conv(nn.Module):
"""
n*n conv with relu
"""
def __init__(self, in_dim, out_dim, kernal_size, stride, padding):
super(conv, self).__init__()
self.con_layer = nn.Conv2d(in_dim, out_dim, kernal_size, stride,
p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | H-Liu1997/Pytorch_Pose_Estimation_Framework | stage_1_block | false | 5,272 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
Mask | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class Mask(nn.Module):
def forward(self, seq, mask):
seq_mask = torch.unsqueeze(mask, 2)
seq_mask = torch.transpose(seq_mask.repeat(1, 1, seq.size()[1]), 1, 2)
return seq.where(torch.eq(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | HarshCasper/nni | Mask | false | 5,273 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
Pooling | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class ReLUConvBN(nn.Module):
"""
Parameters
---
C_in: int
the number of input channels
C_out: int
the number of output channels
stride: int
stride of the convolution
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | HarshCasper/nni | Pooling | false | 5,274 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
BackboneModel1 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class BackboneModel1(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 1, 1, 1)
def forward(self, x):
return self.conv1(x)
def get_inputs():
return ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | HarshCasper/nni | BackboneModel1 | false | 5,275 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
DownBlock | import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_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 torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guard... | Haabibi/RBPN-PyTorch | DownBlock | false | 5,276 | [
"MIT"
] | 1 | 0b04420b384fcc8f78a7b9afeca179fa6c0332c2 | https://github.com/Haabibi/RBPN-PyTorch/tree/0b04420b384fcc8f78a7b9afeca179fa6c0332c2 |
TorchAdd | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class TorchAdd(nn.Module):
"""
TorchAdd Module.
"""
def forward(self, input_list):
return input_list[0] + input_list[1]
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | HarshCasper/nni | TorchAdd | false | 5,277 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
TransformerLayer | import torch
import torch.nn as nn
class TransformerLayer(nn.Module):
def __init__(self, c, num_heads):
super().__init__()
self.q = nn.Linear(c, c, bias=False)
self.k = nn.Linear(c, c, bias=False)
self.v = nn.Linear(c, c, bias=False)
self.ma = nn.MultiheadAttention(embed_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.... | HarryPham0123/FPT_data_centric_competition | TransformerLayer | false | 5,278 | [
"Apache-2.0"
] | 1 | 3fa1e0ac48fdae2649b639229d9a74f75e461878 | https://github.com/HarryPham0123/FPT_data_centric_competition/tree/3fa1e0ac48fdae2649b639229d9a74f75e461878 |
ZeroLayer | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class ZeroLayer(nn.Module):
def __init__(self, stride):
super(ZeroLayer, self).__init__()
self.stride = stride
def forward(self, x):
"""n, c, h, w = x.size()
h //= self.stri... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | HarshCasper/nni | ZeroLayer | false | 5,279 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
VAE | import torch
import torch.nn as nn
import torch.nn.functional as F
class VAE(nn.Module):
def __init__(self, encode_dims, decode_dims, dropout=0.0):
super(VAE, self).__init__()
self.encoder = nn.ModuleDict({f'enc_{i}': nn.Linear(encode_dims[i],
encode_dims[i + 1]) for i in range(len(en... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math... | Hassan-Lee/FusionModelingOfUser-GeneratedReviewDataOfComplexHeterogeneousTypes | VAE | false | 5,280 | [
"MIT"
] | 1 | b863e3fbf8058ecb06246a843e3fd2568bbbf260 | https://github.com/Hassan-Lee/FusionModelingOfUser-GeneratedReviewDataOfComplexHeterogeneousTypes/tree/b863e3fbf8058ecb06246a843e3fd2568bbbf260 |
ActorCritic | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
class ActorCritic(nn.Module):
def __init__(self, num_states, num_actions, hidden_size):
super(ActorCritic, self).__init__()
self.num_actions = num_actions
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HarshCasper/nni | ActorCritic | false | 5,281 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
DuelingQNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class DuelingQNetwork(nn.Module):
"""Dueling Q-network (https://arxiv.org/abs/1511.06581)"""
def __init__(self, state_size, action_size, hidsize1=128, hidsize2=128,
seed=None):
super(DuelingQNetwork, self).__init__()
i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | HarryTanNguyen/flatland-railway-enviroment | DuelingQNetwork | false | 5,282 | [
"MIT"
] | 1 | 5306871a6dbedd8d2745be4ff0caf0515e4d88ac | https://github.com/HarryTanNguyen/flatland-railway-enviroment/tree/5306871a6dbedd8d2745be4ff0caf0515e4d88ac |
WeightedBCELoss | import torch
import torch.nn.functional
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class WeightedBCELoss(nn.Module):
def _... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn.functi... | HelenGuohx/cv-ferattn-code | WeightedBCELoss | false | 5,283 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
LinearCombine | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
class LinearCombine(nn.Module):
def __init__(self, layers_num, trainable=True, input_aware=False,
word_level=False):
super(LinearCombine, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import ... | HarshCasper/nni | LinearCombine | false | 5,284 | [
"MIT"
] | 1 | 291bbbba9f296382015a77b2c88eb5db5b44bf94 | https://github.com/HarshCasper/nni/tree/291bbbba9f296382015a77b2c88eb5db5b44bf94 |
BLogDiceLoss | import torch
import torch.nn.functional
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class BLogDiceLoss(nn.Module):
def __in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn.functional
import torch.nn as nn
assert_size_stride = tor... | HelenGuohx/cv-ferattn-code | BLogDiceLoss | false | 5,285 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
MCEDiceLoss | import torch
import torch.nn.functional
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class BCELoss(nn.Module):
def __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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | HelenGuohx/cv-ferattn-code | MCEDiceLoss | false | 5,286 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
_ChannelAttentionModule | import torch
import torch.nn as nn
class _ChannelAttentionModule(nn.Module):
"""Channel attention module"""
def __init__(self, **kwargs):
super(_ChannelAttentionModule, self).__init__()
self.beta = nn.Parameter(torch.zeros(1))
self.softmax = nn.Softmax(dim=-1)
def forward(self, x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HaoweiGis/EarthLearning | _ChannelAttentionModule | false | 5,287 | [
"MIT"
] | 1 | f2fa9c07f8af2512c4091a7901e781cc3dde99cf | https://github.com/HaoweiGis/EarthLearning/tree/f2fa9c07f8af2512c4091a7901e781cc3dde99cf |
AttMSEloss | import torch
import torch.nn.functional
import torch.nn as nn
class AttMSEloss(nn.Module):
def __init__(self):
super(AttMSEloss, self).__init__()
def forward(self, x_org, y_mask, att):
loss_att = ((x_org * y_mask[:, 1, ...].unsqueeze(dim=1) - att) ** 2
).mean()
loss_att =... | 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.functional
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | HelenGuohx/cv-ferattn-code | AttMSEloss | false | 5,288 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
WeightedBDiceLoss | import torch
import torch.nn.functional
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class WeightedBDiceLoss(nn.Module):
def... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | HelenGuohx/cv-ferattn-code | WeightedBDiceLoss | false | 5,289 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
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... | HarryPham0123/FPT_data_centric_competition | MetaAconC | false | 5,290 | [
"Apache-2.0"
] | 1 | 3fa1e0ac48fdae2649b639229d9a74f75e461878 | https://github.com/HarryPham0123/FPT_data_centric_competition/tree/3fa1e0ac48fdae2649b639229d9a74f75e461878 |
_Residual_Block_SR | import torch
import torch.nn.functional
import torch.nn as nn
class _Residual_Block_SR(nn.Module):
"""
residual block in feature module
"""
def __init__(self, num_ft):
super(_Residual_Block_SR, self).__init__()
self.conv1 = nn.Conv2d(in_channels=num_ft, out_channels=num_ft,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.nn as nn
assert_size_stride = torch._C._... | HelenGuohx/cv-ferattn-code | _Residual_Block_SR | false | 5,291 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
BDiceLoss | import torch
import torch.nn.functional
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
def flatten(x):
x_flat = x.clone()
x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | HelenGuohx/cv-ferattn-code | BDiceLoss | false | 5,292 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
Attloss | import torch
import torch.nn.functional
import torch.nn as nn
class Attloss(nn.Module):
def __init__(self):
super(Attloss, self).__init__()
self.maxvalueloss = 30
def forward(self, x_org, att):
d = torch.exp(6.0 * torch.abs(x_org - att))
loss_att = (d - 1) / (d + 1)
l... | 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.functi... | HelenGuohx/cv-ferattn-code | Attloss | false | 5,293 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
WeightedMCEDiceLoss | import torch
import torch.nn.functional
import torch.nn as nn
import torch.nn.functional as F
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class 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 math as tl_math
import torch.nn.functi... | HelenGuohx/cv-ferattn-code | WeightedMCEDiceLoss | false | 5,294 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
AsymmetricLossMultiLabel | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class AsymmetricLossMultiLabel(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
super(AsymmetricLossMultiLabel, self).__init__()
self.gam... | 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... | Hhhhhhao/pytorch-image-models | AsymmetricLossMultiLabel | false | 5,295 | [
"Apache-2.0"
] | 1 | 9cc7dda6e5fcbbc7ac5ba5d2d44050d2a8e3e38d | https://github.com/Hhhhhhao/pytorch-image-models/tree/9cc7dda6e5fcbbc7ac5ba5d2d44050d2a8e3e38d |
KeypointRCNNPredictor | import torch
import torch.nn as nn
from torch.autograd import *
import torch.utils.data
class KeypointRCNNPredictor(nn.Module):
def __init__(self, in_channels, num_keypoints):
super(KeypointRCNNPredictor, self).__init__()
input_features = in_channels
deconv_kernel = 4
self.kps_sco... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | HeartFu/NeuralBabyTalk | KeypointRCNNPredictor | false | 5,296 | [
"MIT"
] | 1 | acd9f927d3b977c69ff8286bc45f9fb073dd1b6b | https://github.com/HeartFu/NeuralBabyTalk/tree/acd9f927d3b977c69ff8286bc45f9fb073dd1b6b |
StdConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class StdConv2d(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False)
w = (w - m) / torch.sqrt(v + 1e-10)
return F.conv2d(x, w, self.bias, self.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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | HazyResearch/domino | StdConv2d | false | 5,297 | [
"Apache-2.0"
] | 1 | 76ef413a9f9ee4a5d9c3fc044d8a0a0ea0cc4dc2 | https://github.com/HazyResearch/domino/tree/76ef413a9f9ee4a5d9c3fc044d8a0a0ea0cc4dc2 |
WeightedMCEFocalloss | import torch
import torch.nn.functional
import torch.nn as nn
import torch.nn.functional as F
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class 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 math as tl_math
import torch.nn.functi... | HelenGuohx/cv-ferattn-code | WeightedMCEFocalloss | false | 5,298 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
AdaptiveAvgMaxPool2d | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn.functional as F
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... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torchvision... | Hhhhhhao/pytorch-image-models | AdaptiveAvgMaxPool2d | false | 5,299 | [
"Apache-2.0"
] | 1 | 9cc7dda6e5fcbbc7ac5ba5d2d44050d2a8e3e38d | https://github.com/Hhhhhhao/pytorch-image-models/tree/9cc7dda6e5fcbbc7ac5ba5d2d44050d2a8e3e38d |
WeightedMCEloss | import torch
import torch.nn.functional
import torch.nn as nn
import torch.nn.functional as F
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class 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 math as tl_math
import torch.nn.functi... | HelenGuohx/cv-ferattn-code | WeightedMCEloss | false | 5,300 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
Dice | import torch
import torch.nn.functional
import torch.nn as nn
import torch.nn.functional as F
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
def flatten(... | 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.functi... | HelenGuohx/cv-ferattn-code | Dice | false | 5,301 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
AdaptiveCatAvgMaxPool2d | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn.functional as F
def adaptive_catavgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_max_pool2d(x, output_size)
ret... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torchvision... | Hhhhhhao/pytorch-image-models | AdaptiveCatAvgMaxPool2d | false | 5,302 | [
"Apache-2.0"
] | 1 | 9cc7dda6e5fcbbc7ac5ba5d2d44050d2a8e3e38d | https://github.com/Hhhhhhao/pytorch-image-models/tree/9cc7dda6e5fcbbc7ac5ba5d2d44050d2a8e3e38d |
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... | HarryPham0123/FPT_data_centric_competition | Contract | false | 5,303 | [
"Apache-2.0"
] | 1 | 3fa1e0ac48fdae2649b639229d9a74f75e461878 | https://github.com/HarryPham0123/FPT_data_centric_competition/tree/3fa1e0ac48fdae2649b639229d9a74f75e461878 |
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... | HarryPham0123/FPT_data_centric_competition | Expand | false | 5,304 | [
"Apache-2.0"
] | 1 | 3fa1e0ac48fdae2649b639229d9a74f75e461878 | https://github.com/HarryPham0123/FPT_data_centric_competition/tree/3fa1e0ac48fdae2649b639229d9a74f75e461878 |
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... | HarryPham0123/FPT_data_centric_competition | Classify | false | 5,305 | [
"Apache-2.0"
] | 1 | 3fa1e0ac48fdae2649b639229d9a74f75e461878 | https://github.com/HarryPham0123/FPT_data_centric_competition/tree/3fa1e0ac48fdae2649b639229d9a74f75e461878 |
Accuracy | import torch
import torch.nn.functional
import torch.nn as nn
import torch.nn.functional as F
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class Accura... | 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.functi... | HelenGuohx/cv-ferattn-code | Accuracy | false | 5,306 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
DenseSAGEConv | import math
import torch
import torch.nn.functional as F
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
class DenseSAGEConv(torch.nn.Module):
"""See :class:`torch_geometric... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.nn imp... | HenrryBryant/pytorch_geometric | DenseSAGEConv | false | 5,307 | [
"MIT"
] | 1 | 3c4466a3f38a2eba92073c730a09953ab5082c3d | https://github.com/HenrryBryant/pytorch_geometric/tree/3c4466a3f38a2eba92073c730a09953ab5082c3d |
ActorCritic | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def f_hard_swish(x):
return F.relu6(x + 3) / 6 * x
class ActorCritic(nn.Module):
def __init__(self, num_inputs, num_outputs, layer_norm=True):
super(ActorCritic, self).__init__()
mid_dim = 96
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | GuanShiTing/DL_RL_Zoo | ActorCritic | false | 5,308 | [
"Apache-2.0"
] | 1 | 520cd92c1a28f64006d51444a0940cc645b95c6d | https://github.com/GuanShiTing/DL_RL_Zoo/tree/520cd92c1a28f64006d51444a0940cc645b95c6d |
DenseGCNConv | import math
import torch
from torch.nn import Parameter
import torch.utils.data
def glorot(tensor):
if tensor is not None:
stdv = math.sqrt(6.0 / (tensor.size(-2) + tensor.size(-1)))
tensor.data.uniform_(-stdv, stdv)
def zeros(tensor):
if tensor is not None:
tensor.data.fill_(0)
cl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HenrryBryant/pytorch_geometric | DenseGCNConv | false | 5,309 | [
"MIT"
] | 1 | 3c4466a3f38a2eba92073c730a09953ab5082c3d | https://github.com/HenrryBryant/pytorch_geometric/tree/3c4466a3f38a2eba92073c730a09953ab5082c3d |
SpatialGatherModule | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
class SpatialGatherModule(nn.Module):
"""Aggregate the context features according to the initial predicted
probability distribution.
Employ the soft-weighted method to aggregate the context.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HusterRC/mmsegmentation | SpatialGatherModule | false | 5,310 | [
"Apache-2.0"
] | 1 | c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 | https://github.com/HusterRC/mmsegmentation/tree/c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 |
VGG_19 | import torch
import torch.nn as nn
from torch.nn import init
class conv(nn.Module):
"""
n*n conv with relu
"""
def __init__(self, in_dim, out_dim, kernal_size, stride, padding):
super(conv, self).__init__()
self.con_layer = nn.Conv2d(in_dim, out_dim, kernal_size, stride,
p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | H-Liu1997/Pytorch_Pose_Estimation_Framework | VGG_19 | false | 5,311 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
ResBlock | import torch
from torch import nn
import torch.utils.data
import torch.autograd
class ResBlock(nn.Module):
def __init__(self, num_features, use_batch_norm=False):
super(ResBlock, self).__init__()
self.num_features = num_features
self.conv_layer1 = nn.Conv2d(num_features, num_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 import triton_helpers
from torch import nn
import t... | HubBucket-Team/annotated_deep_learning_paper_implementations | ResBlock | false | 5,312 | [
"MIT"
] | 1 | 4a9716b01e336c57739dfdbdd90648276b53c433 | https://github.com/HubBucket-Team/annotated_deep_learning_paper_implementations/tree/4a9716b01e336c57739dfdbdd90648276b53c433 |
_Logit | import torch
class _Logit(torch.nn.Module):
""" Simple logistic regression model.
"""
def __init__(self, din, dout=1):
""" Model parameter constructor.
Args:
din Number of input dimensions
dout Number of output dimensions
"""
super().__init__()
self._din = din
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | IKACE/DifferentialByzantine-1 | _Logit | false | 5,313 | [
"MIT"
] | 1 | 809fd6e070fedeb87a6dbff6f883e93e3c5c8e09 | https://github.com/IKACE/DifferentialByzantine-1/tree/809fd6e070fedeb87a6dbff6f883e93e3c5c8e09 |
PytorchMultiClass | import torch
import torch.nn as nn
import torch.nn.functional as F
class PytorchMultiClass(nn.Module):
def __init__(self, num_features):
super(PytorchMultiClass, self).__init__()
self.layer_1 = nn.Linear(num_features, 80)
self.layer_2 = nn.Linear(80, 100)
self.layer_out = nn.Linea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HninPwint/beer_type_prediction | PytorchMultiClass | false | 5,314 | [
"MIT"
] | 1 | 6845920821bedc059dbe92af5c4a7689cb616023 | https://github.com/HninPwint/beer_type_prediction/tree/6845920821bedc059dbe92af5c4a7689cb616023 |
VGG_block | import torch
import torch.nn as nn
from torch.nn import init
class VGG_block(nn.Module):
""" 1. default have the bias
2. using ReLU and 3 * max pooling
3. 10 layers of VGG original
4. 2 extra layers by CMU
5. default in_dim = 3,out_dim = 128
6. all kernal_size = 3, stride =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | H-Liu1997/Pytorch_Pose_Estimation_Framework | VGG_block | false | 5,315 | [
"MIT"
] | 1 | 06616b3459ff639f8486e6ea4f93922597788b2a | https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a |
SSE | import torch
from torch.nn.modules.loss import _Loss
class SSE(_Loss):
"""
Definition: sum_squared_error = 1/2 * nn.MSELoss(reduction = 'sum')
The backward is defined as: input-target
"""
def __init__(self, under_penalty, over_penalty):
super(SSE, self).__init__(under_penalty, over_penalt... | 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.nn.modules.loss import _Loss
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | IVRL/CCID | SSE | false | 5,316 | [
"MIT"
] | 1 | 0d57c33696da87279d24777a2efd1204f5088bc9 | https://github.com/IVRL/CCID/tree/0d57c33696da87279d24777a2efd1204f5088bc9 |
PixelNorm | import torch
import torch.nn as nn
class PixelNorm(nn.Module):
def __init__(self, epsilon=1e-08):
"""
@notice: avoid in-place ops.
https://discuss.pytorch.org/t/encounter-the-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operatio... | 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_... | Iceland-Leo/StyleGAN2_PyTorch | PixelNorm | false | 5,318 | [
"MIT"
] | 1 | 3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 | https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 |
Net | import math
import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
for m in self.modules():
if isinstance(m, nn.Conv2d):
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(0, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
import torch.nn a... | Groenbech96/Learning-to-See-in-the-Dark | Net | false | 5,319 | [
"MIT"
] | 1 | a068c8642a651e4af195cd71e253694d88dfe3c5 | https://github.com/Groenbech96/Learning-to-See-in-the-Dark/tree/a068c8642a651e4af195cd71e253694d88dfe3c5 |
MultiHeadedAttention | import math
import torch
from typing import Optional
from typing import Tuple
from torch import nn
class MultiHeadedAttention(nn.Module):
"""Multi-Head Attention layer.
Args:
n_head (int): The number of heads.
n_feat (int): The number of features.
dropout_rate (float): Dropout rate.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Honghe/wenet | MultiHeadedAttention | false | 5,320 | [
"Apache-2.0"
] | 1 | 4421790bec3778df591816d69f0449930a9be321 | https://github.com/Honghe/wenet/tree/4421790bec3778df591816d69f0449930a9be321 |
MLPClassifier | import torch
import torch.nn as nn
class MLPClassifier(nn.Module):
def __init__(self, input_dim, target_dim):
super(MLPClassifier, self).__init__()
self.input_dim = input_dim
self.target_dim = target_dim
self.fc1 = nn.Linear(self.input_dim, 128)
self.fc2 = nn.Linear(128, 6... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ITU-AI-ML-in-5G-Challenge/-ITU-ML5G-PS-032-KDDI-naist-lsm | MLPClassifier | false | 5,321 | [
"MIT"
] | 1 | f0c54cfde8fb9a5b78e116de7814a1afbd856799 | https://github.com/ITU-AI-ML-in-5G-Challenge/-ITU-ML5G-PS-032-KDDI-naist-lsm/tree/f0c54cfde8fb9a5b78e116de7814a1afbd856799 |
Minibatch_stddev_layer | import torch
import torch.nn as nn
class Minibatch_stddev_layer(nn.Module):
"""
Minibatch standard deviation layer. (D_stylegan2)
"""
def __init__(self, group_size=4, num_new_features=1):
super().__init__()
self.group_size = group_size
self.num_new_features = num_new_featu... | 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_... | Iceland-Leo/StyleGAN2_PyTorch | Minibatch_stddev_layer | false | 5,322 | [
"MIT"
] | 1 | 3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 | https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 |
ToRGB | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter
This is based on equa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 numpy as np
from torch import nn
import torch.nn.functional a... | HubBucket-Team/annotated_deep_learning_paper_implementations | ToRGB | false | 5,323 | [
"MIT"
] | 1 | 4a9716b01e336c57739dfdbdd90648276b53c433 | https://github.com/HubBucket-Team/annotated_deep_learning_paper_implementations/tree/4a9716b01e336c57739dfdbdd90648276b53c433 |
Head | import torch
import torch.nn as nn
class Conv(nn.Module):
def __init__(self, filters0, filters1, kernel_size, bn, bias=True):
super().__init__()
if bn:
bias = False
self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1,
padding=kernel_size // 2, bias=bias... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Hiroki9759/HandyRL | Head | false | 5,324 | [
"MIT"
] | 1 | 7d4dc869ba2f657d65fc461be4bed2d90dd0343b | https://github.com/Hiroki9759/HandyRL/tree/7d4dc869ba2f657d65fc461be4bed2d90dd0343b |
Encoding | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
class Encoding(nn.Module):
"""Encoding Layer: a learnable residual encoder.
Input is of shape (batch_size, channels, height, width).
Output is of shape (batch_size, num_codes, channels).
Ar... | 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
... | HusterRC/mmsegmentation | Encoding | false | 5,325 | [
"Apache-2.0"
] | 1 | c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 | https://github.com/HusterRC/mmsegmentation/tree/c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 |
ExampleBackbone | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class ExampleBackbone(nn.Module):
def __init__(self):
super(ExampleBackbone, self).__init__()
self.conv = nn.Conv2d(3, 3, 3)
def init_weights(self, pretrained=None):
pass
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch._C
import torch.serialization
assert_size_str... | HusterRC/mmsegmentation | ExampleBackbone | false | 5,326 | [
"Apache-2.0"
] | 1 | c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 | https://github.com/HusterRC/mmsegmentation/tree/c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 |
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 ... | Huzhen757/Conformer | FCUDown | false | 5,327 | [
"Apache-2.0"
] | 1 | 4f7a80cec28b9ced8c0225a85a32997f7cd2b93c | https://github.com/Huzhen757/Conformer/tree/4f7a80cec28b9ced8c0225a85a32997f7cd2b93c |
PPMConcat | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class PPMConcat(nn.ModuleList):
"""Pyramid Pooling Module that only concat the features of each layer.
Args:
pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid
Module.
"""
def __init__(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
import torch.nn as nn
import torch._C
import torch.serialization
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | HusterRC/mmsegmentation | PPMConcat | false | 5,328 | [
"Apache-2.0"
] | 1 | c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 | https://github.com/HusterRC/mmsegmentation/tree/c3e4dbc2e06de3f47f75098f76772b4ee7e91e35 |
BCELoss | import torch
import torch.nn.functional
import torch.nn as nn
def centercrop(image, w, h):
_nt, _ct, ht, wt = image.size()
padw, padh = (wt - w) // 2, (ht - h) // 2
if padw > 0 and padh > 0:
image = image[:, :, padh:-padh, padw:-padw]
return image
class BCELoss(nn.Module):
def __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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | HelenGuohx/cv-ferattn-code | BCELoss | false | 5,329 | [
"MIT"
] | 1 | faa9b7850fe2a0f8c08193bb129b5fec4639d616 | https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616 |
TransformerEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn import Dropout
from torch.nn import LayerNorm
from typing import Optional
import torch.utils.data
from typing import Tuple
class InProjContainer(torch.nn.Module):
def __init__(self, query_proj, key_proj, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Hirni-Meshram3/text | TransformerEncoderLayer | false | 5,330 | [
"BSD-3-Clause"
] | 1 | 84e6c7bd99c7fb3c229ff289aa722149e3136094 | https://github.com/Hirni-Meshram3/text/tree/84e6c7bd99c7fb3c229ff289aa722149e3136094 |
MultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
def scaled_dot_product_attention(q, k, v, mask):
"""
q: query = (..., seq_len_q, depth)
k: key = (..., seq_len_k, depth)
v: value = (..., seq_len_v, depth_v)
mask: float tensor with shape broadcastable to
(..., seq_len_q, s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | IanYHWu/tied-representation-learning | MultiHeadAttention | false | 5,331 | [
"MIT"
] | 1 | bda9814dc40cf552f7bdd2ade78f5e2958a7ea83 | https://github.com/IanYHWu/tied-representation-learning/tree/bda9814dc40cf552f7bdd2ade78f5e2958a7ea83 |
RelPositionMultiHeadedAttention | import math
import torch
from typing import Optional
from typing import Tuple
from torch import nn
class MultiHeadedAttention(nn.Module):
"""Multi-Head Attention layer.
Args:
n_head (int): The number of heads.
n_feat (int): The number of features.
dropout_rate (float): Dropout rate.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Honghe/wenet | RelPositionMultiHeadedAttention | false | 5,332 | [
"Apache-2.0"
] | 1 | 4421790bec3778df591816d69f0449930a9be321 | https://github.com/Honghe/wenet/tree/4421790bec3778df591816d69f0449930a9be321 |
ToLongTensor | import torch
from torch import Tensor
from typing import List
import torch.nn as nn
import torch.utils.data
class ToLongTensor(nn.Module):
"""Convert a list of integers to long tensor
"""
def __init__(self):
super(ToLongTensor, self).__init__()
def forward(self, tokens: 'List[List[int]]') ->... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | Hirni-Meshram3/text | ToLongTensor | false | 5,333 | [
"BSD-3-Clause"
] | 1 | 84e6c7bd99c7fb3c229ff289aa722149e3136094 | https://github.com/Hirni-Meshram3/text/tree/84e6c7bd99c7fb3c229ff289aa722149e3136094 |
MsgNorm | import torch
import torch.nn.functional as F
class MsgNorm(torch.nn.Module):
def __init__(self, learn_msg_scale=False):
super(MsgNorm, self).__init__()
self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]),
requires_grad=learn_msg_scale)
def forward(self, x, msg, p=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
assert_size_stride = torch._... | Hermine2015/deep_gcns_torch | MsgNorm | false | 5,334 | [
"MIT"
] | 1 | 69524a2a5de2ba4c3adb0fea0a090b3e9b4510d4 | https://github.com/Hermine2015/deep_gcns_torch/tree/69524a2a5de2ba4c3adb0fea0a090b3e9b4510d4 |
make_dense | import torch
import torch.nn as nn
import torch.nn.functional as F
class make_dense(nn.Module):
def __init__(self, nChannels, growthRate, kernel_size=3):
super(make_dense, self).__init__()
self.conv = nn.Conv2d(nChannels, growthRate, kernel_size=
kernel_size, padding=kernel_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
import torch.nn as nn
assert_... | HusterRC/FHDR | make_dense | false | 5,335 | [
"BSD-3-Clause"
] | 1 | f61fea7eba3de8430fc2891afdabc77dd8e5f13f | https://github.com/HusterRC/FHDR/tree/f61fea7eba3de8430fc2891afdabc77dd8e5f13f |
_Full | import torch
class _Full(torch.nn.Module):
""" Simple, small fully connected model.
"""
def __init__(self):
""" Model parameter constructor.
"""
super().__init__()
self._f1 = torch.nn.Linear(28 * 28, 100)
self._f2 = torch.nn.Linear(100, 10)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | IKACE/DifferentialByzantine-1 | _Full | false | 5,336 | [
"MIT"
] | 1 | 809fd6e070fedeb87a6dbff6f883e93e3c5c8e09 | https://github.com/IKACE/DifferentialByzantine-1/tree/809fd6e070fedeb87a6dbff6f883e93e3c5c8e09 |
ConvDownsample2d | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def _setup_kernel(k):
k = np.asarray(k, dtype=np.float32)
if k.ndim == 1:
k = np.outer(k, k)
k /= np.sum(k)
assert k.ndim == 2
assert k.shape[0] == k.shape[1]
return k
class ConvDownsample2d(nn.Modu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Iceland-Leo/StyleGAN2_PyTorch | ConvDownsample2d | false | 5,337 | [
"MIT"
] | 1 | 3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 | https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 |
Generator | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Generator(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Generator, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Iamsdt/UdacityDeepLearningNanodegree | Generator | false | 5,338 | [
"Apache-2.0"
] | 1 | 507c2ce620f42e36271549471b819d3d7fceb1b6 | https://github.com/Iamsdt/UdacityDeepLearningNanodegree/tree/507c2ce620f42e36271549471b819d3d7fceb1b6 |
GeneratorBlock | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
from typing import Tuple
from typing import Optional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate E... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | HubBucket-Team/annotated_deep_learning_paper_implementations | GeneratorBlock | false | 5,339 | [
"MIT"
] | 1 | 4a9716b01e336c57739dfdbdd90648276b53c433 | https://github.com/HubBucket-Team/annotated_deep_learning_paper_implementations/tree/4a9716b01e336c57739dfdbdd90648276b53c433 |
RKDAngleLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class RKDAngleLoss(nn.Module):
"""
Module for calculating RKD Angle Loss
"""
def forward(self, teacher, student, normalize=True):
"""
Forward function
:param teacher (torch.FloatTensor): Prediction made by the... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Het-Shah/KD_Lib | RKDAngleLoss | false | 5,340 | [
"MIT"
] | 1 | 5577250cf74e3a529033b244da9b2b9fcf7623a9 | https://github.com/Het-Shah/KD_Lib/tree/5577250cf74e3a529033b244da9b2b9fcf7623a9 |
WingLoss | import math
import torch
def identity(x):
return x
class WingLoss(torch.nn.Module):
def __init__(self, w: 'float'=10, eps: 'float'=2, reduction: 'str'='mean'
) ->None:
assert reduction is None or reduction in ('mean', 'sum')
super().__init__()
self._w = w
self._eps =... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | Ilyabasharov/made_mail.ru | WingLoss | false | 5,341 | [
"MIT"
] | 1 | a81bfd874ab80eb8c7eaad8a4acf723f327f2f50 | https://github.com/Ilyabasharov/made_mail.ru/tree/a81bfd874ab80eb8c7eaad8a4acf723f327f2f50 |
SPPLayer | import torch
class SPPLayer(torch.nn.Module):
def __init__(self, level):
super(SPPLayer, self).__init__()
self.level = level
def forward(self, x):
_n, _c, _h, _w = x.size()
a = 6 + (self.level - 1) * -2
zero_pad = torch.nn.ZeroPad2d((a, a, a, a))
x = zero_pad(... | 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... | IrisDinge/YoloV3_DOTA | SPPLayer | false | 5,342 | [
"MIT"
] | 1 | cdfe6375a2323e9ee162e50a46478d8a66529e6c | https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c |
AttentiveNet | import torch
from torch import nn
import torch.nn.functional as F
class AttentiveNet(nn.Module):
def __init__(self, input_size, hidden_size) ->None:
super().__init__()
self.cov2 = nn.Conv1d(hidden_size, hidden_size, kernel_size=3,
padding=1)
self.cov1 = nn.Conv1d(input_size, h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | ISYSLAB-HUST/DeepNeuropePred | AttentiveNet | false | 5,344 | [
"MIT"
] | 1 | f87f36fdbbc966f727eb063a0f9984850294ba37 | https://github.com/ISYSLAB-HUST/DeepNeuropePred/tree/f87f36fdbbc966f727eb063a0f9984850294ba37 |
CReLU | import torch
import torch.nn as nn
class Scale(nn.Module):
def __init__(self, nchannels, bias=True, init_scale=1.0):
super().__init__()
self.nchannels = nchannels
self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1))
if bias:
self.bias = nn.Parameter(torch.Tenso... | 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... | IrisDinge/YoloV3_DOTA | CReLU | false | 5,345 | [
"MIT"
] | 1 | cdfe6375a2323e9ee162e50a46478d8a66529e6c | https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c |
InferenceBatchSoftmax | import torch
import torch.nn as nn
from itertools import product as product
from math import sqrt as sqrt
from torch.nn import init as init
from torch.nn import functional as F
class InferenceBatchSoftmax(nn.Module):
def __init__(self):
super(InferenceBatchSoftmax, self).__init__()
@staticmethod
... | 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
... | IncyLiu/autokeras | InferenceBatchSoftmax | false | 5,346 | [
"MIT"
] | 1 | e9dbf66b005e2ffaabe29bc366bb4e72fa79add8 | https://github.com/IncyLiu/autokeras/tree/e9dbf66b005e2ffaabe29bc366bb4e72fa79add8 |
ScaledDotProductAttention | import torch
def masked_softmax(vector: 'torch.Tensor', mask: 'torch.Tensor', dim: 'int'
=-1, memory_efficient: 'bool'=False, mask_fill_value: 'float'=-1e+32
) ->torch.Tensor:
"""
https://github.com/allenai/allennlp/blob/b6cc9d39651273e8ec2a7e334908ffa9de5c2026/allennlp/nn/util.py#L231
``torch.nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | IouJenLiu/AFK | ScaledDotProductAttention | false | 5,347 | [
"MIT"
] | 1 | db2b47bb3a5614b61766114b87f143e4a61a4a8d | https://github.com/IouJenLiu/AFK/tree/db2b47bb3a5614b61766114b87f143e4a61a4a8d |
Net | import torch
class Net(torch.nn.Module):
"""Implementing two layer nn."""
def __init__(self, D_IN, H, D_OUT):
super().__init__()
self.linear1 = torch.nn.Linear(D_IN, H)
self.linear2 = torch.nn.Linear(H, D_OUT)
def forward(self, x):
h = self.linear1(x)
h_relu = 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 import triton_helpers
assert_size_stride = torch._C... | ImadDabbura/deep_learning_with_pytorch | Net | false | 5,348 | [
"MIT"
] | 1 | 0cac0614ab08b30654de192e540048cf4243a4e4 | https://github.com/ImadDabbura/deep_learning_with_pytorch/tree/0cac0614ab08b30654de192e540048cf4243a4e4 |
XSigmoidLoss | import torch
import torch.nn as nn
class XSigmoidLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, y_t, y_prime_t):
ey_t = y_t - y_prime_t
return torch.mean(2 * ey_t / (1 + torch.exp(-ey_t)) - ey_t)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), tor... | 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
... | IshanBaliyan/DEEP-TFM_with_cGAN | XSigmoidLoss | false | 5,349 | [
"MIT"
] | 1 | 8d711c025367031197e5b8c7c768fc9fbea406ce | https://github.com/IshanBaliyan/DEEP-TFM_with_cGAN/tree/8d711c025367031197e5b8c7c768fc9fbea406ce |
PLU | import torch
import torch.nn as nn
class PLU(nn.Module):
"""
y = max(alpha*(x+c)−c, min(alpha*(x−c)+c, x))
from PLU: The Piecewise Linear Unit Activation Function
"""
def __init__(self, alpha=0.1, c=1):
super().__init__()
self.alpha = alpha
self.c = c
def forward(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | IrisDinge/YoloV3_DOTA | PLU | false | 5,350 | [
"MIT"
] | 1 | cdfe6375a2323e9ee162e50a46478d8a66529e6c | https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c |
MultipleConst | import torch
import torch.nn as nn
class MultipleConst(nn.Module):
def forward(self, data):
return 255 * data
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... | IvoryCandy/neural-style | MultipleConst | false | 5,351 | [
"Apache-2.0"
] | 1 | d9d73676479e36c1cbd6c9af36d857f80099504b | https://github.com/IvoryCandy/neural-style/tree/d9d73676479e36c1cbd6c9af36d857f80099504b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.