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 |
|---|---|---|---|---|---|---|---|---|---|---|
Classifier | import torch
import torch.nn.functional as F
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, dims):
"""
Single hidden layer classifier
with softmax output.
"""
super(Classifier, self).__init__()
[x_dim, h_dim, y_dim] = dims
self.dense ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NightmareNyx/semi-supervised-pytorch | Classifier | false | 2,702 | [
"MIT"
] | 0 | 43bb86bc6757345bd7a4eb37d6948ee62a268f7e | https://github.com/NightmareNyx/semi-supervised-pytorch/tree/43bb86bc6757345bd7a4eb37d6948ee62a268f7e |
ProjectExciteLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class ProjectExciteLayer(nn.Module):
"""
Project & Excite Module, specifically designed for 3D inputs
*quote*
"""
def __init__(self, num_channels, reduction_ratio=2):
"""
:param num_channels: No of input ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Nightmare4214/FracNet | ProjectExciteLayer | false | 2,703 | [
"Apache-2.0"
] | 0 | db397adb50f71387155d9d110302a5968f86f756 | https://github.com/Nightmare4214/FracNet/tree/db397adb50f71387155d9d110302a5968f86f756 |
ChannelSpatialSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelSELayer3D(nn.Module):
"""
3D extension of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
*Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238*
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Nightmare4214/FracNet | ChannelSpatialSELayer3D | false | 2,704 | [
"Apache-2.0"
] | 0 | db397adb50f71387155d9d110302a5968f86f756 | https://github.com/Nightmare4214/FracNet/tree/db397adb50f71387155d9d110302a5968f86f756 |
GCN | from torch.nn import Module
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __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 import triton_helpers
from torch._inductor.runtime.... | NightmareNyx/pygcn | GCN | false | 2,705 | [
"MIT"
] | 0 | 3972f167ce7fcc41cb21284d75816dfd9a15f7ef | https://github.com/NightmareNyx/pygcn/tree/3972f167ce7fcc41cb21284d75816dfd9a15f7ef |
Join | import torch
class Join(torch.nn.Module):
"""Join layer
"""
def forward(self, unary: 'torch.Tensor', binary: 'torch.Tensor', index1:
'torch.Tensor', index2: 'torch.Tensor'):
"""Join the unary and binary tensors.
:param unary: [u, |U|] the tensor with unary predicates pre-activatio... | 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... | NooneBug/entity_typing_framework | Join | false | 2,706 | [
"MIT"
] | 0 | e4c3cf3a6d9c3a3453ce516de855fc22b49ae5c0 | https://github.com/NooneBug/entity_typing_framework/tree/e4c3cf3a6d9c3a3453ce516de855fc22b49ae5c0 |
LR | import torch
from torch import nn
import torch.utils.data
class LR(nn.Module):
def __init__(self, dimension, num_class=2):
super(LR, self).__init__()
self.last_layer = nn.Linear(dimension, num_class)
self.softmax = nn.Softmax(dim=1)
def forward(self, x):
x = self.last_layer(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.... | Ottovonxu/islide | LR | false | 2,707 | [
"Apache-2.0"
] | 0 | 5ee9954e378f0b5a0722292351cb3cc74b95c1b3 | https://github.com/Ottovonxu/islide/tree/5ee9954e378f0b5a0722292351cb3cc74b95c1b3 |
MeanPoolingLayer | import torch
class BaseLayer(torch.nn.Module):
def __repr__(self):
return self.__class__.__name__ + '()'
class MeanPoolingLayer(BaseLayer):
def __init__(self):
super(MeanPoolingLayer, self).__init__()
def forward(self, input, dim=2):
length = input.shape[2]
return torc... | 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... | Otybrian/blogpost | MeanPoolingLayer | false | 2,708 | [
"MIT"
] | 0 | 518599019e11cd7ee11e01470c4d51dfb4583274 | https://github.com/Otybrian/blogpost/tree/518599019e11cd7ee11e01470c4d51dfb4583274 |
BasicConvTestModel | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
def fill_bias(module, value):
module.bias.data.fill_(value)
def fill_conv_weight(conv, value):
conv.weight.data... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 torchvision import models as models
import torch.nn.pa... | JinYAnGHe/openvino_training_extensions | BasicConvTestModel | false | 2,709 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
SimpleNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleNet(nn.Module):
def __init__(self, ni):
super().__init__()
self.linear1 = nn.Linear(ni, 128)
self.linear2 = nn.Linear(128, 128)
self.linear3 = nn.Linear(128, 64)
self.linear4 = nn.Linear(64, 64)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | P403n1x87/AI-Feynman | SimpleNet | false | 2,710 | [
"MIT"
] | 0 | 73398ad1b739d02b4cb8d9648b208e76d0a9085d | https://github.com/P403n1x87/AI-Feynman/tree/73398ad1b739d02b4cb8d9648b208e76d0a9085d |
HardSwish | import torch
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
def hard_swish(x: 'torch.Tensor', inplace: 'bool'=False):
"""Hard swish."""
inner = F.relu6(x + 3.0).div_(6.0)
return x.mul_(inner) if inplace else x.mul(inner)
class HardSwish(nn.Module):
... | 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 torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.funct... | Oh-Donggyu/model-optimization-level3-nlp-01 | HardSwish | false | 2,711 | [
"MIT"
] | 0 | 3cfe03fd67fa1c5d08e9548c32dcf3c3981923a8 | https://github.com/Oh-Donggyu/model-optimization-level3-nlp-01/tree/3cfe03fd67fa1c5d08e9548c32dcf3c3981923a8 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, gamma=2):
super().__init__()
self.gamma = gamma
def forward(self, input, target):
if not target.size() == input.size():
raise ValueError(
'Tar... | 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... | OctThe16th/COMP-652-FinalProject | FocalLoss | false | 2,712 | [
"MIT"
] | 0 | 00b8a2328516d8ca76d365004c753a91cc426b30 | https://github.com/OctThe16th/COMP-652-FinalProject/tree/00b8a2328516d8ca76d365004c753a91cc426b30 |
UpsamplingPixelShuffle | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class shuffle(nn.Module):
def __init__(self, ratio):
super(shuffle, self).__init__()
self.ratio = ra... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 torchvision import models as models
import torch.nn.pa... | JinYAnGHe/openvino_training_extensions | UpsamplingPixelShuffle | false | 2,713 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
SmallBlock | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class SmallBlock(nn.Module):
def __init__(self, channels):
super(SmallBlock, self).__init__()
self.c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | JinYAnGHe/openvino_training_extensions | SmallBlock | false | 2,714 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
ReferenceActivationBinarizationModule | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
def get_per_channel_scale_shape(input_shape, is_weights):
scale_shape = [(1) for _ in input_shape]
if is_weights:... | 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
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import tor... | JinYAnGHe/openvino_training_extensions | ReferenceActivationBinarizationModule | false | 2,715 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
ResBlockWithFusedBN | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class ResBlockWithFusedBN(nn.Module):
""" Bottleneck Residual Block """
def __init__(self, inplanes, outplanes, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | JinYAnGHe/openvino_training_extensions | ResBlockWithFusedBN | false | 2,716 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
ResBlock | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class ResBlock(nn.Module):
def __init__(self, num_of_channels):
super(ResBlock, self).__init__()
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | JinYAnGHe/openvino_training_extensions | ResBlock | false | 2,717 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
WeightedSumLoss | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class WeightedSumLoss(nn.Module):
"""Aggregate multiple loss functions in one weighted sum."""
def __init__(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 import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import tor... | JinYAnGHe/openvino_training_extensions | WeightedSumLoss | false | 2,718 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
Decoder4_2 | import torch
import torch.nn as nn
class Decoder4_2(nn.Module):
def __init__(self, model=None, fixed=False):
super(Decoder4_2, self).__init__()
self.fixed = fixed
self.conv42 = nn.Conv2d(512, 512, 3, 1, 0)
self.conv41 = nn.Conv2d(512, 256, 3, 1, 0)
self.conv34 = nn.Conv2d(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/pytorch-AdaIN | Decoder4_2 | false | 2,719 | [
"MIT"
] | 0 | 02ae320345232983c754ea233613aedc21e4d348 | https://github.com/MingSun-Tse/pytorch-AdaIN/tree/02ae320345232983c754ea233613aedc21e4d348 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
def weight_init(m):
"""Custom weight init for Conv2D and Linear layers."""
if isinstance(m, nn.Linear):
nn.init.orthogonal_(m.weight.data)
m.bias.data.fill_(0.0)
elif isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | LQNew/SDQ-CAL | Critic | false | 2,720 | [
"MIT"
] | 0 | f24301c84b40b90561527ed192497873bac2051f | https://github.com/LQNew/SDQ-CAL/tree/f24301c84b40b90561527ed192497873bac2051f |
LayerNorm2D | import torch
import torch.nn as nn
class LayerNorm2D(nn.Module):
"""Layer normalization for CNN outputs."""
def __init__(self, channel, idim, eps=1e-12):
super(LayerNorm2D, self).__init__()
self.norm = nn.LayerNorm([channel, idim], eps=eps)
def forward(self, xs):
"""Forward pass.... | 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_... | Park-Jong-Min/neural_sp | LayerNorm2D | false | 2,721 | [
"Apache-2.0"
] | 0 | a4f300ae9c16c6e9ea3128292fbc141f68f38081 | https://github.com/Park-Jong-Min/neural_sp/tree/a4f300ae9c16c6e9ea3128292fbc141f68f38081 |
downsampled_get_normal | import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.sparse
class downsampled_get_normal(nn.Module):
def __init__(self, num_in_layers):
super(downsampled_get_normal, self).__init__()
self.conv1 = nn.Conv2d(num_in_layers, 3, kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
import torch.sparse
a... | PrendiProgramming/UprightNet | downsampled_get_normal | false | 2,722 | [
"MIT"
] | 0 | 73a0677079e27a806b48bf9ede70b8377002b2f3 | https://github.com/PrendiProgramming/UprightNet/tree/73a0677079e27a806b48bf9ede70b8377002b2f3 |
IrisClassifier | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
class IrisClassifier(nn.Module):
def __init__(self):
super(IrisClassifier, self).__init__()
self.fc1 = nn.Linear(4, 10)
self.fc2 = nn.Linear(10, 10)
self.fc3 = nn.Linear(10, 3)
def forward(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 torch.nn as nn
import ... | ParikhKadam/mlflow | IrisClassifier | false | 2,723 | [
"Apache-2.0"
] | 0 | 21d64d45c6131b62bb956f77327aa1abd9df66b2 | https://github.com/ParikhKadam/mlflow/tree/21d64d45c6131b62bb956f77327aa1abd9df66b2 |
PositionwiseFeedForward | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class Identity(nn.Module):
def forward(self, input_):
return input_
class LayerNormalization(nn.Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JinYAnGHe/openvino_training_extensions | PositionwiseFeedForward | false | 2,724 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
LinearGLUBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class LinearGLUBlock(nn.Module):
"""A linear GLU block.
Args:
size (int): input and output dimension
"""
def __init__(self, size):
super().__init__()
self.fc = nn.Linear(size, size * 2)
def forward(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... | Park-Jong-Min/neural_sp | LinearGLUBlock | false | 2,725 | [
"Apache-2.0"
] | 0 | a4f300ae9c16c6e9ea3128292fbc141f68f38081 | https://github.com/Park-Jong-Min/neural_sp/tree/a4f300ae9c16c6e9ea3128292fbc141f68f38081 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
def __init__(self, dims, method='general', dropout=0.0):
super().__init__()
if method not in ('dot', 'general'):
raise ValueError('Invalid attention type selected')
self.method = method
if method == 'genera... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Palem1988/NeMo | Attention | false | 2,726 | [
"Apache-2.0"
] | 0 | 56c909b4088f345bf28fe0d0730380527df584f6 | https://github.com/Palem1988/NeMo/tree/56c909b4088f345bf28fe0d0730380527df584f6 |
get_normal | import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.sparse
class get_normal(nn.Module):
def __init__(self, num_in_layers, num_out_layers=3):
super(get_normal, self).__init__()
self.conv1 = nn.Conv2d(num_in_layers, num_out_layers, ke... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
import torch.sparse
a... | PrendiProgramming/UprightNet | get_normal | false | 2,727 | [
"MIT"
] | 0 | 73a0677079e27a806b48bf9ede70b8377002b2f3 | https://github.com/PrendiProgramming/UprightNet/tree/73a0677079e27a806b48bf9ede70b8377002b2f3 |
SNR_block | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class ChannelGate_sub(nn.Module):
"""A mini-network that generates channel-wise gates conditioned on input tensor."""
def __init__(self, in_channels, num_gates=None, return_gates=False,
gate_activation='sigmoid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ohyeon5/DN_uncrowding | SNR_block | false | 2,728 | [
"Apache-2.0"
] | 0 | cb13ef2db4b15271517e06e4f323f667d01fcdb1 | https://github.com/Ohyeon5/DN_uncrowding/tree/cb13ef2db4b15271517e06e4f323f667d01fcdb1 |
UpSampling | import torch
import torch.nn as nn
class UpSampling(nn.Module):
def __init__(self, in_c):
super().__init__()
self.unpool1 = nn.Upsample(scale_factor=2)
self.conv1 = nn.Conv1d(in_c, in_c, 3, padding=1)
self.unpool2 = nn.Upsample(scale_factor=2)
self.conv2 = nn.Conv1d(in_c, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | PatrickChoDev/LiDAR-ObjDetect | UpSampling | false | 2,729 | [
"MIT"
] | 0 | a839220d28a1fda045278ded0992e46f408a5442 | https://github.com/PatrickChoDev/LiDAR-ObjDetect/tree/a839220d28a1fda045278ded0992e46f408a5442 |
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, gamma=1.5, alpha=0.25, reduction=torch.mean):
super(FocalLoss, self).__init__()
self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none')
self.gamma = gamma
self.alpha = alpha
self.reduction = 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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | PatrickChoDev/LiDAR-ObjDetect | FocalLoss | false | 2,730 | [
"MIT"
] | 0 | a839220d28a1fda045278ded0992e46f408a5442 | https://github.com/PatrickChoDev/LiDAR-ObjDetect/tree/a839220d28a1fda045278ded0992e46f408a5442 |
ScaledDotProductAttention | import torch
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask (optional)
"""
x = torch.clamp(x, min=-15.0, max=15.0)
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim=True)[0])
if m is not None:
e_x = e_x * 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.... | Prasath2001/commonsense-rl | ScaledDotProductAttention | false | 2,731 | [
"Apache-2.0"
] | 0 | ef3e83270d34cf211b2d2086120cccae0621477b | https://github.com/Prasath2001/commonsense-rl/tree/ef3e83270d34cf211b2d2086120cccae0621477b |
eca_layer | import torch
import torch.nn as nn
class eca_layer(nn.Module):
"""Constructs a ECA module.
Args:
channel: Number of channels of the input feature map
k_size: Adaptive selection of kernel size
"""
def __init__(self, channel, k_size=3):
super(eca_layer, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | QJYBall/NNDL-Final-Project | eca_layer | false | 2,732 | [
"MIT"
] | 0 | 9906fb59e888b51b33f3c61dd5a0737a1a0f0761 | https://github.com/QJYBall/NNDL-Final-Project/tree/9906fb59e888b51b33f3c61dd5a0737a1a0f0761 |
TokenLabelSoftTargetCrossEntropy | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
class TokenLabelSoftTargetCrossEntropy(nn.Module):
"""
Token labeling dense loss with soft target, see more from token labeling
input: x is output of model, target is ground truth
return: loss
"""
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 as nn
... | QLSong/cv-classify | TokenLabelSoftTargetCrossEntropy | false | 2,733 | [
"Apache-2.0"
] | 0 | 02f53d03868f299a08b5c97a266b50a7fdcd3f2b | https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b |
get_confidence | import torch
import torch.utils.data
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.sparse
class get_confidence(nn.Module):
def __init__(self, num_in_layers, num_out_layers=1):
super(get_confidence, self).__init__()
self.conv1 = nn.Conv2d(num_in_layers, num_out_la... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
import torch.sparse
a... | PrendiProgramming/UprightNet | get_confidence | false | 2,734 | [
"MIT"
] | 0 | 73a0677079e27a806b48bf9ede70b8377002b2f3 | https://github.com/PrendiProgramming/UprightNet/tree/73a0677079e27a806b48bf9ede70b8377002b2f3 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
""" Applies attention mechanism on the `context` using the `query`.
**Thank you** to IBM for their initial implementation of :class:`Attention`. Here is
their `License
<https://github.com/IBM/pytorch-seq2seq/blob/master/LICENSE>`__.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Prasath2001/commonsense-rl | Attention | false | 2,735 | [
"Apache-2.0"
] | 0 | ef3e83270d34cf211b2d2086120cccae0621477b | https://github.com/Prasath2001/commonsense-rl/tree/ef3e83270d34cf211b2d2086120cccae0621477b |
Shifted_softplus | import torch
import torch.nn as nn
import torch.nn.parallel
class Shifted_softplus(nn.Module):
"""
Performs a Shifter softplus loss, which modifies with a value of log(2)
"""
def __init__(self):
super(Shifted_softplus, self).__init__()
self.act = nn.Softplus()
self.shift = nn.Para... | 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.nn.parallel
assert_size_str... | QMrpy/deepchem | Shifted_softplus | false | 2,736 | [
"MIT"
] | 0 | f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 | https://github.com/QMrpy/deepchem/tree/f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 |
Downsample | import torch
import torch.nn as nn
import torch.nn.parallel
class Downsample(nn.Module):
"""
Image to Patch Embedding, downsampling between stage1 and stage2
"""
def __init__(self, in_embed_dim, out_embed_dim, patch_size):
super().__init__()
self.proj = nn.Conv2d(in_embed_dim, out_emb... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dy... | QLSong/cv-classify | Downsample | false | 2,737 | [
"Apache-2.0"
] | 0 | 02f53d03868f299a08b5c97a266b50a7fdcd3f2b | https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b |
Custom_dropout | import torch
import torch.nn as nn
import torch.nn.parallel
class Custom_dropout(nn.Module):
"""
An implementation for few , Given a task perform a rowise sum of 2-d
matrix , you get a zero out the contribution of few of rows in the matrix
Given, X a 2-d matrix consisting of row vectors (1-d) x1 , x2 ,..xn.... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C... | QMrpy/deepchem | Custom_dropout | false | 2,738 | [
"MIT"
] | 0 | f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 | https://github.com/QMrpy/deepchem/tree/f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 |
Atom_Wise_Convolution | import torch
import torch.nn as nn
import torch.nn.parallel
class Shifted_softplus(nn.Module):
"""
Performs a Shifter softplus loss, which modifies with a value of log(2)
"""
def __init__(self):
super(Shifted_softplus, self).__init__()
self.act = nn.Softplus()
self.shift = nn.Para... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | QMrpy/deepchem | Atom_Wise_Convolution | false | 2,739 | [
"MIT"
] | 0 | f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 | https://github.com/QMrpy/deepchem/tree/f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 |
ScaleNorm | import math
import torch
import torch.nn as nn
import torch.nn.parallel
class ScaleNorm(nn.Module):
"""Apply Scale Normalization to input.
The ScaleNorm layer first computes the square root of the scale, then computes the matrix/vector norm of the input tensor.
The norm value is calculated as `sqrt(scale) / ... | 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.nn ... | QMrpy/deepchem | ScaleNorm | false | 2,740 | [
"MIT"
] | 0 | f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 | https://github.com/QMrpy/deepchem/tree/f38a21c71e7bc4fd1fa59601be2b79ce7d744bd6 |
SqueezeExcitation | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
import torch.nn.parallel
def _make_divisible(v: 'float', divisor: 'int', min_value: 'Optional[int]'=None
) ->int:
"""
This function is taken from the original tf repo.
It ensures tha... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 Tensor
impo... | QLSong/cv-classify | SqueezeExcitation | false | 2,741 | [
"Apache-2.0"
] | 0 | 02f53d03868f299a08b5c97a266b50a7fdcd3f2b | https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b |
complex_relu_layer | import torch
import torch.nn as nn
class complex_relu_layer(nn.Module):
def __init__(self):
super(complex_relu_layer, self).__init__()
def complex_relu(self, real, img):
mask = 1.0 * (real >= 0)
return mask * real, mask * img
def forward(self, real, img=None):
if img 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | RemyLau/SimpleMagNet | complex_relu_layer | false | 2,742 | [
"MIT"
] | 0 | ee3cc5fc9a7793d2e2cf5a4b635fb690bb5b988e | https://github.com/RemyLau/SimpleMagNet/tree/ee3cc5fc9a7793d2e2cf5a4b635fb690bb5b988e |
UpSampleBlock | import torch
import torch.nn as nn
class UpSampleBlock(nn.Module):
def __init__(self, scale_factor=(2, 2), mode='bilinear', p=0.0):
super(UpSampleBlock, self).__init__()
self.upsample = nn.Upsample(scale_factor=scale_factor, mode=mode)
if p:
self.dropout = nn.Dropout(p)
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Qinaty/input-aware-backdoor-attack-release | UpSampleBlock | false | 2,743 | [
"MIT"
] | 0 | ce897adf4a3ce0d2badbd2b53233561fee6c7db7 | https://github.com/Qinaty/input-aware-backdoor-attack-release/tree/ce897adf4a3ce0d2badbd2b53233561fee6c7db7 |
GraphConv | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphConv(nn.Module):
def __init__(self, input_dim, output_dim, add_self=False,
normalize_embedding=False, dropout=0.0, bias=True):
super(GraphConv, self).__init__()
self.add_self = add_self
self.dropout = dr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Qin-J/Multi-site-transfer-classification-of-major-depressive-disorder | GraphConv | false | 2,744 | [
"Apache-2.0"
] | 0 | f6af292388ec83a9851a2254f38e8d90adfe4e6c | https://github.com/Qin-J/Multi-site-transfer-classification-of-major-depressive-disorder/tree/f6af292388ec83a9851a2254f38e8d90adfe4e6c |
ChanNorm | import torch
from torch import nn
class ChanNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.eps = eps
self.g = nn.Parameter(torch.ones(1, dim, 1, 1))
self.b = nn.Parameter(torch.zeros(1, dim, 1, 1))
def forward(self, x):
var = torch.var(x,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Rexiome/lightweight-gan | ChanNorm | false | 2,745 | [
"MIT"
] | 0 | 4e5c18046fc105129c33995e0bffeb5f14963f4c | https://github.com/Rexiome/lightweight-gan/tree/4e5c18046fc105129c33995e0bffeb5f14963f4c |
GCN | from torch.nn import Module
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
This class is mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | QHwan/GCIceNet | GCN | false | 2,746 | [
"MIT"
] | 0 | 5792f5fa7bd2989b54eddeae5c9f8fca3f004bb5 | https://github.com/QHwan/GCIceNet/tree/5792f5fa7bd2989b54eddeae5c9f8fca3f004bb5 |
Noise | import torch
from torch import nn
def exists(val):
return val is not None
class Noise(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, x, noise=None):
b, _, h, w, device = *x.shape, x.device
if not exists(no... | import torch
from torch import device
import triton
import 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.... | Rexiome/lightweight-gan | Noise | false | 2,747 | [
"MIT"
] | 0 | 4e5c18046fc105129c33995e0bffeb5f14963f4c | https://github.com/Rexiome/lightweight-gan/tree/4e5c18046fc105129c33995e0bffeb5f14963f4c |
Decoder5 | import torch
import torch.nn as nn
class Decoder5(nn.Module):
def __init__(self, model=None, fixed=False):
super(Decoder5, self).__init__()
self.fixed = fixed
self.conv51 = nn.Conv2d(512, 512, 3, 1, 0)
self.conv44 = nn.Conv2d(512, 512, 3, 1, 0)
self.conv43 = nn.Conv2d(512,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MingSun-Tse/pytorch-AdaIN | Decoder5 | false | 2,748 | [
"MIT"
] | 0 | 02ae320345232983c754ea233613aedc21e4d348 | https://github.com/MingSun-Tse/pytorch-AdaIN/tree/02ae320345232983c754ea233613aedc21e4d348 |
PatchEmbed | import torch
import torch.nn as nn
import torch.nn.parallel
class PatchEmbed(nn.Module):
"""
Image to Patch Embedding.
Different with ViT use 1 conv layer, we use 4 conv layers to do patch embedding
"""
def __init__(self, img_size=224, stem_conv=False, stem_stride=1,
patch_size=8, in_chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
assert_size_stride = torch._C._dy... | QLSong/cv-classify | PatchEmbed | false | 2,749 | [
"Apache-2.0"
] | 0 | 02f53d03868f299a08b5c97a266b50a7fdcd3f2b | https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Odiurd/deep-reinforcement-learning-continuous-control | Critic | false | 2,750 | [
"MIT"
] | 0 | b1fb17ceab8cf23200dbdada21ba2ab0e33aa1a2 | https://github.com/Odiurd/deep-reinforcement-learning-continuous-control/tree/b1fb17ceab8cf23200dbdada21ba2ab0e33aa1a2 |
ClassBlock | import torch
import torch.nn as nn
import torch.nn.parallel
class Mlp(nn.Module):
"""Implementation of MLP"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | QLSong/cv-classify | ClassBlock | false | 2,751 | [
"Apache-2.0"
] | 0 | 02f53d03868f299a08b5c97a266b50a7fdcd3f2b | https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b |
CrossModalAttention | import torch
from torch import nn
class CrossModalAttention(nn.Module):
def __init__(self, emb_dim, num_heads, num_latents):
super().__init__()
self.value = nn.Parameter(torch.randn(num_latents, emb_dim))
self.attention = nn.MultiheadAttention(emb_dim, num_heads)
def forward(self, ke... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | QuintinPope/FASTA_Perceiver | CrossModalAttention | false | 2,752 | [
"Apache-2.0"
] | 0 | ad3a8e2333a1dec9b34ae024cb2faf38c6ea284a | https://github.com/QuintinPope/FASTA_Perceiver/tree/ad3a8e2333a1dec9b34ae024cb2faf38c6ea284a |
Skew | import torch
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class Skew(nn.Module):
def forward(self, X):
A = X.triu(1)
return A - A.transpose(-1, -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.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import to... | MartinRenaudin/tutorials | Skew | false | 2,753 | [
"BSD-3-Clause"
] | 0 | 035d6827d77c52fed2a927f105e39fd73516f093 | https://github.com/MartinRenaudin/tutorials/tree/035d6827d77c52fed2a927f105e39fd73516f093 |
TokenEmbedding | import math
import torch
from torch import Tensor
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class TokenEmbedding(nn.Module):
def __init__(self, vocab_size: 'int', emb_... | 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.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import to... | MartinRenaudin/tutorials | TokenEmbedding | false | 2,754 | [
"BSD-3-Clause"
] | 0 | 035d6827d77c52fed2a927f105e39fd73516f093 | https://github.com/MartinRenaudin/tutorials/tree/035d6827d77c52fed2a927f105e39fd73516f093 |
TracedModule | import torch
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class TracedModule(torch.nn.Module):
def forward(self, x):
x = x.type(torch.float32)
return torch.floor(torch.sqrt(x) ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.quantization
import torch.onnx
import torch.nn.parallel
import tor... | MartinRenaudin/tutorials | TracedModule | false | 2,755 | [
"BSD-3-Clause"
] | 0 | 035d6827d77c52fed2a927f105e39fd73516f093 | https://github.com/MartinRenaudin/tutorials/tree/035d6827d77c52fed2a927f105e39fd73516f093 |
Scale | import torch
import torch.utils.data
from torch import nn
class Scale(nn.Module):
def __init__(self, init_value=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
return input * self.scale
def get_inputs():
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
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | Rick-960123/centermask-mdf-master | Scale | false | 2,756 | [
"BSD-2-Clause"
] | 0 | 49388b03b9ffb06577cd28b9ddaa68cadb82e926 | https://github.com/Rick-960123/centermask-mdf-master/tree/49388b03b9ffb06577cd28b9ddaa68cadb82e926 |
PairwiseDistance | import torch
class PairwiseDistance(torch.nn.Module):
def __init__(self, p=2):
super().__init__()
self.p = p
def forward(self, x, y):
x_ = x.repeat([1] + list(y.shape[1:])).reshape(*y.shape, -1)
y_ = y.repeat([1] + list(x.shape[1:])).reshape(*x.shape, -1).transpose(
... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | Rikorose/pytorch-ddtw | PairwiseDistance | false | 2,757 | [
"Apache-2.0"
] | 0 | 131d533349042a6cbcfe8b22596e12926ac7fddb | https://github.com/Rikorose/pytorch-ddtw/tree/131d533349042a6cbcfe8b22596e12926ac7fddb |
Encoder5 | import torch
import numpy as np
import torch.nn as nn
class Encoder5(nn.Module):
def __init__(self, model=None, fixed=False):
super(Encoder5, self).__init__()
self.fixed = fixed
self.conv0 = nn.Conv2d(3, 3, 1, 1, 0)
self.conv0.weight = nn.Parameter(torch.from_numpy(np.array([[[[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
from torch._inductor.runtime.... | MingSun-Tse/pytorch-AdaIN | Encoder5 | false | 2,758 | [
"MIT"
] | 0 | 02ae320345232983c754ea233613aedc21e4d348 | https://github.com/MingSun-Tse/pytorch-AdaIN/tree/02ae320345232983c754ea233613aedc21e4d348 |
SpatialAttention | import torch
import torch.utils.data
from torch import nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=3):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | Rick-960123/centermask-mdf-master | SpatialAttention | false | 2,759 | [
"BSD-2-Clause"
] | 0 | 49388b03b9ffb06577cd28b9ddaa68cadb82e926 | https://github.com/Rick-960123/centermask-mdf-master/tree/49388b03b9ffb06577cd28b9ddaa68cadb82e926 |
SEModule | import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
retu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torchvision.transforms i... | Rick-960123/centermask-mdf-master | SEModule | false | 2,760 | [
"BSD-2-Clause"
] | 0 | 49388b03b9ffb06577cd28b9ddaa68cadb82e926 | https://github.com/Rick-960123/centermask-mdf-master/tree/49388b03b9ffb06577cd28b9ddaa68cadb82e926 |
eSEModule | import torch
from torchvision.transforms import functional as F
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
retu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torchvision.transforms i... | Rick-960123/centermask-mdf-master | eSEModule | false | 2,761 | [
"BSD-2-Clause"
] | 0 | 49388b03b9ffb06577cd28b9ddaa68cadb82e926 | https://github.com/Rick-960123/centermask-mdf-master/tree/49388b03b9ffb06577cd28b9ddaa68cadb82e926 |
Symmetric | import torch
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class Symmetric(nn.Module):
def forward(self, X):
return X.triu() + X.triu(1).transpose(-1, -2)
def ge... | 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.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import to... | MartinRenaudin/tutorials | Symmetric | false | 2,762 | [
"BSD-3-Clause"
] | 0 | 035d6827d77c52fed2a927f105e39fd73516f093 | https://github.com/MartinRenaudin/tutorials/tree/035d6827d77c52fed2a927f105e39fd73516f093 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLayer, self).__init__(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Prasath2001/commonsense-rl | GAT | false | 2,763 | [
"Apache-2.0"
] | 0 | ef3e83270d34cf211b2d2086120cccae0621477b | https://github.com/Prasath2001/commonsense-rl/tree/ef3e83270d34cf211b2d2086120cccae0621477b |
LearnableMax | import torch
import torch.nn as nn
class LearnableMax(nn.Module):
def __init__(self, out_chn):
super(LearnableMax, self).__init__()
self.max1 = nn.Parameter(torch.zeros(1, out_chn, 1, 1),
requires_grad=True)
self.max2 = nn.Parameter(torch.zeros(1, out_chn, 1, 1),
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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | RiyaoDong/HGSL | LearnableMax | false | 2,764 | [
"Apache-2.0"
] | 0 | 19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 | https://github.com/RiyaoDong/HGSL/tree/19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 |
cal_L2Norm | import torch
class cal_L2Norm(torch.nn.Module):
def __init__(self):
super(cal_L2Norm, self).__init__()
self.eps = 1e-10
def forward(self, x):
norm = torch.sqrt(torch.sum(x * x, dim=1) + self.eps)
return norm
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | RiyaoDong/HGSL | cal_L2Norm | false | 2,765 | [
"Apache-2.0"
] | 0 | 19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 | https://github.com/RiyaoDong/HGSL/tree/19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 |
Transformer | import torch
import torch.nn as nn
import torch.nn.parallel
class Mlp(nn.Module):
"""Implementation of MLP"""
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | QLSong/cv-classify | Transformer | false | 2,766 | [
"Apache-2.0"
] | 0 | 02f53d03868f299a08b5c97a266b50a7fdcd3f2b | https://github.com/QLSong/cv-classify/tree/02f53d03868f299a08b5c97a266b50a7fdcd3f2b |
BatchLinear | import torch
import torch.nn as nn
from collections import OrderedDict
class MetaModule(nn.Module):
"""
Base class for PyTorch meta-learning modules. These modules accept an
additional argument `params` in their `forward` method.
Notes
-----
Objects inherited from `MetaModule` are fully compa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | RisingStockPrices/multi-shape-siren | BatchLinear | false | 2,767 | [
"MIT"
] | 0 | f78d6deb94660fd11ef0caf55f88095b74d3e223 | https://github.com/RisingStockPrices/multi-shape-siren/tree/f78d6deb94660fd11ef0caf55f88095b74d3e223 |
LearnableBias | import torch
import torch.nn as nn
class LearnableBias(nn.Module):
def __init__(self, out_chn):
super(LearnableBias, self).__init__()
self.bias = nn.Parameter(torch.zeros(1, out_chn, 1, 1),
requires_grad=True)
self.out_chn = out_chn
def forward(self, x):
out = x +... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | RiyaoDong/HGSL | LearnableBias | false | 2,768 | [
"Apache-2.0"
] | 0 | 19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 | https://github.com/RiyaoDong/HGSL/tree/19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 |
ScaledSiLU | import torch
class ScaledSiLU(torch.nn.Module):
def __init__(self):
super().__init__()
self.scale_factor = 1 / 0.6
self._activation = torch.nn.SiLU()
def forward(self, x):
return self._activation(x) * self.scale_factor
def get_inputs():
return [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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | RolnickLab/ocp | ScaledSiLU | false | 2,769 | [
"MIT"
] | 0 | e120c3b90203a46f5fc7626f0b5c8979e4944765 | https://github.com/RolnickLab/ocp/tree/e120c3b90203a46f5fc7626f0b5c8979e4944765 |
PolynomialEnvelope | import torch
class PolynomialEnvelope(torch.nn.Module):
"""
Polynomial envelope function that ensures a smooth cutoff.
Parameters
----------
exponent: int
Exponent of the envelope function.
"""
def __init__(self, exponent):
super().__init__()
assert expone... | 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... | RolnickLab/ocp | PolynomialEnvelope | false | 2,770 | [
"MIT"
] | 0 | e120c3b90203a46f5fc7626f0b5c8979e4944765 | https://github.com/RolnickLab/ocp/tree/e120c3b90203a46f5fc7626f0b5c8979e4944765 |
MetaLayerNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class MetaModule(nn.Module):
"""
Base class for PyTorch meta-learning modules. These modules accept an
additional argument `params` in their `forward` method.
Notes
-----
Objects inherited 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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | RisingStockPrices/multi-shape-siren | MetaLayerNorm | false | 2,771 | [
"MIT"
] | 0 | f78d6deb94660fd11ef0caf55f88095b74d3e223 | https://github.com/RisingStockPrices/multi-shape-siren/tree/f78d6deb94660fd11ef0caf55f88095b74d3e223 |
MetaBilinear | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class MetaModule(nn.Module):
"""
Base class for PyTorch meta-learning modules. These modules accept an
additional argument `params` in their `forward` method.
Notes
-----
Objects inherited 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
reinterpret_tensor = torch._C._dynamo.guards._reinterp... | RisingStockPrices/multi-shape-siren | MetaBilinear | false | 2,772 | [
"MIT"
] | 0 | f78d6deb94660fd11ef0caf55f88095b74d3e223 | https://github.com/RisingStockPrices/multi-shape-siren/tree/f78d6deb94660fd11ef0caf55f88095b74d3e223 |
ScaledDotProductAttention | import torch
import torch.nn.functional as F
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RogerTsai917/attention-is-all-you-need-pytorch | ScaledDotProductAttention | false | 2,773 | [
"MIT"
] | 0 | 64197e55d275e5c819bc786a9ff19849cdf2f6b9 | https://github.com/RogerTsai917/attention-is-all-you-need-pytorch/tree/64197e55d275e5c819bc786a9ff19849cdf2f6b9 |
RandomShiftsAug | import torch
import torch.nn as nn
import torch.nn.functional as F
class RandomShiftsAug(nn.Module):
def __init__(self, pad):
super().__init__()
self.pad = pad
def forward(self, x):
x = x.float()
n, _c, h, w = x.size()
assert h == w
padding = tuple([self.pad] ... | import torch
from torch import device
import triton
import triton.language 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._d... | RobertMcCarthy97/url_benchmark | RandomShiftsAug | false | 2,774 | [
"MIT"
] | 0 | e2d99b05bc7fd62d1e8d9789840a0cc5d8174136 | https://github.com/RobertMcCarthy97/url_benchmark/tree/e2d99b05bc7fd62d1e8d9789840a0cc5d8174136 |
PositionwiseFeedForward | import torch
import torch.nn.functional as F
import torch.nn as nn
class PositionwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.1):
super().__init__()
self.w_1 = nn.Linear(d_in, d_hid)
self.w_2 = nn.Linear(d_hid, d_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 import triton_helpers
from torch._inductor.runtime.... | RogerTsai917/attention-is-all-you-need-pytorch | PositionwiseFeedForward | false | 2,775 | [
"MIT"
] | 0 | 64197e55d275e5c819bc786a9ff19849cdf2f6b9 | https://github.com/RogerTsai917/attention-is-all-you-need-pytorch/tree/64197e55d275e5c819bc786a9ff19849cdf2f6b9 |
LanguageModelCriterion | import torch
import torch.nn as nn
from torch.autograd import *
class LanguageModelCriterion(nn.Module):
def __init__(self):
super(LanguageModelCriterion, self).__init__()
def forward(self, input, target, mask):
if target.ndim == 3:
target = target.reshape(-1, target.shape[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
import torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Romero027/ImageCaptioning.pytorch | LanguageModelCriterion | false | 2,776 | [
"MIT"
] | 0 | 069c95f5d343fb126afa8b10ec18e472f30b7b35 | https://github.com/Romero027/ImageCaptioning.pytorch/tree/069c95f5d343fb126afa8b10ec18e472f30b7b35 |
SiQU | import torch
class SiQU(torch.nn.Module):
def __init__(self):
super().__init__()
self._activation = torch.nn.SiLU()
def forward(self, x):
return x * self._activation(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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | RolnickLab/ocp | SiQU | false | 2,777 | [
"MIT"
] | 0 | e120c3b90203a46f5fc7626f0b5c8979e4944765 | https://github.com/RolnickLab/ocp/tree/e120c3b90203a46f5fc7626f0b5c8979e4944765 |
L2Norm | import torch
class L2Norm(torch.nn.Module):
def __init__(self):
super(L2Norm, self).__init__()
self.eps = 1e-10
def forward(self, x):
norm = torch.sqrt(torch.sum(x * x, dim=1) + self.eps)
if len(norm.size()) == 1:
x = x / norm.unsqueeze(-1).expand_as(x)
el... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | RiyaoDong/HGSL | L2Norm | false | 2,778 | [
"Apache-2.0"
] | 0 | 19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 | https://github.com/RiyaoDong/HGSL/tree/19fa984b3bfde0e3b7acbce87dd40177cd64f9b0 |
GaussianSmearing | import torch
import torch.nn as nn
class GaussianSmearing(nn.Module):
def __init__(self, in_features, start=0, end=1, num_freqs=50):
super(GaussianSmearing, self).__init__()
self.num_freqs = num_freqs
offset = torch.linspace(start, end, num_freqs)
self.coeff = -0.5 / (offset[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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | RolnickLab/ocp | GaussianSmearing | false | 2,779 | [
"MIT"
] | 0 | e120c3b90203a46f5fc7626f0b5c8979e4944765 | https://github.com/RolnickLab/ocp/tree/e120c3b90203a46f5fc7626f0b5c8979e4944765 |
PixelwiseNorm | import torch
from torch import nn
import torch.nn.parallel
import torch.utils.data
class PixelwiseNorm(nn.Module):
"""
Pixelwise feature vector normalization.
"""
def __init__(self):
super(PixelwiseNorm, self).__init__()
def forward(self, x, alpha=1e-07):
"""
forward pass... | 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
import torch.nn.parallel
import torch.utils.data
assert_si... | RuslanKhalitov/gan_dogs | PixelwiseNorm | false | 2,780 | [
"MIT"
] | 0 | f11829d6d8d02e3c834061d7326b270ef2503108 | https://github.com/RuslanKhalitov/gan_dogs/tree/f11829d6d8d02e3c834061d7326b270ef2503108 |
SphericalBesselBasis | import math
import torch
import numpy as np
class SphericalBesselBasis(torch.nn.Module):
"""
1D spherical Bessel basis
Parameters
----------
num_radial: int
Controls maximum frequency.
cutoff: float
Cutoff distance in Angstrom.
"""
def __init__(self, num_radial: '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
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
import numpy as np
assert_size_stride = torch._C._dynamo.guar... | RolnickLab/ocp | SphericalBesselBasis | false | 2,781 | [
"MIT"
] | 0 | e120c3b90203a46f5fc7626f0b5c8979e4944765 | https://github.com/RolnickLab/ocp/tree/e120c3b90203a46f5fc7626f0b5c8979e4944765 |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv = nn.Conv1d(2, 1, kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | RuaBQ/FEAT | SpatialAttention | false | 2,782 | [
"MIT"
] | 0 | e46f56b03f8ef820d549cb385600a12bdf224de9 | https://github.com/RuaBQ/FEAT/tree/e46f56b03f8ef820d549cb385600a12bdf224de9 |
eca_block | import math
import torch
import torch.nn as nn
class eca_block(nn.Module):
def __init__(self, channel, b=1, gamma=2):
super(eca_block, self).__init__()
kernel_size = int(abs((math.log(channel, 2) + b) / gamma))
kernel_size = kernel_size if kernel_size % 2 else kernel_size + 1
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | RuidongDavidLin/YOLOV4-tiny-Pytorch | eca_block | false | 2,783 | [
"MIT"
] | 0 | f2bb941ff894e12551bf285eb09fd42db2fb3dee | https://github.com/RuidongDavidLin/YOLOV4-tiny-Pytorch/tree/f2bb941ff894e12551bf285eb09fd42db2fb3dee |
RewardCriterion | import torch
import torch.nn as nn
from torch.autograd import *
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(self, input, seq, reward):
input = input.gather(2, seq.unsqueeze(2)).squeeze(2)
input = input.reshape(-1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Romero027/ImageCaptioning.pytorch | RewardCriterion | false | 2,784 | [
"MIT"
] | 0 | 069c95f5d343fb126afa8b10ec18e472f30b7b35 | https://github.com/Romero027/ImageCaptioning.pytorch/tree/069c95f5d343fb126afa8b10ec18e472f30b7b35 |
ExponentialEnvelope | import torch
class ExponentialEnvelope(torch.nn.Module):
"""
Exponential envelope function that ensures a smooth cutoff,
as proposed in Unke, Chmiela, Gastegger, Schütt, Sauceda, Müller 2021.
SpookyNet: Learning Force Fields with Electronic Degrees of Freedom
and Nonlocal Effects
"""
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.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | RolnickLab/ocp | ExponentialEnvelope | false | 2,785 | [
"MIT"
] | 0 | e120c3b90203a46f5fc7626f0b5c8979e4944765 | https://github.com/RolnickLab/ocp/tree/e120c3b90203a46f5fc7626f0b5c8979e4944765 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.1):
super().__init__()
self.w_1 = nn.Linear(d_in, d_hid)
self.w_2 = nn.Linear(d_hid, d_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 import triton_helpers
from torch._inductor.runtime.... | Romero027/OmniNet | PositionwiseFeedForward | false | 2,786 | [
"Apache-2.0"
] | 0 | c1cda1738c80925e5468b3ffc7aae2153bcd9e62 | https://github.com/Romero027/OmniNet/tree/c1cda1738c80925e5468b3ffc7aae2153bcd9e62 |
LinearEncoder | import torch
import torch.nn as nn
from torch.autograd import *
import torch.nn.init as init
class LayerNormalization(nn.Module):
""" Layer normalization module """
def __init__(self, d_hid, eps=0.001):
super(LayerNormalization, self).__init__()
self.eps = eps
self.a_2 = nn.Parameter(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | RussellMcGrady/Multi-head-attention-based-MetaR | LinearEncoder | false | 2,787 | [
"Apache-2.0"
] | 0 | 4e47546da35bd57ff7ab16d0fed19be31c063563 | https://github.com/RussellMcGrady/Multi-head-attention-based-MetaR/tree/4e47546da35bd57ff7ab16d0fed19be31c063563 |
SupportEncoder | import torch
import torch.nn as nn
from torch.autograd import *
import torch.nn.init as init
class LayerNormalization(nn.Module):
""" Layer normalization module """
def __init__(self, d_hid, eps=0.001):
super(LayerNormalization, self).__init__()
self.eps = eps
self.a_2 = nn.Parameter(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | RussellMcGrady/Multi-head-attention-based-MetaR | SupportEncoder | false | 2,788 | [
"Apache-2.0"
] | 0 | 4e47546da35bd57ff7ab16d0fed19be31c063563 | https://github.com/RussellMcGrady/Multi-head-attention-based-MetaR/tree/4e47546da35bd57ff7ab16d0fed19be31c063563 |
EmbeddingsInteraction | import torch
import torch.nn as nn
class EmbeddingsInteraction(nn.Module):
def __init__(self):
super(EmbeddingsInteraction, self).__init__()
def forward(self, x):
"""
:param x: shape (batch_size, num_fields, embedding_dim)
:return: shape (batch_size, num_fields*(num_fields)//... | 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... | SUSTechBruce/RL_CTR | EmbeddingsInteraction | false | 2,789 | [
"Apache-2.0"
] | 0 | 817398dc1c117e22f41281830ae3c33bba8062d3 | https://github.com/SUSTechBruce/RL_CTR/tree/817398dc1c117e22f41281830ae3c33bba8062d3 |
NonLinearProbe4 | import torch
from torch import nn
class NonLinearProbe4(nn.Module):
def __init__(self, input_dim, num_hidden=300, num_classes=255):
super().__init__()
self.linear1 = nn.Linear(in_features=input_dim, out_features=num_hidden
)
self.relu1 = nn.ReLU()
self.linear2 = nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | PAL-ML/atari-representation-learning | NonLinearProbe4 | false | 2,790 | [
"MIT"
] | 0 | 11977da174d9ef74c0b2333322b9f0b28e15239e | https://github.com/PAL-ML/atari-representation-learning/tree/11977da174d9ef74c0b2333322b9f0b28e15239e |
MultiHeadAttention | import torch
import torch.nn.functional as F
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RogerTsai917/attention-is-all-you-need-pytorch | MultiHeadAttention | false | 2,791 | [
"MIT"
] | 0 | 64197e55d275e5c819bc786a9ff19849cdf2f6b9 | https://github.com/RogerTsai917/attention-is-all-you-need-pytorch/tree/64197e55d275e5c819bc786a9ff19849cdf2f6b9 |
EncoderLayer | import torch
import torch.nn.functional as F
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RogerTsai917/attention-is-all-you-need-pytorch | EncoderLayer | false | 2,792 | [
"MIT"
] | 0 | 64197e55d275e5c819bc786a9ff19849cdf2f6b9 | https://github.com/RogerTsai917/attention-is-all-you-need-pytorch/tree/64197e55d275e5c819bc786a9ff19849cdf2f6b9 |
ConvTemporalGraphical | import torch
import torch.nn as nn
class ConvTemporalGraphical(nn.Module):
"""The basic module for applying a graph convolution.
Args:
in_channels (int): Number of channels in the input sequence data
out_channels (int): Number of channels produced by the convolution
kernel_size (int):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | SKBL5694/guard | ConvTemporalGraphical | false | 2,793 | [
"BSD-2-Clause"
] | 0 | 55fa719197b08e11729a5dcc48418c49bd142f4a | https://github.com/SKBL5694/guard/tree/55fa719197b08e11729a5dcc48418c49bd142f4a |
Dice | import torch
import torch.nn as nn
class Dice(nn.Module):
def __init__(self):
super(Dice, self).__init__()
self.alpha = nn.Parameter(torch.zeros((1,)))
def forward(self, x):
avg = x.mean(dim=0)
std = x.std(dim=0)
norm_x = (x - avg) / std
p = torch.sigmoid(norm... | 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_... | SUSTechBruce/RL_CTR | Dice | false | 2,794 | [
"Apache-2.0"
] | 0 | 817398dc1c117e22f41281830ae3c33bba8062d3 | https://github.com/SUSTechBruce/RL_CTR/tree/817398dc1c117e22f41281830ae3c33bba8062d3 |
DecoderLayer | import torch
import torch.nn.functional as F
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RogerTsai917/attention-is-all-you-need-pytorch | DecoderLayer | false | 2,795 | [
"MIT"
] | 0 | 64197e55d275e5c819bc786a9ff19849cdf2f6b9 | https://github.com/RogerTsai917/attention-is-all-you-need-pytorch/tree/64197e55d275e5c819bc786a9ff19849cdf2f6b9 |
Classifier | import torch
from torch import nn
class Classifier(nn.Module):
def __init__(self, num_inputs1, num_inputs2):
super().__init__()
self.network = nn.Bilinear(num_inputs1, num_inputs2, 1)
def forward(self, x1, x2):
return self.network(x1, x2)
def get_inputs():
return [torch.rand([4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
reinterpret_tensor = torch._C._dynamo.guards._reinterpr... | PAL-ML/atari-representation-learning | Classifier | false | 2,796 | [
"MIT"
] | 0 | 11977da174d9ef74c0b2333322b9f0b28e15239e | https://github.com/PAL-ML/atari-representation-learning/tree/11977da174d9ef74c0b2333322b9f0b28e15239e |
NonLinearProbe2 | import torch
from torch import nn
class NonLinearProbe2(nn.Module):
def __init__(self, input_dim, num_hidden=300, num_classes=255):
super().__init__()
self.linear1 = nn.Linear(in_features=input_dim, out_features=num_hidden
)
self.relu = nn.ReLU()
self.linear2 = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | PAL-ML/atari-representation-learning | NonLinearProbe2 | false | 2,797 | [
"MIT"
] | 0 | 11977da174d9ef74c0b2333322b9f0b28e15239e | https://github.com/PAL-ML/atari-representation-learning/tree/11977da174d9ef74c0b2333322b9f0b28e15239e |
ABS_disc | import torch
import torch.nn as nn
class ABS_disc(nn.Module):
def __init__(self, weight_list=None):
super(ABS_disc, self).__init__()
self.weight_list = weight_list
def forward(self, x, labels):
loss = torch.abs(x - labels)
if self.weight_list is not None:
loss = 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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | Sampson-Lee/SIB-Net | ABS_disc | false | 2,798 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
ABS_cont | import torch
import torch.nn as nn
class ABS_cont(nn.Module):
def __init__(self, theta=1 / 10):
super(ABS_cont, self).__init__()
self.theta = theta
def forward(self, x, labels):
loss = torch.abs(x - labels)
mask = loss.gt(self.theta).float()
loss = loss * mask
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | Sampson-Lee/SIB-Net | ABS_cont | false | 2,799 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
ABS_disc_sm_v3 | import torch
import torch.nn as nn
class ABS_disc_sm_v3(nn.Module):
def __init__(self, weight_list=None, lb_sm=0.2):
super(ABS_disc_sm_v3, self).__init__()
self.weight_list = weight_list
self.lb_sm = lb_sm
def forward(self, x, labels):
assert (x >= 0).all() and (x <= 1).all()... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | Sampson-Lee/SIB-Net | ABS_disc_sm_v3 | false | 2,800 | [
"MIT"
] | 0 | 650399082e9237327fa38168ccfc7d48153a1db5 | https://github.com/Sampson-Lee/SIB-Net/tree/650399082e9237327fa38168ccfc7d48153a1db5 |
CpuEmbedding | import torch
import torch.nn as nn
class CpuEmbedding(nn.Module):
def __init__(self, num_embeddings, embed_dim):
super(CpuEmbedding, self).__init__()
self.weight = nn.Parameter(torch.zeros((num_embeddings, embed_dim)))
nn.init.xavier_uniform_(self.weight.data)
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | SUSTechBruce/RL_CTR | CpuEmbedding | false | 2,801 | [
"Apache-2.0"
] | 0 | 817398dc1c117e22f41281830ae3c33bba8062d3 | https://github.com/SUSTechBruce/RL_CTR/tree/817398dc1c117e22f41281830ae3c33bba8062d3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.