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 |
|---|---|---|---|---|---|---|---|---|---|---|
CriticNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class CriticNet(nn.Module):
"""Critic (Value estimator) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64,
fc2_units=64):
"""Initialize parameters and build model.
Params
======
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | danthe42/drlnd_p2 | CriticNet | false | 1,789 | [
"MIT"
] | 0 | 693813feb7c99f3e01da583e5b67e4f8904639c4 | https://github.com/danthe42/drlnd_p2/tree/693813feb7c99f3e01da583e5b67e4f8904639c4 |
SetConv | import torch
from torch.nn import functional as F
import torch.nn as nn
class SetConv(nn.Module):
def __init__(self, sample_feats, predicate_feats, join_feats, hid_units):
super(SetConv, self).__init__()
self.sample_mlp1 = nn.Linear(sample_feats, hid_units)
self.sample_mlp2 = nn.Linear(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
import torch.nn as nn
assert_... | danield137/deep_query_optimzation | SetConv | false | 1,790 | [
"MIT"
] | 0 | 01a25c966338007f15d14dea1b37e388e47bcfe3 | https://github.com/danield137/deep_query_optimzation/tree/01a25c966338007f15d14dea1b37e388e47bcfe3 |
SetConv | import torch
import torch.nn as nn
import torch.nn.functional as F
class SetConv(nn.Module):
def __init__(self, sample_feats, predicate_feats, predicate_uri_feats,
join_feats, hid_units):
super(SetConv, self).__init__()
self.sample_mlp1 = nn.Linear(sample_feats, hid_units)
self.sa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | dacasals/learnedcardinalities | SetConv | false | 1,791 | [
"MIT"
] | 0 | ee9741ce1a7b55ed18c33fbd6047484e50068037 | https://github.com/dacasals/learnedcardinalities/tree/ee9741ce1a7b55ed18c33fbd6047484e50068037 |
SoftArgmax2D | import torch
import torch.nn as nn
from typing import Optional
def create_meshgrid(x: 'torch.Tensor', normalized_coordinates: 'Optional[bool]'
) ->torch.Tensor:
assert len(x.shape) == 4, x.shape
_, _, height, width = x.shape
_device, _dtype = x.device, x.dtype
if normalized_coordinates:
xs... | 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
... | danyayay/ynet_adaptive | SoftArgmax2D | false | 1,792 | [
"MIT"
] | 0 | f1daea6f3d5ec8a7349c2ee72bf742df83786103 | https://github.com/danyayay/ynet_adaptive/tree/f1daea6f3d5ec8a7349c2ee72bf742df83786103 |
FilterNorm | import torch
import torch.nn as nn
from torch.nn.init import calculate_gain
class FilterNorm(nn.Module):
def __init__(self, in_channels, kernel_size, filter_type, nonlinearity=
'linear', running_std=False, running_mean=False):
assert filter_type in ('spatial', 'channel')
assert in_channel... | 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 torch.nn.init import calculate_gain
assert_size_stri... | danyayay/ynet_adaptive | FilterNorm | false | 1,793 | [
"MIT"
] | 0 | f1daea6f3d5ec8a7349c2ee72bf742df83786103 | https://github.com/danyayay/ynet_adaptive/tree/f1daea6f3d5ec8a7349c2ee72bf742df83786103 |
TorchFocalLoss | import torch
import torch.nn.functional as F
from torch import nn
class TorchFocalLoss(nn.Module):
"""Implementation of Focal Loss[1]_ modified from Catalyst [2]_ .
Arguments
---------
gamma : :class:`int` or :class:`float`
Focusing parameter. See [1]_ .
alpha : :class:`int` or :class:`fl... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | dannyjeck-matroid/solaris | TorchFocalLoss | false | 1,794 | [
"Apache-2.0"
] | 0 | 463d220c1fe14f811cbbbf528a7353022538006e | https://github.com/dannyjeck-matroid/solaris/tree/463d220c1fe14f811cbbbf528a7353022538006e |
Cauchy | import torch
import torch.nn as nn
import torch.utils.model_zoo
class Cauchy(nn.Module):
def __init__(self):
super(Cauchy, self).__init__()
self.c = 1.0
def forward(self, X, Y):
r = torch.add(X, -Y)
ra = torch.abs(r)
error = 0.5 * self.c ** 2 * torch.log(1 + (ra / sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | davefiorino/EDSR-PyTorch | Cauchy | false | 1,795 | [
"MIT"
] | 0 | 97ad32a09a71816a36c45d92cdb2ea7ab42ba685 | https://github.com/davefiorino/EDSR-PyTorch/tree/97ad32a09a71816a36c45d92cdb2ea7ab42ba685 |
Fair | import torch
import torch.nn as nn
import torch.utils.model_zoo
class Fair(nn.Module):
def __init__(self):
super(Fair, self).__init__()
self.c = 1.0
def forward(self, X, Y):
r = torch.add(X, -Y)
ra = torch.abs(r)
error = self.c ** 2 * (ra / self.c - torch.log(1 + ra /... | 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
... | davefiorino/EDSR-PyTorch | Fair | false | 1,796 | [
"MIT"
] | 0 | 97ad32a09a71816a36c45d92cdb2ea7ab42ba685 | https://github.com/davefiorino/EDSR-PyTorch/tree/97ad32a09a71816a36c45d92cdb2ea7ab42ba685 |
Charbonnier | import torch
import torch.nn as nn
import torch.utils.model_zoo
class Charbonnier(nn.Module):
def __init__(self):
super(Charbonnier, self).__init__()
self.eps = 1e-06
def forward(self, X, Y):
diff = torch.add(X, -Y)
error = torch.sqrt(diff * diff + self.eps)
loss = to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | davefiorino/EDSR-PyTorch | Charbonnier | false | 1,797 | [
"MIT"
] | 0 | 97ad32a09a71816a36c45d92cdb2ea7ab42ba685 | https://github.com/davefiorino/EDSR-PyTorch/tree/97ad32a09a71816a36c45d92cdb2ea7ab42ba685 |
Classifier | import torch
import torch.distributed
import torch
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, hidden_size):
super(Classifier, self).__init__()
self.linear1 = nn.Linear(hidden_size, 1)
self.sigmoid = nn.Sigmoid()
def forward(self, x, mask_cls):
h = s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.distributed
import torch
import torch.nn as nn
assert_size_stride =... | dat821168/PreSumm | Classifier | false | 1,798 | [
"MIT"
] | 0 | 3c84fc97f50a193a865ccef2300adf5683397539 | https://github.com/dat821168/PreSumm/tree/3c84fc97f50a193a865ccef2300adf5683397539 |
CustomBatchNormManualModule | import torch
import torch.nn as nn
class CustomBatchNormManualFunction(torch.autograd.Function):
"""
This torch.autograd.Function implements a functional custom version of the batch norm operation for MLPs.
Using torch.autograd.Function allows you to write a custom backward function.
The function will... | 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_... | davide-belli/deep-learning-labs | CustomBatchNormManualModule | false | 1,799 | [
"MIT"
] | 0 | 1acd37a527711dccdc00c1935724cc5de7c10955 | https://github.com/davide-belli/deep-learning-labs/tree/1acd37a527711dccdc00c1935724cc5de7c10955 |
Discriminator | import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self):
super(Discriminator, self).__init__()
self.linear1 = nn.Linear(784, 512)
self.lrelu2 = nn.LeakyReLU(0.2)
self.linear2 = nn.Linear(512, 256)
self.lrelu3 = nn.LeakyReLU(0.2)
self.l... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | davide-belli/deep-learning-labs | Discriminator | false | 1,800 | [
"MIT"
] | 0 | 1acd37a527711dccdc00c1935724cc5de7c10955 | https://github.com/davide-belli/deep-learning-labs/tree/1acd37a527711dccdc00c1935724cc5de7c10955 |
ConcatPool2d | import torch
import torch.nn as nn
class ConcatPool2d(nn.Module):
"""Layer that concats `AvgPool2d` and `MaxPool2d`"""
def __init__(self, ks, stride=None, padding=0):
super().__init__()
self.ap = nn.AvgPool2d(ks, stride, padding)
self.mp = nn.MaxPool2d(ks, stride, padding)
def fo... | 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... | davidleonfdez/face2anime | ConcatPool2d | false | 1,801 | [
"MIT"
] | 0 | 896bf85a7aa28322cc9e9e586685db8cbbf39d89 | https://github.com/davidleonfdez/face2anime/tree/896bf85a7aa28322cc9e9e586685db8cbbf39d89 |
CustomBatchNormAutograd | import torch
import torch.nn as nn
class CustomBatchNormAutograd(nn.Module):
"""
This nn.module implements a custom version of the batch norm operation for MLPs.
The operations called in self.forward track the history if the input tensors have the
flag requires_grad set to True. The backward pass does... | 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_... | davide-belli/deep-learning-labs | CustomBatchNormAutograd | false | 1,802 | [
"MIT"
] | 0 | 1acd37a527711dccdc00c1935724cc5de7c10955 | https://github.com/davide-belli/deep-learning-labs/tree/1acd37a527711dccdc00c1935724cc5de7c10955 |
PixelWise | import torch
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.init
class PixelWise(torch.nn.Module):
""" Implemented - https://arxiv.org/pdf/1710.10196.pdf """
def __init__(self, eps=1e-08):
super(PixelWise, self).__init__()
self.eps = eps
def forward(self, ten... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.ini... | davidwagnerkc/TensorMONK | PixelWise | false | 1,803 | [
"MIT"
] | 0 | 3607836d3d6bfd0994e044536b2a51bc84b35f31 | https://github.com/davidwagnerkc/TensorMONK/tree/3607836d3d6bfd0994e044536b2a51bc84b35f31 |
PositionwiseFeedForward | import math
import torch
import torch.distributed
import torch
import torch.nn as nn
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | dat821168/PreSumm | PositionwiseFeedForward | false | 1,804 | [
"MIT"
] | 0 | 3c84fc97f50a193a865ccef2300adf5683397539 | https://github.com/dat821168/PreSumm/tree/3c84fc97f50a193a865ccef2300adf5683397539 |
MiniBatchStdDev | import torch
import torch.nn as nn
class MiniBatchStdDev(nn.Module):
"""Layer that appends to every element of a batch a new ftr map containing the std of its group."""
def __init__(self, group_sz=4, unbiased_std=False):
super().__init__()
self.group_sz = group_sz
self.unbiased_std = ... | 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_... | davidleonfdez/face2anime | MiniBatchStdDev | false | 1,805 | [
"MIT"
] | 0 | 896bf85a7aa28322cc9e9e586685db8cbbf39d89 | https://github.com/davidleonfdez/face2anime/tree/896bf85a7aa28322cc9e9e586685db8cbbf39d89 |
MultiheadAttention | import math
import torch
import torch as th
import torch.nn as nn
class QKVMultiheadAttention(nn.Module):
def __init__(self, n_heads: 'int', n_ctx: 'int'):
super().__init__()
self.n_heads = n_heads
self.n_ctx = n_ctx
def forward(self, qkv):
bs, n_ctx, width = qkv.shape
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dashstander/glide-text2im | MultiheadAttention | false | 1,806 | [
"MIT"
] | 0 | 58f03a871ee0567e27fccc40df98203e675a9b8e | https://github.com/dashstander/glide-text2im/tree/58f03a871ee0567e27fccc40df98203e675a9b8e |
Q_Index | import torch
import torch.nn as nn
class Q_Index(nn.Module):
"""
Quality measurement between perturbated (image with applied noise) and denoised target image.
This module works only for images with a single color channel (grayscale)
"""
def __init__(self):
super().__init__()
def forw... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | dawnofthedebayan/MedAI_Project | Q_Index | false | 1,807 | [
"Apache-2.0"
] | 0 | a7f2597c96569662f1ca9d21ffd0eb41c77211c1 | https://github.com/dawnofthedebayan/MedAI_Project/tree/a7f2597c96569662f1ca9d21ffd0eb41c77211c1 |
myNet | import torch
import torch.nn as nn
class myNet(nn.Module):
def __init__(self, in_features, num_classes=10):
super(myNet, self).__init__()
self.fc1 = nn.Linear(in_features, 1000)
self.fc2 = nn.Linear(1000, 100)
self.fc3 = nn.Linear(100, num_classes)
self.relu = nn.ReLU()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | daxiongpro/pytorch-tutorial | myNet | false | 1,808 | [
"MIT"
] | 0 | abafc32f7ee1092024085f703e4ced51ce358a1b | https://github.com/daxiongpro/pytorch-tutorial/tree/abafc32f7ee1092024085f703e4ced51ce358a1b |
ConvolutionTranspose | import torch
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.init
import torch.nn as nn
import torch.nn.functional as F
def Normalizations(tensor_size=None, normalization=None, available=False,
**kwargs):
"""Does normalization on 4D tensor.
Args:
tensor_size: shape of ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | davidwagnerkc/TensorMONK | ConvolutionTranspose | false | 1,809 | [
"MIT"
] | 0 | 3607836d3d6bfd0994e044536b2a51bc84b35f31 | https://github.com/davidwagnerkc/TensorMONK/tree/3607836d3d6bfd0994e044536b2a51bc84b35f31 |
Conv2d | from torch.nn import Module
import math
import torch
from torch.nn.modules.utils import _pair
import torch.nn.functional as F
import torch.utils.data
from torch.nn.parameter import Parameter
from torch.nn.functional import pad
from torch.nn.modules import Module
def conv2d_same_padding(input, weight, bias=None, strid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torch.nn.modules.utils import _pair... | ddayzzz/mmdetection | Conv2d | false | 1,810 | [
"Apache-2.0"
] | 0 | b9940c56cc19b3dda7468a5fd858b9683e93a486 | https://github.com/ddayzzz/mmdetection/tree/b9940c56cc19b3dda7468a5fd858b9683e93a486 |
GeneralizedDiceLoss | import collections
import torch
import warnings
from typing import Optional
from typing import Union
from typing import Any
from typing import Callable
from typing import Tuple
import torch.nn
from torch.nn.modules.loss import _Loss
from enum import Enum
import collections.abc
def issequenceiterable(obj: 'Any') ->boo... | 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 collections
from typi... | danielschulz/MONAI | GeneralizedDiceLoss | false | 1,811 | [
"Apache-2.0"
] | 0 | 54ef6e9e700f0de3d50184c0148f953be871a58e | https://github.com/danielschulz/MONAI/tree/54ef6e9e700f0de3d50184c0148f953be871a58e |
AngularPenaltySMLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class AngularPenaltySMLoss(nn.Module):
def __init__(self, in_features, out_features, loss_type='arcface', eps=
1e-07, s=None, m=None):
"""
Angular Penalty Softmax Loss
Three 'loss_types' available: ['arcface', 'sp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dayoungMM/Angular-Penalty-Softmax-Losses-Pytorch | AngularPenaltySMLoss | false | 1,812 | [
"MIT"
] | 0 | 5599f2e280b2af8d40e53727290eb797d18e7239 | https://github.com/dayoungMM/Angular-Penalty-Softmax-Losses-Pytorch/tree/5599f2e280b2af8d40e53727290eb797d18e7239 |
ToSEG | from torch.autograd import Function
import math
import torch
import warnings
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.cpp_extension
def fused_leaky_relu(input, bias=None, negative_slope=0.2, scale=2 ** 0.5):
if input.device.type == 'cpu':
if bias is not N... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
import warnings
import numpy as ... | crobbins327/semanticGAN_WSI | ToSEG | false | 1,813 | [
"BSD-2-Clause",
"MIT"
] | 0 | 4046ddc822f463e03952402247f79d540bf7be95 | https://github.com/crobbins327/semanticGAN_WSI/tree/4046ddc822f463e03952402247f79d540bf7be95 |
ResidualAttentionBlock | import math
import torch
import torch as th
import torch.nn as nn
class LayerNorm(nn.LayerNorm):
"""
Implementation that supports fp16 inputs but fp32 gains/biases.
"""
def forward(self, x: 'th.Tensor'):
return super().forward(x.float())
class QKVMultiheadAttention(nn.Module):
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.... | dashstander/glide-text2im | ResidualAttentionBlock | false | 1,814 | [
"MIT"
] | 0 | 58f03a871ee0567e27fccc40df98203e675a9b8e | https://github.com/dashstander/glide-text2im/tree/58f03a871ee0567e27fccc40df98203e675a9b8e |
FilterResponseNorm_layer | import torch
import torch.nn as nn
class FilterResponseNorm_layer(nn.Module):
def __init__(self, num_filters, eps=1e-06):
super(FilterResponseNorm_layer, self).__init__()
self.eps = eps
par_shape = 1, num_filters, 1, 1
self.tau = torch.nn.Parameter(torch.zeros(par_shape))
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | deebuls/pytorch-cifar | FilterResponseNorm_layer | false | 1,815 | [
"MIT"
] | 0 | c6d9b16eeb00418d8c4f4f4c1e97f141c1f7d198 | https://github.com/deebuls/pytorch-cifar/tree/c6d9b16eeb00418d8c4f4f4c1e97f141c1f7d198 |
TSA_Fusion | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class TSA_Fusion(nn.Module):
""" Temporal Spatial Attention fusion module
Temporal: correlation;
Spatial: 3 pyramid levels.
"""
def __init__(self, nf=64, nframes=5, center=2):
super(TSA_Fusion, 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 torch.utils.data
impor... | creeper121386/EDVR-modified | TSA_Fusion | false | 1,816 | [
"Apache-2.0"
] | 0 | 3fa565b99811e8f84f6ea3793090614606382332 | https://github.com/creeper121386/EDVR-modified/tree/3fa565b99811e8f84f6ea3793090614606382332 |
ps_FNNDenoiser | from torch.nn import Module
import torch
from torch.nn import Linear
from torch.nn.init import xavier_normal_
from torch.nn.functional import relu
class ps_FNNDenoiser(Module):
def __init__(self, input_dim):
"""The FNN enc and FNN dec of the Denoiser.
:param input_dim: The input dimensionality.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
f... | ddcas/singing-language-identification | ps_FNNDenoiser | false | 1,817 | [
"MIT"
] | 0 | d104419b196d56d4de37cff47c32e88e28c58690 | https://github.com/ddcas/singing-language-identification/tree/d104419b196d56d4de37cff47c32e88e28c58690 |
RegularizedLinear | import torch
import torch.nn as nn
class RegularizedLinear(nn.Linear):
def __init__(self, *args, ar_weight=0.001, l1_weight=0.001, **kwargs):
super(RegularizedLinear, self).__init__(*args, **kwargs)
self.ar_weight = ar_weight
self.l1_weight = l1_weight
self._losses = {}
def f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dearkafka/inferno | RegularizedLinear | false | 1,818 | [
"Apache-2.0"
] | 0 | e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a | https://github.com/dearkafka/inferno/tree/e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a |
SorensenDiceLoss | import torch
import torch.nn as nn
from torch.autograd import Variable
def assert_(condition, message='', exception_type=AssertionError):
"""Like assert, but with arbitrary exception types."""
if not condition:
raise exception_type(message)
def flatten_samples(tensor_or_variable):
"""
Flatte... | 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... | dearkafka/inferno | SorensenDiceLoss | false | 1,819 | [
"Apache-2.0"
] | 0 | e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a | https://github.com/dearkafka/inferno/tree/e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a |
MTFullyConnected | import time
import torch
import numpy as np
from torch import nn
from torch import optim
from torch.nn import functional as F
class Base(nn.Module):
""" This class is the base structure for all of classification/regression DNN models.
Mainly, it provides the general methods for training, evaluating model and ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 time
import numpy as n... | cthoyt/DrugEx | MTFullyConnected | false | 1,820 | [
"MIT"
] | 0 | 9e4d31adb2c65d0afc852948f502c79dcf8308a3 | https://github.com/cthoyt/DrugEx/tree/9e4d31adb2c65d0afc852948f502c79dcf8308a3 |
Maxout | import torch
from torch import nn
class Maxout(nn.Module):
def __init__(self, pool_size):
super().__init__()
self._pool_size = pool_size
def forward(self, x):
assert x.shape[-1
] % self._pool_size == 0, 'Wrong input last dim size ({}) for Maxout({})'.format(
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | demdecuong/SEGMENT | Maxout | false | 1,821 | [
"MIT"
] | 0 | 629dc55dcbc9629b35fb237e313b95ceacecdc89 | https://github.com/demdecuong/SEGMENT/tree/629dc55dcbc9629b35fb237e313b95ceacecdc89 |
Debayer2x2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Debayer2x2(nn.Module):
"""Demosaicing of Bayer images using 2x2 convolutions.
Requires BG-Bayer color filter array layout. That is,
the image[1,1]='B', image[1,2]='G'.
"""
def __init__(self):
super(Debayer2x2, 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 torch.nn as nn
assert_... | delldu/ImageClean | Debayer2x2 | false | 1,822 | [
"MIT"
] | 0 | ffa5b180d36afb3840c6b36c08a767c520068498 | https://github.com/delldu/ImageClean/tree/ffa5b180d36afb3840c6b36c08a767c520068498 |
MuSigmaEncoder | import torch
from typing import Tuple
from torch import nn
class MuSigmaEncoder(nn.Module):
"""
Maps a representation r to mu and sigma which will define the normal
distribution from which we sample the latent variable z.
Parameters
----------
r_dim : int
Dimension of output representa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | deltaskelta/neural-processes | MuSigmaEncoder | false | 1,823 | [
"MIT"
] | 0 | 34a6b98b7a9142f5e5f87f7f1644217d5aa9e1bb | https://github.com/deltaskelta/neural-processes/tree/34a6b98b7a9142f5e5f87f7f1644217d5aa9e1bb |
fixed_loss | import torch
import torch.nn as nn
import torch.nn.functional as F
class fixed_loss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, out_image, gt_image, est_noise, gt_noise, if_asym):
h_x = est_noise.size()[2]
w_x = est_noise.size()[3]
count_h = self._ten... | 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
... | delldu/ImageClean | fixed_loss | false | 1,824 | [
"MIT"
] | 0 | ffa5b180d36afb3840c6b36c08a767c520068498 | https://github.com/delldu/ImageClean/tree/ffa5b180d36afb3840c6b36c08a767c520068498 |
Discriminator | import math
import torch
import torch.nn as nn
import torch.utils.data
def uniform(size, tensor):
stdv = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
class Discriminator(nn.Module):
def __init__(self, hidden_dim):
super(Discriminator, 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 math
import torch.nn as nn
import torch.utils.data
assert_size_stride = t... | dendisuhubdy/pytorch_geometric | Discriminator | false | 1,825 | [
"MIT"
] | 0 | a0592f61aef617c0c8ff61b3d822d04901054c22 | https://github.com/dendisuhubdy/pytorch_geometric/tree/a0592f61aef617c0c8ff61b3d822d04901054c22 |
STFullyConnected | import time
import torch
import numpy as np
from torch import nn
from torch import optim
from torch.nn import functional as F
class Base(nn.Module):
""" This class is the base structure for all of classification/regression DNN models.
Mainly, it provides the general methods for training, evaluating model and ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | cthoyt/DrugEx | STFullyConnected | false | 1,826 | [
"MIT"
] | 0 | 9e4d31adb2c65d0afc852948f502c79dcf8308a3 | https://github.com/cthoyt/DrugEx/tree/9e4d31adb2c65d0afc852948f502c79dcf8308a3 |
SoftDetectionModule | import torch
import torch.nn.functional as F
import torch.nn as nn
class SoftDetectionModule(nn.Module):
def __init__(self, soft_local_max_size=3):
super(SoftDetectionModule, self).__init__()
self.soft_local_max_size = soft_local_max_size
self.pad = self.soft_local_max_size // 2
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
... | deep-learning-20/d2-net | SoftDetectionModule | false | 1,827 | [
"BSD-3-Clause-Clear"
] | 0 | b092186353af23e9247c7f56ac2de3396b8c5a00 | https://github.com/deep-learning-20/d2-net/tree/b092186353af23e9247c7f56ac2de3396b8c5a00 |
AdaptiveAvgPool3dOutSize1 | import torch
import torch.nn as nn
import torch.utils.data
from abc import abstractmethod
from typing import Tuple
import torch.nn
class EfficientBlockBase(nn.Module):
"""
PyTorchVideo/accelerator provides a set of efficient blocks
that have optimal efficiency for each target hardware device.
Each ef... | 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
from abc import abstractmethod
from typing import Tuple
import torch.nn
assert_size_stride = t... | denred0/pytorchvideo | AdaptiveAvgPool3dOutSize1 | false | 1,828 | [
"Apache-2.0"
] | 0 | d874bfc9969895d2afcedea2e12bae5e1bcfb809 | https://github.com/denred0/pytorchvideo/tree/d874bfc9969895d2afcedea2e12bae5e1bcfb809 |
SELU | import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
def where(condition, if_true, if_false):
"""
Torch equivalent of numpy.where.
Parameters
----------
condition : torch.ByteTensor or torch.cuda.ByteTensor or torch.autograd.Variable
Condi... | 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 torch.autograd import Variable
import torch.nn.funct... | dearkafka/inferno | SELU | false | 1,829 | [
"Apache-2.0"
] | 0 | e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a | https://github.com/dearkafka/inferno/tree/e9e3b863fd1fc97cf94d08ac6b4f8df7665f996a |
BatchDHCN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
import torch.utils.data
import torch.optim
class BatchDHCN(nn.Module):
"""docstring for BatchDHCN"""
def __init__(self, embed_size=512, output_size=512, num_channel=2,
conv_size=3, batch_norm=True):
super(Ba... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | deeplearning2020/self | BatchDHCN | false | 1,830 | [
"MIT"
] | 0 | cf0e6f9acdcfe17906c6327042d25ac9c8894885 | https://github.com/deeplearning2020/self/tree/cf0e6f9acdcfe17906c6327042d25ac9c8894885 |
DenseSAGEConv | import math
import torch
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
def uniform(size, tensor):
stdv = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
class DenseSAGEConv(torch.nn.Module):
def __init__(self, in_channels, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dendisuhubdy/pytorch_geometric | DenseSAGEConv | false | 1,831 | [
"MIT"
] | 0 | a0592f61aef617c0c8ff61b3d822d04901054c22 | https://github.com/dendisuhubdy/pytorch_geometric/tree/a0592f61aef617c0c8ff61b3d822d04901054c22 |
MaskedMSE | import torch
import torch.nn as nn
class MaskedMSE(nn.Module):
def __init__(self):
super(MaskedMSE, self).__init__()
self.criterion = nn.MSELoss()
def forward(self, input, target, gamma=2.0):
mask = gamma * target / (target + 1e-07)
self.loss = self.criterion(input * mask, ta... | 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... | dhruvramani/AccentTransfer | MaskedMSE | false | 1,832 | [
"MIT"
] | 0 | 63a35b4aa37bc41c1f66dfb4bae76e2924183d7c | https://github.com/dhruvramani/AccentTransfer/tree/63a35b4aa37bc41c1f66dfb4bae76e2924183d7c |
adaILN | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class adaILN(nn.Module):
def __init__(self, num_features, eps=1e-05):
super(adaILN, self).__init__()
self.eps = eps
self.rho = Parameter(torch.Tensor(1, num_features, 1, 1))
self.rho.data.fill_(0.9)
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.triton_helpers import libdevice
import torch.nn as nn
from torch.nn.parameter import Parameter
assert_size_stri... | denny3388/Conditional-UGATIT | adaILN | false | 1,833 | [
"MIT"
] | 0 | 86ad35f05aaa105a814dec031d37370f44b71d5b | https://github.com/denny3388/Conditional-UGATIT/tree/86ad35f05aaa105a814dec031d37370f44b71d5b |
MaskedTemporalPooling | import torch
import torch.utils.data
from typing import Optional
import torch.nn
class MaskedTemporalPooling(torch.nn.Module):
"""
Applies temporal pooling operations on masked inputs. For each pooling operation
all masked values are ignored.
"""
def __init__(self, method: 'str'):
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch.nn
assert_size_stride = torch._C._dynamo.guards.asse... | denred0/pytorchvideo | MaskedTemporalPooling | false | 1,834 | [
"Apache-2.0"
] | 0 | d874bfc9969895d2afcedea2e12bae5e1bcfb809 | https://github.com/denred0/pytorchvideo/tree/d874bfc9969895d2afcedea2e12bae5e1bcfb809 |
TemporalConvNet | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
class Chomp1d(nn.Module):
def __init__(self, chomp_size):
super(Chomp1d, self).__init__()
self.chomp_size = chomp_size
def forward(self, x, pad_right=True):
return x[:, :, :-self.chomp_size].contiguous() if pad... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ddcas/singing-language-identification | TemporalConvNet | false | 1,835 | [
"MIT"
] | 0 | d104419b196d56d4de37cff47c32e88e28c58690 | https://github.com/ddcas/singing-language-identification/tree/d104419b196d56d4de37cff47c32e88e28c58690 |
NaiveTorchNet | import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.autograd
import torch.optim as optim
class NaiveTorchNet(nn.Module):
"""A reimplementation of from-scratch NaiveNet using PyTorch"""
def __init__(self, input_nodes, hidden_nodes, output_nodes, learn_rate=0.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.autograd import Variable
import torch.nn as nn
import torch.autograd
... | deo1/deo1 | NaiveTorchNet | false | 1,836 | [
"MIT"
] | 0 | 36671f12269d3bd662d746e8b9f66c22255c9df7 | https://github.com/deo1/deo1/tree/36671f12269d3bd662d746e8b9f66c22255c9df7 |
Attn | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attn(nn.Module):
def __init__(self, hidden_size, batch_size=1, method='dot'):
super(Attn, self).__init__()
self.method = method
self.hidden_size = hidden_size
self.batch_size = batch_size
if self.meth... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dhpollack/mgc | Attn | false | 1,837 | [
"MIT"
] | 0 | ed1b8fb512f0b42cb8121a2809def65f232dc154 | https://github.com/dhpollack/mgc/tree/ed1b8fb512f0b42cb8121a2809def65f232dc154 |
PositiveLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositiveLinear(nn.Linear):
"""Applies a transformation to the incoming data of the following form: :math:`y_i = xlog(exp(A)+1)^T`
where log and exp are elementwise operations.
Args:
in_features: size of each inpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | dfioravanti/copula_vae | PositiveLinear | false | 1,838 | [
"MIT"
] | 0 | 4fdadfb9ca65a75367d50df4a5848942de20741f | https://github.com/dfioravanti/copula_vae/tree/4fdadfb9ca65a75367d50df4a5848942de20741f |
PrimaryCaps | import torch
import torch.nn as nn
class PrimaryCaps(nn.Module):
"""
输入:(B,C,H,W)=(B,256,20,20)
输出:(B,C_N,C_L)=(B,32*6*6, 8)=(B,1152,8)
C_N:capsule_num,胶囊的个数
C_L:capsule_length,每个胶囊的长度
"""
def __init__(self, capsule_length=8, in_channels=256, out_channels=32,
capsu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | daxiongpro/pytorch-tutorial | PrimaryCaps | false | 1,839 | [
"MIT"
] | 0 | abafc32f7ee1092024085f703e4ced51ce358a1b | https://github.com/daxiongpro/pytorch-tutorial/tree/abafc32f7ee1092024085f703e4ced51ce358a1b |
LearnMaskedDefault | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn
class LearnMaskedDefault(nn.Module):
"""
Learns default values to fill invalid entries within input tensors. The
invalid entries are represented by a mask which is passed into forward alongside
the input tensor. Note the defaul... | 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.utils.data
import torch.nn
assert_size_stride = torch.... | denred0/pytorchvideo | LearnMaskedDefault | false | 1,840 | [
"Apache-2.0"
] | 0 | d874bfc9969895d2afcedea2e12bae5e1bcfb809 | https://github.com/denred0/pytorchvideo/tree/d874bfc9969895d2afcedea2e12bae5e1bcfb809 |
SynthWide | import torch
import torch.nn as nn
import torch.nn.functional as F
class SynthWide(nn.Module):
def __init__(self, num_c=10, f=1):
super(SynthWide, self).__init__()
self.pool = nn.MaxPool2d(2, 2)
self.conv1 = nn.Conv2d(3, 32 * f, 3, padding=1)
self.conv2 = nn.Conv2d(32 * f, 64 * f,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | dengliming/iotnets | SynthWide | false | 1,842 | [
"MIT"
] | 0 | db744e56769c799dbf765a27fc5aa91e3edeaaa3 | https://github.com/dengliming/iotnets/tree/db744e56769c799dbf765a27fc5aa91e3edeaaa3 |
TCN_SLID | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
class Chomp1d(nn.Module):
def __init__(self, chomp_size):
super(Chomp1d, self).__init__()
self.chomp_size = chomp_size
def forward(self, x, pad_right=True):
return x[:, :, :-self.chomp_size].contiguous() if pad... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ddcas/singing-language-identification | TCN_SLID | false | 1,843 | [
"MIT"
] | 0 | d104419b196d56d4de37cff47c32e88e28c58690 | https://github.com/ddcas/singing-language-identification/tree/d104419b196d56d4de37cff47c32e88e28c58690 |
HearthstoneNet | import torch
from torch import nn
import torch.nn.functional as F
class HearthstoneNet(nn.Module):
def __init__(self):
super(HearthstoneNet, self).__init__()
self.conv1 = nn.Conv2d(1, 64, kernel_size=(3, 3), padding=1)
self.conv2 = nn.Conv2d(64, 64, kernel_size=(3, 3), padding=1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dianarvp/stone_ground_hearth_battles | HearthstoneNet | false | 1,844 | [
"Apache-2.0"
] | 0 | 450e70eaef21b543be579a6d696676fb148a99b0 | https://github.com/dianarvp/stone_ground_hearth_battles/tree/450e70eaef21b543be579a6d696676fb148a99b0 |
AttnBertPooler | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class AttnBertPooler(nn.Module):
def __init__(self, config):
super(AttnBertPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size * 2, config.hidden_size * 2)
self.activation = nn.Tanh(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | AnonymousAuthor2013/PostRec | AttnBertPooler | false | 1,845 | [
"MIT"
] | 0 | a1461f716d177e28b96ca29d1398f96b5717c1e1 | https://github.com/AnonymousAuthor2013/PostRec/tree/a1461f716d177e28b96ca29d1398f96b5717c1e1 |
TestNet | import torch
import torch.nn as nn
class ScaleLayer(nn.Module):
def __init__(self, init_value=0.001):
super().__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
return input * self.scale
class TestNet(nn.Module):
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | dizzyvn/torch-tcav | TestNet | false | 1,846 | [
"Apache-2.0"
] | 0 | c9795e817d1104923ef7422f5575607e6b835abc | https://github.com/dizzyvn/torch-tcav/tree/c9795e817d1104923ef7422f5575607e6b835abc |
BertPooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class BertPooler(nn.Module):
def __init__(self, config):
super(BertPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, 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.triton_helpers import libdevice
import torch.nn as ... | Andr3wis2Cool4School/AI-pro | BertPooler | false | 1,847 | [
"MIT"
] | 0 | dfe5f5959bc187d899a86f13b84158c66f64d1cc | https://github.com/Andr3wis2Cool4School/AI-pro/tree/dfe5f5959bc187d899a86f13b84158c66f64d1cc |
BatchNorm | import torch
import numpy as np
from torch import tensor
import torch.nn as nn
import numpy.random as rng
class BaseFlow(nn.Module):
""" """
def __init__(self, n_inputs, **kwargs):
super(BaseFlow, self).__init__()
self.n_inputs = n_inputs
def forward(self, x, **kwargs):
raise Not... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import numpy as np
from torch import tensor
import torch.nn as... | dlvp/madminer | BatchNorm | false | 1,848 | [
"MIT"
] | 0 | 4ae7d9b73452848a6c9d1b81b50ef316ff7a054f | https://github.com/dlvp/madminer/tree/4ae7d9b73452848a6c9d1b81b50ef316ff7a054f |
Critic | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, num_inputs, args):
super(Critic, self).__init__()
self.fc1 = nn.Linear(num_inputs, args.hidden_size)
self.fc2 = nn.Linear(args.hidde... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | dlrudco/pg_travel | Critic | false | 1,849 | [
"MIT"
] | 0 | 33733b624894095096af8201f7597c3244d3480d | https://github.com/dlrudco/pg_travel/tree/33733b624894095096af8201f7597c3244d3480d |
MetapathAggrLayer | import torch
from torch.nn import functional as F
from torch import nn
class MetapathAggrLayer(nn.Module):
"""
metapath attention layer.
"""
def __init__(self, in_features, nmeta, dropout, alpha):
super(MetapathAggrLayer, self).__init__()
self.dropout = dropout
self.in_feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dingdanhao110/HINGCN | MetapathAggrLayer | false | 1,850 | [
"MIT"
] | 0 | 281b73c03bd3b00e35bce4c5e1c27076233555e4 | https://github.com/dingdanhao110/HINGCN/tree/281b73c03bd3b00e35bce4c5e1c27076233555e4 |
SoftDiceLossSquared | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class SoftDiceLossSquared(nn.Module):
def __init__(self, apply_nonlin=None, batch_dice=False, do_bg=True,
smooth=1.0):
"""
squares the terms in the denominator as proposed by Milletari et al.
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch._C
import torch.serialization
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | dkswxd/Swin-Transformer-Semantic-Segmentation | SoftDiceLossSquared | false | 1,851 | [
"Apache-2.0"
] | 0 | 6af19736e5492a01d8952d4ee86a6d59b21c2ae1 | https://github.com/dkswxd/Swin-Transformer-Semantic-Segmentation/tree/6af19736e5492a01d8952d4ee86a6d59b21c2ae1 |
CBDNet | import torch
import torch.nn as nn
class CBDNet(nn.Module):
def __init__(self):
super(CBDNet, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.E01 = nn.Conv2d(3, 32, kernel_size=[3, 3], stride=(1, 1),
padding=(1, 1))
self.E02 = nn.Conv2d(32, 32, kernel_size=[3, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | delldu/ImageClean | CBDNet | false | 1,852 | [
"MIT"
] | 0 | ffa5b180d36afb3840c6b36c08a767c520068498 | https://github.com/delldu/ImageClean/tree/ffa5b180d36afb3840c6b36c08a767c520068498 |
LinearThreeDeep | import torch
import torch.nn as nn
import torch.nn.functional as F
class LinearThreeDeep(nn.Module):
def __init__(self, inputSize, hiddenSize1, hiddenSize2, hiddenSize3,
outputSize):
super().__init__()
self.inputLinear = nn.Linear(inputSize, hiddenSize1)
self.hiddenLinear1 = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dmechea/PyTorch-CartPole | LinearThreeDeep | false | 1,853 | [
"MIT"
] | 0 | 9f49ac7b2ae59882e5ea66cc8f43f0354a120c49 | https://github.com/dmechea/PyTorch-CartPole/tree/9f49ac7b2ae59882e5ea66cc8f43f0354a120c49 |
SoftDiceLoss | import torch
import torch.nn as nn
import torch._C
import torch.serialization
def get_tp_fp_fn_tn(net_output, gt, axes=None, mask=None, square=False):
"""
net_output must be (b, c, x, y(, z)))
gt must be a label map (shape (b, 1, x, y(, z)) OR shape (b, x, y(, z))) or one hot encoding (b, c, x, y(, z))
... | 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... | dkswxd/Swin-Transformer-Semantic-Segmentation | SoftDiceLoss | false | 1,855 | [
"Apache-2.0"
] | 0 | 6af19736e5492a01d8952d4ee86a6d59b21c2ae1 | https://github.com/dkswxd/Swin-Transformer-Semantic-Segmentation/tree/6af19736e5492a01d8952d4ee86a6d59b21c2ae1 |
GCNLayer | import torch
import torch.nn as nn
class GCNLayer(nn.Module):
def __init__(self, c_in, c_out):
super().__init__()
self.projection = nn.Linear(c_in, c_out)
def forward(self, nodes_feats, adj_matrix):
num_neighbors = adj_matrix.sum(dim=-1, keepdims=True)
node_feats = self.proje... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | dogeplusplus/sandbox | GCNLayer | false | 1,856 | [
"MIT"
] | 0 | c9041c06da9454f6c3cec622abbbf918c9f13bdc | https://github.com/dogeplusplus/sandbox/tree/c9041c06da9454f6c3cec622abbbf918c9f13bdc |
DilateConv | import torch
import torch.nn as nn
class DilateConv(nn.Module):
"""
d_rate: dilation rate
H_{out} = floor((H_{in} + 2 * padding[0] - dilation[0] * (kernel\\_size[0] - 1) - 1) / stride[0] + 1)
set kernel size to 3, stride to 1, padding==d_rate ==> spatial size kept
"""
def __init__(self, d_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | donghaW/RCF-pytorch | DilateConv | false | 1,857 | [
"MIT"
] | 0 | 6380209ef747abefa87637e60d33369ba423814d | https://github.com/donghaW/RCF-pytorch/tree/6380209ef747abefa87637e60d33369ba423814d |
GDL | import torch
import torch.nn as nn
import torch._C
import torch.serialization
def get_tp_fp_fn_tn(net_output, gt, axes=None, mask=None, square=False):
"""
net_output must be (b, c, x, y(, z)))
gt must be a label map (shape (b, 1, x, y(, z)) OR shape (b, x, y(, z))) or one hot encoding (b, c, x, y(, z))
... | 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... | dkswxd/Swin-Transformer-Semantic-Segmentation | GDL | false | 1,858 | [
"Apache-2.0"
] | 0 | 6af19736e5492a01d8952d4ee86a6d59b21c2ae1 | https://github.com/dkswxd/Swin-Transformer-Semantic-Segmentation/tree/6af19736e5492a01d8952d4ee86a6d59b21c2ae1 |
ImageCleanModel | import torch
import torch.nn as nn
class ImageCleanModel(nn.Module):
"""ImageClean Model."""
def __init__(self):
"""Init model."""
super(ImageCleanModel, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.E01 = nn.Conv2d(3, 32, kernel_size=[3, 3], stride=(1, 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_... | delldu/ImageClean | ImageCleanModel | false | 1,859 | [
"MIT"
] | 0 | ffa5b180d36afb3840c6b36c08a767c520068498 | https://github.com/delldu/ImageClean/tree/ffa5b180d36afb3840c6b36c08a767c520068498 |
NeuralGasEnergy | import torch
class NeuralGasEnergy(torch.nn.Module):
def __init__(self, lm):
super().__init__()
self.lm = lm
def forward(self, d):
order = torch.argsort(d, dim=1)
ranks = torch.argsort(order, dim=1)
cost = torch.sum(self._nghood_fn(ranks, self.lm) * d)
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
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | dmoebius-dm/prototorch | NeuralGasEnergy | false | 1,860 | [
"MIT"
] | 0 | 088429a16a820f31367bb7b780dce0e368633fb2 | https://github.com/dmoebius-dm/prototorch/tree/088429a16a820f31367bb7b780dce0e368633fb2 |
PatchEmbed | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
class PatchEmbed(nn.Module):
""" Image to Patch Embedding
Args:
patch_size (tuple[int]): Patch token size. Default: (4, 4, 4).
in_chans (int): Number of input image channels. Default:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | dkswxd/Swin-Transformer-Semantic-Segmentation | PatchEmbed | false | 1,861 | [
"Apache-2.0"
] | 0 | 6af19736e5492a01d8952d4ee86a6d59b21c2ae1 | https://github.com/dkswxd/Swin-Transformer-Semantic-Segmentation/tree/6af19736e5492a01d8952d4ee86a6d59b21c2ae1 |
MNISTmodel | import torch
import torch.nn.functional as F
import torch.nn as nn
class Evidential_layer(nn.Module):
def __init__(self, in_dim, num_classes):
super(Evidential_layer, self).__init__()
self.num_classes = num_classes
self.fc1 = nn.Linear(in_dim, 2 * self.num_classes)
self.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
import torch.nn as nn
assert_... | caisr-hh/DEED | MNISTmodel | false | 1,862 | [
"MIT"
] | 0 | 2a9edb1df31d99c1e8da177dec696d7c90c2e7de | https://github.com/caisr-hh/DEED/tree/2a9edb1df31d99c1e8da177dec696d7c90c2e7de |
AngularLoss | import math
import torch
import torch.nn as nn
def calc_angular_difference(a1, a2):
distance = torch.min(torch.abs(a1 - a2), torch.tensor(2 * math.pi) -
torch.abs(a2 - a1))
diff = torch.sqrt(torch.abs(distance * distance))
return diff
class AngularLoss(nn.Module):
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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import math... | donikv/rgn_pytorch | AngularLoss | false | 1,863 | [
"MIT"
] | 0 | 95f8cd36fec5655f9bfd8634fff89b06e81dc2ed | https://github.com/donikv/rgn_pytorch/tree/95f8cd36fec5655f9bfd8634fff89b06e81dc2ed |
SelfAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class SelfAttention(nn.Module):
def __init__(self, k, heads=8):
super().__init__()
self.k = k
self.heads = heads
self.to_keys = nn.Linear(k, k * heads, bias=False)
self.to_queries = nn.Linear(k, k * heads, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dogeplusplus/sandbox | SelfAttention | false | 1,864 | [
"MIT"
] | 0 | c9041c06da9454f6c3cec622abbbf918c9f13bdc | https://github.com/dogeplusplus/sandbox/tree/c9041c06da9454f6c3cec622abbbf918c9f13bdc |
GlobalWeightedAvgPool2d | import torch
import torch.nn as nn
import torch.nn.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
def import_flatten_impl():
global flatten_impl, unflatten_impl, imported_flatten_impl
try:
flatten_impl = apex_C.flatten
unflatt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | dong03/dfdc_deepfake_challenge | GlobalWeightedAvgPool2d | false | 1,865 | [
"MIT"
] | 0 | bee310d0e4f1f6c9bd8ec7c0c97a98b52667673d | https://github.com/dong03/dfdc_deepfake_challenge/tree/bee310d0e4f1f6c9bd8ec7c0c97a98b52667673d |
BertTextPooler | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class BertTextPooler(nn.Module):
def __init__(self, config):
super(BertTextPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.bi_hidden_size)
self.activation = nn.ReLU()
def forwar... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | eaidova/lxmert | BertTextPooler | false | 1,866 | [
"MIT"
] | 0 | c74616907125242112c6ee5c516b54c250168e8b | https://github.com/eaidova/lxmert/tree/c74616907125242112c6ee5c516b54c250168e8b |
HeatmapLoss | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
import torch.multiprocessing
class HeatmapLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred, gt, mask):
assert pred.size() =... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
import torch.m... | ducongju/Scale-sensitive-Heatmap | HeatmapLoss | false | 1,867 | [
"MIT"
] | 0 | 4016610ba96a6a6645895bbf4bcdb3ff4690a2d8 | https://github.com/ducongju/Scale-sensitive-Heatmap/tree/4016610ba96a6a6645895bbf4bcdb3ff4690a2d8 |
FocalL2Loss | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
import torch.multiprocessing
class FocalL2Loss(nn.Module):
"""
Compute focal l2 loss between predict and groundtruth
:param thre: the threshold to distinguish between ... | 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.utils.data
import torch.nn.parallel
im... | ducongju/Scale-sensitive-Heatmap | FocalL2Loss | false | 1,868 | [
"MIT"
] | 0 | 4016610ba96a6a6645895bbf4bcdb3ff4690a2d8 | https://github.com/ducongju/Scale-sensitive-Heatmap/tree/4016610ba96a6a6645895bbf4bcdb3ff4690a2d8 |
PermEqui2_mean | import torch
from torch import nn
class PermEqui2_mean(nn.Module):
def __init__(self, in_dim, out_dim):
super().__init__()
self.Gamma = nn.Linear(in_dim, out_dim)
self.Lambda = nn.Linear(in_dim, out_dim, bias=False)
self.weight = self.Gamma.weight
self.bias = self.Gamma.bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | dvirsamuel/CrowdDet | PermEqui2_mean | false | 1,869 | [
"MIT"
] | 0 | db729bf71c0ca72229e5d446019769e095fdaa79 | https://github.com/dvirsamuel/CrowdDet/tree/db729bf71c0ca72229e5d446019769e095fdaa79 |
CNN | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
class CNN(nn.Module):
"""Convolutional Neural Network"""
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(1, 16, 8, 4)
self.conv2 = nn.Conv2d(16, 32, 4, 4)
self.fc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | dziganto/DQN | CNN | false | 1,870 | [
"MIT"
] | 0 | 033de76a2295ddc5d9775cfd2612a9d79634547e | https://github.com/dziganto/DQN/tree/033de76a2295ddc5d9775cfd2612a9d79634547e |
Wav2Vec2ClassificationHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class Wav2Vec2ClassificationHead(nn.Module):
"""Head for wav2vec classification task."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Ayushk4/MedImaging | Wav2Vec2ClassificationHead | false | 1,871 | [
"MIT"
] | 0 | dbc8968f076385be0c8db42210817ae0940fa26a | https://github.com/Ayushk4/MedImaging/tree/dbc8968f076385be0c8db42210817ae0940fa26a |
TransposeMultiheadAttention | import torch
import torch.nn as nn
import torch.utils.data
from typing import Optional
import torch.nn
class TransposeMultiheadAttention(nn.Module):
"""
Wrapper for nn.MultiheadAttention which first transposes the input tensor
from (batch_size, seq_len, feature_dim) to (seq_length, batch_size, feature_dim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | denred0/pytorchvideo | TransposeMultiheadAttention | false | 1,872 | [
"Apache-2.0"
] | 0 | d874bfc9969895d2afcedea2e12bae5e1bcfb809 | https://github.com/denred0/pytorchvideo/tree/d874bfc9969895d2afcedea2e12bae5e1bcfb809 |
SynthWide256 | import torch
import torch.nn as nn
import torch.nn.functional as F
class SynthWide256(nn.Module):
def __init__(self, num_c=10, f=1):
super(SynthWide256, self).__init__()
self.pool = nn.MaxPool2d(2, 2)
self.conv1 = nn.Conv2d(3, 32 * f, 3, padding=1)
self.conv2 = nn.Conv2d(32 * f, 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_... | dengliming/iotnets | SynthWide256 | false | 1,873 | [
"MIT"
] | 0 | db744e56769c799dbf765a27fc5aa91e3edeaaa3 | https://github.com/dengliming/iotnets/tree/db744e56769c799dbf765a27fc5aa91e3edeaaa3 |
CNNCifar | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as F
from torch import nn
class CNNCifar(nn.Module):
def __init__(self, args):
super(CNNCifar, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | FANJIYU0825/federated-learning | CNNCifar | false | 1,874 | [
"MIT"
] | 0 | 5772ca0a321a222eae5d5e29b70fb4a468c28374 | https://github.com/FANJIYU0825/federated-learning/tree/5772ca0a321a222eae5d5e29b70fb4a468c28374 |
TransformerEncoderLayer | import math
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.model_zoo
def _get_activation_fn(activation):
"""Return an activation function given a string"""
if activation == 'relu':
return F.relu
if activation == 'gelu':
return F.gelu
if activation ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dongyan007/Pretrained-IPT-main-master | TransformerEncoderLayer | false | 1,875 | [
"Apache-2.0"
] | 0 | 7ed47002373e11bd57b7904f6935acdfba1e44ff | https://github.com/dongyan007/Pretrained-IPT-main-master/tree/7ed47002373e11bd57b7904f6935acdfba1e44ff |
BertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.onnx
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Alwaysproblem/examples-1 | BertOutput | false | 1,876 | [
"MIT"
] | 0 | 9754fa63ed1931489a21ac1f5b299f945e369a5c | https://github.com/Alwaysproblem/examples-1/tree/9754fa63ed1931489a21ac1f5b299f945e369a5c |
L1DistanceLoss | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class L1DistanceLoss(nn.Module):
"""Custom L1 loss for distance matrices."""
def __init__(self, args):
super(L1DistanceLoss, self).__init__()
self.args = args
self.word_pair_dims = 1, 2
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | AnReu/structural-probes | L1DistanceLoss | false | 1,877 | [
"Apache-2.0"
] | 0 | fdc99dc124fa6df3dbdd5ba48a90f08bb6bf37b7 | https://github.com/AnReu/structural-probes/tree/fdc99dc124fa6df3dbdd5ba48a90f08bb6bf37b7 |
MultiHeadAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
def forward(self, query, key, value, mask=None):
dk = query.size()[-1]
scores = query.matmul(key.transpose(-2, -1)) / math.sqrt(dk)
if mask is not None:
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.... | dukeNashor/CaptainStony | MultiHeadAttention | false | 1,878 | [
"MIT"
] | 0 | 6320a27420e686666a4d7172437cf55fe42de2b6 | https://github.com/dukeNashor/CaptainStony/tree/6320a27420e686666a4d7172437cf55fe42de2b6 |
CRF | import torch
from torch import nn
class CRF(nn.Module):
def __init__(self, num_nodes, iteration=10):
"""Initialize the CRF module
Args:
num_nodes: int, number of nodes/patches within the fully CRF
iteration: int, number of mean field iterations, e.g. 10
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | dradientgescent/NCRF | CRF | false | 1,879 | [
"Apache-2.0"
] | 0 | 21e95c0e0f965de2b1daa2d446306052b3703b6a | https://github.com/dradientgescent/NCRF/tree/21e95c0e0f965de2b1daa2d446306052b3703b6a |
L1DepthLoss | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class L1DepthLoss(nn.Module):
"""Custom L1 loss for depth sequences."""
def __init__(self, args):
super(L1DepthLoss, self).__init__()
self.args = args
self.word_dim = 1
def forward(self, predictions,... | 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... | AnReu/structural-probes | L1DepthLoss | false | 1,880 | [
"Apache-2.0"
] | 0 | fdc99dc124fa6df3dbdd5ba48a90f08bb6bf37b7 | https://github.com/AnReu/structural-probes/tree/fdc99dc124fa6df3dbdd5ba48a90f08bb6bf37b7 |
CriticNetwork | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch as T
class CriticNetwork(nn.Module):
def __init__(self, beta, input_dims, fc1_dims, fc2_dims, n_actions, name):
super(CriticNetwork, self).__init__()
self.input_dims = 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
import numpy as np
import tor... | Yang2581/Behavioral-Cloning | CriticNetwork | false | 1,881 | [
"MIT"
] | 0 | 426e68a639e3e341f5547cfe40fb03ed8e87f3c8 | https://github.com/Yang2581/Behavioral-Cloning/tree/426e68a639e3e341f5547cfe40fb03ed8e87f3c8 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.device = torch.device('cuda' if torch.cuda.is_available() else
'cpu')
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | The-very-most-awesome-team-of-cool-kids/02463_Active_Learning | Net | false | 1,882 | [
"MIT"
] | 0 | abc35a31996de1c2e3275cf946b6a44f62abb781 | https://github.com/The-very-most-awesome-team-of-cool-kids/02463_Active_Learning/tree/abc35a31996de1c2e3275cf946b6a44f62abb781 |
BertOutput | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.checkpoint
class BertOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | MikeWangWZHL/BLIP | BertOutput | false | 1,883 | [
"BSD-3-Clause"
] | 0 | b82134f1892a54c8f63b0f4b51bdcb8684e1dc6d | https://github.com/MikeWangWZHL/BLIP/tree/b82134f1892a54c8f63b0f4b51bdcb8684e1dc6d |
PixelNorm | import torch
import torch.nn as nn
import torch.utils.cpp_extension
def pixel_norm(x, eps=1e-06):
"""Pixel Normalization.
This normalization is proposed in:
Progressive Growing of GANs for Improved Quality, Stability, and Variation
Args:
x (torch.Tensor): Tensor to be normalized.
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
import torch.nn as nn
import torch.utils.cpp_extension
assert_size_stride = tor... | bladesaber/mmgeneration | PixelNorm | false | 1,884 | [
"Apache-2.0"
] | 0 | 158b49f7efd8028f231f6e9ca758ae0e20dd72ae | https://github.com/bladesaber/mmgeneration/tree/158b49f7efd8028f231f6e9ca758ae0e20dd72ae |
EncoderBlock | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
def forward(self, query, key, value, mask=None):
dk = query.size()[-1]
scores = query.matmul(key.transpose(-2, -1)) / math.sqrt(dk)
if mask is not None:
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.... | dukeNashor/CaptainStony | EncoderBlock | false | 1,885 | [
"MIT"
] | 0 | 6320a27420e686666a4d7172437cf55fe42de2b6 | https://github.com/dukeNashor/CaptainStony/tree/6320a27420e686666a4d7172437cf55fe42de2b6 |
RobertaClassificationHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.data
import torch.nn
class RobertaClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super(RobertaClassificationHead, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | HeartForNlp/VL-BERT | RobertaClassificationHead | false | 1,886 | [
"MIT"
] | 0 | c1a590e2597b592629329db126cf8eae74b49cc0 | https://github.com/HeartForNlp/VL-BERT/tree/c1a590e2597b592629329db126cf8eae74b49cc0 |
CrossEntropyLoss | import torch
import torch.utils.cpp_extension
class CrossEntropyLoss(torch.nn.Module):
def __init__(self):
super(CrossEntropyLoss, self).__init__()
self.ce_loss = torch.nn.CrossEntropyLoss()
def forward(self, cls_output, label, **_):
return self.ce_loss(cls_output, label).mean()
de... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.cpp... | ParthaEth/PyTorch-StudioGAN | CrossEntropyLoss | false | 1,887 | [
"MIT"
] | 0 | 16dd84415e4b7f4667cb1b1e0ef3fc04edf6b5a9 | https://github.com/ParthaEth/PyTorch-StudioGAN/tree/16dd84415e4b7f4667cb1b1e0ef3fc04edf6b5a9 |
BertSelfOutput | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.checkpoint
class BertSelfOutput(nn.Module):
def __init__(self, config, twin=False, merge=False):
super().__init__()
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.
layer_n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | MikeWangWZHL/BLIP | BertSelfOutput | false | 1,888 | [
"BSD-3-Clause"
] | 0 | b82134f1892a54c8f63b0f4b51bdcb8684e1dc6d | https://github.com/MikeWangWZHL/BLIP/tree/b82134f1892a54c8f63b0f4b51bdcb8684e1dc6d |
TransformerDecoderLayer | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.model_zoo
def _get_activation_fn(activation):
"""Return an activation function given a string"""
if activation == 'relu':
return F.relu
if activation == 'gelu':
return F.gelu
if activation == 'glu':
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dongyan007/Pretrained-IPT-main-master | TransformerDecoderLayer | false | 1,889 | [
"Apache-2.0"
] | 0 | 7ed47002373e11bd57b7904f6935acdfba1e44ff | https://github.com/dongyan007/Pretrained-IPT-main-master/tree/7ed47002373e11bd57b7904f6935acdfba1e44ff |
Sampling | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class Sampling(nn.Module):
def __init__(self, args, seq_len):
super(Sampling, self).__init__()
self.conv = nn.Conv1d(seq_len, args.att_out_channel, kernel_size=1)
def forward(self, x):
"""
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | ICLab4DL/AWN | Sampling | false | 1,890 | [
"MIT"
] | 0 | 48d6edd85eabd77e9bb410dc5f31f8f937c9a857 | https://github.com/ICLab4DL/AWN/tree/48d6edd85eabd77e9bb410dc5f31f8f937c9a857 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.