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 |
|---|---|---|---|---|---|---|---|---|---|---|
BayesConv2d | from torch.nn import Module
import math
import torch
from torch.nn import Parameter
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
class _BayesConvNd(Module):
"""
Applies Bayesian Convolution
Arguments:
prior_mu (Float): mean of prior normal distribution.
prior_s... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math... | anaplasia29/Bayesian-Neural-Network | BayesConv2d | false | 3,110 | [
"MIT"
] | 0 | d98df8039e52cd2505dc8a94ed3cd474c2056d9a | https://github.com/anaplasia29/Bayesian-Neural-Network/tree/d98df8039e52cd2505dc8a94ed3cd474c2056d9a |
QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class QNetwork(nn.Module):
"""Actor (Policy) Model. Deep Net function approximator for q(s,a)"""
def __init__(self, state_size, action_size, seed):
"""Initialize parameters and build model.
Parameters:
==========
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | andreaspts/DRL_LUNAR_LANDER | QNetwork | false | 3,111 | [
"MIT"
] | 0 | 61f19b294ba7ed069795c70a3ceca4d9f7ff8a66 | https://github.com/andreaspts/DRL_LUNAR_LANDER/tree/61f19b294ba7ed069795c70a3ceca4d9f7ff8a66 |
PreNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim.optimizer
class PreNet(nn.Module):
def __init__(self, in_dims, fc1_dims=256, fc2_dims=128, dropout=0.5):
super().__init__()
self.fc1 = nn.Linear(in_dims, fc1_dims)
self.fc2 = nn.Linear(fc1_dims, fc2_dims... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | anh/ForwardTacotron | PreNet | false | 3,112 | [
"MIT"
] | 0 | a58d9244844b4512f5655e154f08f934760c88b3 | https://github.com/anh/ForwardTacotron/tree/a58d9244844b4512f5655e154f08f934760c88b3 |
RNN | import torch
import torch.nn as nn
class RNN(nn.Module):
def __init__(self, input_size: 'int', hidden_size: 'int', output_size:
'int'):
super(RNN, self).__init__()
self.hidden_size = hidden_size
self.i2h = nn.Linear(input_size + hidden_size, hidden_size)
self.i2o = 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._inductor.runtime.... | alimpk/names-classify | RNN | false | 3,113 | [
"MIT"
] | 0 | cfaff60cae504a8deceaa5b8641cbd9fc50ce705 | https://github.com/alimpk/names-classify/tree/cfaff60cae504a8deceaa5b8641cbd9fc50ce705 |
RewardCriterion | import torch
import torch.nn as nn
from torch.autograd import *
def to_contiguous(tensor):
if tensor.is_contiguous():
return tensor
else:
return tensor.contiguous()
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | anonymous2021hello/transformer-cil | RewardCriterion | false | 3,114 | [
"MIT"
] | 0 | aed4017b61afaf4d9d21d40a078eefb4c7031cd1 | https://github.com/anonymous2021hello/transformer-cil/tree/aed4017b61afaf4d9d21d40a078eefb4c7031cd1 |
PatchEmbedding | import torch
import torch.nn as nn
class PatchEmbedding(nn.Module):
"""PatchEmdedding class
Args:
image_size(int): size of the image. assume that image shape is square
in_channels(int): input channel of the image, 3 for RGB color channel
embed_size(int): output channel size. This is th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | aiwizzard/vision-transformer | PatchEmbedding | false | 3,115 | [
"Apache-2.0"
] | 0 | f9dd2f720a595f02543aa9720204d8f8c6f58193 | https://github.com/aiwizzard/vision-transformer/tree/f9dd2f720a595f02543aa9720204d8f8c6f58193 |
RnLU | import math
import torch
import torch.nn as nn
from torch.autograd.function import InplaceFunction
import torch.nn.parallel
import torch.utils.data
def birelu(x, inplace=False):
return BiReLUFunction().apply(x, inplace)
def rnlu(x, inplace=False, shift=0, scale_fix=(math.pi / 2) ** 0.5):
x = birelu(x, inpla... | 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 math
import torch.nn as nn
from torch.autograd.function import InplaceFunction
imp... | aparna-aketi/Low_Precision_DL | RnLU | false | 3,116 | [
"MIT"
] | 0 | 5a2489cac5da8f43dd8490a9d871f1ce17f8e7f8 | https://github.com/aparna-aketi/Low_Precision_DL/tree/5a2489cac5da8f43dd8490a9d871f1ce17f8e7f8 |
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):
target = target[:, :input.size(1)]
mask = mask[:, :input.size(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... | anonymous2021hello/transformer-cil | LanguageModelCriterion | false | 3,117 | [
"MIT"
] | 0 | aed4017b61afaf4d9d21d40a078eefb4c7031cd1 | https://github.com/anonymous2021hello/transformer-cil/tree/aed4017b61afaf4d9d21d40a078eefb4c7031cd1 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
self.sigmoid = nn.Sigmoid()
def forward(self, output, target):
prediction = self.sigmoid(output)
return 1 - 2 * torch.sum(prediction * target) / (torch.sum(
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | apyskir/steppy-toolkit | DiceLoss | false | 3,118 | [
"MIT"
] | 0 | 3190054954aeab043ced1c079d87bdd3582bb232 | https://github.com/apyskir/steppy-toolkit/tree/3190054954aeab043ced1c079d87bdd3582bb232 |
BiReLU | import torch
import torch.nn as nn
from torch.autograd.function import InplaceFunction
import torch.nn.parallel
import torch.utils.data
def birelu(x, inplace=False):
return BiReLUFunction().apply(x, inplace)
class BiReLUFunction(InplaceFunction):
@classmethod
def forward(cls, ctx, input, inplace=False)... | 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
from torch.autograd.function import InplaceFunction
import torch.nn... | aparna-aketi/Low_Precision_DL | BiReLU | false | 3,119 | [
"MIT"
] | 0 | 5a2489cac5da8f43dd8490a9d871f1ce17f8e7f8 | https://github.com/aparna-aketi/Low_Precision_DL/tree/5a2489cac5da8f43dd8490a9d871f1ce17f8e7f8 |
Network | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class Network(nn.Module):
def __init__(self, lr, input_dims, n_hidden=64, output_dims=4):
super(Network, self).__init__()
self.fc1 = nn.Linear(input_dims, n_hidden)
self.fc2 = nn.Linear(n_hidden... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | apoorvaish/mujoco-rl | Network | false | 3,120 | [
"MIT"
] | 0 | 234bd7689990cdd63db458d0367e14ccd1b62c1f | https://github.com/apoorvaish/mujoco-rl/tree/234bd7689990cdd63db458d0367e14ccd1b62c1f |
ConvertPointsToHomogeneous | import torch
import torch.nn as nn
def convert_points_to_homogeneous(points):
"""Function that converts points from Euclidean to homogeneous space.
See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tgm.co... | 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... | aravinho/frankmocap | ConvertPointsToHomogeneous | false | 3,121 | [
"BSD-3-Clause"
] | 0 | 6a150a9cb96e9b32a60d8047eaa84d0c37e471f5 | https://github.com/aravinho/frankmocap/tree/6a150a9cb96e9b32a60d8047eaa84d0c37e471f5 |
pg_model | import torch
import torch.nn as nn
import torch.nn.functional as F
class pg_model(nn.Module):
def __init__(self):
super(pg_model, self).__init__()
self.l1 = nn.Linear(4, 10)
self.l2 = nn.Linear(10, 2)
self.l3 = nn.Linear(2, 2)
def forward(self, x):
x = self.l1(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.... | anthonytec2/ssp-rl-final | pg_model | false | 3,122 | [
"MIT"
] | 0 | 4004678f7b820989d69824bd492307b3ed227b7a | https://github.com/anthonytec2/ssp-rl-final/tree/4004678f7b820989d69824bd492307b3ed227b7a |
DiagGaussian | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
class BaseDistribution(nn.Module):
"""
Base distribution of a flow-based model
Parameters do not depend of target variable (as is the case for a VAE encoder)
"""
def __init__(self):
super().__init__()
def f... | 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 math as tl_math
import numpy as np
import torch.nn as nn
import ... | arc82/normalizing-flows | DiagGaussian | false | 3,123 | [
"MIT"
] | 0 | f43df979267eb69b066606177c61d3b2bad0a5b5 | https://github.com/arc82/normalizing-flows/tree/f43df979267eb69b066606177c61d3b2bad0a5b5 |
ConvertPointsFromHomogeneous | import torch
import torch.nn as nn
def convert_points_from_homogeneous(points):
"""Function that converts points from homogeneous to Euclidean space.
See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tg... | 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... | aravinho/frankmocap | ConvertPointsFromHomogeneous | false | 3,124 | [
"BSD-3-Clause"
] | 0 | 6a150a9cb96e9b32a60d8047eaa84d0c37e471f5 | https://github.com/aravinho/frankmocap/tree/6a150a9cb96e9b32a60d8047eaa84d0c37e471f5 |
value_model | import torch
import torch.nn as nn
import torch.nn.functional as F
class value_model(nn.Module):
def __init__(self):
super(value_model, self).__init__()
self.l1 = nn.Linear(4, 10)
self.l2 = nn.Linear(10, 2)
self.l3 = nn.Linear(2, 1)
def forward(self, x):
x = self.l1(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.... | anthonytec2/ssp-rl-final | value_model | false | 3,125 | [
"MIT"
] | 0 | 4004678f7b820989d69824bd492307b3ed227b7a | https://github.com/anthonytec2/ssp-rl-final/tree/4004678f7b820989d69824bd492307b3ed227b7a |
IntrinsicsModel | import torch
import torch.nn.functional as F
import torch.nn as nn
class IntrinsicsModel(nn.Module):
def __init__(self, n, H, W):
super(IntrinsicsModel, self).__init__()
self.skew_scale = 0.001
self.fc1 = nn.Linear(n, n)
self.fc2 = nn.Linear(n, n)
self.fc3 = nn.Linear(n, 5... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | apurvtwr/Jarvis | IntrinsicsModel | false | 3,126 | [
"Apache-2.0"
] | 0 | bdd25e059826a0403c6282a1ee206f9f4c3e9355 | https://github.com/apurvtwr/Jarvis/tree/bdd25e059826a0403c6282a1ee206f9f4c3e9355 |
MotionModel | import torch
import torch.nn.functional as F
import torch.nn as nn
class MotionModel(nn.Module):
def __init__(self, n):
super(MotionModel, self).__init__()
self.rotation_scale = 0.01
self.fc1 = nn.Linear(n, n)
self.fc2 = nn.Linear(n, n)
self.fc3 = nn.Linear(n, n)
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | apurvtwr/Jarvis | MotionModel | false | 3,127 | [
"Apache-2.0"
] | 0 | bdd25e059826a0403c6282a1ee206f9f4c3e9355 | https://github.com/apurvtwr/Jarvis/tree/bdd25e059826a0403c6282a1ee206f9f4c3e9355 |
GraphEncoder | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from collections import OrderedDict
from sklearn.cluster import KMeans
class GraphEncoder(nn.Module):
def __init__(self, layers, clusters):
super(GraphEncoder, self).__init__()
self.layers = nn.Sequential(Ordered... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
import torch.nn.functional as F
from col... | SusheendharVijay/ClusterEncoder | GraphEncoder | false | 3,128 | [
"MIT"
] | 0 | 1ebdb4280027f88010cea2d3535b457cf648d311 | https://github.com/SusheendharVijay/ClusterEncoder/tree/1ebdb4280027f88010cea2d3535b457cf648d311 |
Tanh2 | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
import torch.optim
class Tanh2(nn.Module):
def __init__(self):
super(Tanh2, self).__init__()
self.tanh = nn.Tanh()
def forward(self, x):
return (self.tanh(x) + 1) / 2
def get_inputs():
return [t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
import t... | ananiask8/FFWM | Tanh2 | false | 3,129 | [
"MIT"
] | 0 | 117f593783da67da9dc910a751910760497ef37f | https://github.com/ananiask8/FFWM/tree/117f593783da67da9dc910a751910760497ef37f |
SimpleModel | import torch
import torch.cuda
from torch.nn.functional import *
class SimpleModel(torch.nn.Module):
def __init__(self, hidden_dim, empty_grad=False, rank=0):
super(SimpleModel, self).__init__()
self.linear = torch.nn.Linear(hidden_dim, hidden_dim)
if empty_grad:
self.linear2 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | arashashari/DeepSpeed | SimpleModel | false | 3,130 | [
"MIT"
] | 0 | a2984d0a69640d4cfec4cf38fe22376dc8994a91 | https://github.com/arashashari/DeepSpeed/tree/a2984d0a69640d4cfec4cf38fe22376dc8994a91 |
resblock | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
import torch.optim
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ananiask8/FFWM | resblock | false | 3,131 | [
"MIT"
] | 0 | 117f593783da67da9dc910a751910760497ef37f | https://github.com/ananiask8/FFWM/tree/117f593783da67da9dc910a751910760497ef37f |
GCN_classifier | from torch.nn import Module
import math
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
from scipy.sparse import *
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | TTomatoZhang/GHGCN | GCN_classifier | false | 3,132 | [
"Apache-2.0"
] | 0 | 09a07ff9e29e5889b912ca5feff74bb9308eda55 | https://github.com/TTomatoZhang/GHGCN/tree/09a07ff9e29e5889b912ca5feff74bb9308eda55 |
Fuse | import torch
import torch.nn as nn
class Fuse(nn.Module):
def __init__(self):
super(Fuse, self).__init__()
self.convolution = nn.Conv2d(32, 16, kernel_size=1, padding=0)
self.relu = nn.ReLU(inplace=True)
def forward(self, x):
x = self.convolution(x)
x = self.relu(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
import torch.nn as nn
assert_... | arsalasif/SalAR | Fuse | false | 3,133 | [
"MIT"
] | 0 | eee0855199233177df0fce80f2a0612b8774ac1f | https://github.com/arsalasif/SalAR/tree/eee0855199233177df0fce80f2a0612b8774ac1f |
group | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
import torch.optim
class mfm(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, type=1):
super(mfm, self).__init__()
self.out_channels = out_channels
if t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ananiask8/FFWM | group | false | 3,134 | [
"MIT"
] | 0 | 117f593783da67da9dc910a751910760497ef37f | https://github.com/ananiask8/FFWM/tree/117f593783da67da9dc910a751910760497ef37f |
MyEntropy | import torch
import torch.nn as nn
class MyEntropy(nn.Module):
def __init__(self):
super(MyEntropy, self).__init__()
def forward(self, predictions, target):
b_size = predictions.size(0)
lsm_func = nn.LogSoftmax(dim=1)
logsoftmax = lsm_func(predictions)
loss = -logsoft... | 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
... | atimashov/object_detection | MyEntropy | false | 3,135 | [
"MIT"
] | 0 | 922cd88f429156fa4668c7d718b2665e4ab875fd | https://github.com/atimashov/object_detection/tree/922cd88f429156fa4668c7d718b2665e4ab875fd |
CBAM_Module | import torch
from typing import *
import torch.nn as nn
class CBAM_Module(nn.Module):
def __init__(self, channels, reduction):
super(CBAM_Module, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPool2d(1)
self.fc1 = nn.Conv2d(channels, channel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 typing import *
import t... | artyompal/kaggle_quick_draw | CBAM_Module | false | 3,136 | [
"Apache-2.0"
] | 0 | 227e228295479cd5e1af8dcde773f5efdacd62b8 | https://github.com/artyompal/kaggle_quick_draw/tree/227e228295479cd5e1af8dcde773f5efdacd62b8 |
SeparableBlock | from torch.nn import Module
import torch
from torch.nn import Linear
class SeparableBlock(Module):
def __init__(self, input_size, kernel_channels_in, kernel_channels_out,
kernel_size):
super(SeparableBlock, self).__init__()
self.input_size = input_size
self.kernel_size = 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.nn import Module
from torch.nn import Linear
assert_size_stride = tor... | andreasjansson/hyperstyle | SeparableBlock | false | 3,137 | [
"MIT"
] | 0 | d9847c76dd75da129a60bf995534ff6e71cbbaa6 | https://github.com/andreasjansson/hyperstyle/tree/d9847c76dd75da129a60bf995534ff6e71cbbaa6 |
IOUloss | import torch
import torch.nn as nn
class IOUloss(nn.Module):
def __init__(self, reduction='none', loss_type='iou'):
super(IOUloss, self).__init__()
self.reduction = reduction
self.loss_type = loss_type
def forward(self, pred, target):
assert pred.shape[0] == target.shape[0]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | augmentedstartups/EmotionDetectionYoloX | IOUloss | false | 3,138 | [
"Apache-2.0"
] | 0 | 2b0e13b94486a0bd85628f1483a0b710503c2005 | https://github.com/augmentedstartups/EmotionDetectionYoloX/tree/2b0e13b94486a0bd85628f1483a0b710503c2005 |
GaussianVAE2D | import torch
import torch.utils.data
import torch
import torch.nn as nn
from torch.autograd import Variable
class GaussianVAE2D(nn.Module):
def __init__(self, n_in, n_out, kernel_size, stride, padding=0):
super(GaussianVAE2D, self).__init__()
self.en_mu = nn.Conv2d(n_in, n_out, kernel_size, 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._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | ast0414/semit | GaussianVAE2D | false | 3,139 | [
"MIT"
] | 0 | c221222ba06f14611e3d030969cdb9f7c17ff98f | https://github.com/ast0414/semit/tree/c221222ba06f14611e3d030969cdb9f7c17ff98f |
LearnedUpsampling1d | import torch
from torch import nn
class LearnedUpsampling1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, bias=True):
super().__init__()
self.conv_t = nn.ConvTranspose1d(in_channels=in_channels,
out_channels=out_channels, kernel_size=kernel_size, stride=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | austincap/samplernn-pytorch | LearnedUpsampling1d | false | 3,140 | [
"MIT"
] | 0 | d78399b899dcc116fd20823ae9e006ad8a6df4ea | https://github.com/austincap/samplernn-pytorch/tree/d78399b899dcc116fd20823ae9e006ad8a6df4ea |
ConvTranspose2dBlock | import torch
import torch.utils.data
import torch
from torch.nn import functional as F
import torch.nn as nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | ast0414/semit | ConvTranspose2dBlock | false | 3,141 | [
"MIT"
] | 0 | c221222ba06f14611e3d030969cdb9f7c17ff98f | https://github.com/ast0414/semit/tree/c221222ba06f14611e3d030969cdb9f7c17ff98f |
LocallyConnected | import math
import torch
from torch import nn
class LocallyConnected(nn.Module):
"""Local linear layer, i.e. Conv1dLocal() with filter size 1.
Args:
num_linear: num of local linear layers, i.e.
in_features: m1
out_features: m2
bias: whether to include bias or not
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
import math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | atong01/Graphical-modelling-continuous-time | LocallyConnected | false | 3,142 | [
"MIT"
] | 0 | f1c8d9bc30a44c38fd504e4cce2f7886fc352f92 | https://github.com/atong01/Graphical-modelling-continuous-time/tree/f1c8d9bc30a44c38fd504e4cce2f7886fc352f92 |
TransposeConv2dLayer | import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.nn import Parameter
assert_size_stride = torch.... | autocomic/https-github.com-autocomic-DeepFillv2_Pytorch | TransposeConv2dLayer | false | 3,143 | [
"MIT"
] | 0 | 7f6712a9b42dfd827879271f13856f1da5d6a032 | https://github.com/autocomic/https-github.com-autocomic-DeepFillv2_Pytorch/tree/7f6712a9b42dfd827879271f13856f1da5d6a032 |
GatedTransition | import torch
import torch.nn as nn
class GatedTransition(nn.Module):
"""
Parameterizes the gaussian latent transition probability `p(z_t | z_{t-1} ,s)`
"""
def __init__(self, z_dim, static_dim, transition_dim):
super().__init__()
self.concat_dim = z_dim + static_dim
self.lin_g... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | autodidact-m/Projects | GatedTransition | false | 3,144 | [
"Apache-2.0"
] | 0 | f4c0473adba42f3a629b62eb09d3b1df91982f46 | https://github.com/autodidact-m/Projects/tree/f4c0473adba42f3a629b62eb09d3b1df91982f46 |
Combiner | import torch
import torch.nn as nn
class Combiner(nn.Module):
"""
Parameterizes `q(z_t | z_{t-1}, x_{t:T}, m{t:T}, s)`, which is the basic building block
of the guide (i.e. the variational distribution). The dependence on `x_{t:T} and m_{t:T}` is
through the hidden state of the RNN (see the PyTorch mo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | autodidact-m/Projects | Combiner | false | 3,145 | [
"Apache-2.0"
] | 0 | f4c0473adba42f3a629b62eb09d3b1df91982f46 | https://github.com/autodidact-m/Projects/tree/f4c0473adba42f3a629b62eb09d3b1df91982f46 |
Net | import torch
import numpy as np
from torch.autograd import Variable
class Net(torch.nn.Module):
def __init__(self, n_in, n_hidden, n_out):
super(Net, self).__init__()
self.w1 = torch.nn.Linear(n_in, n_hidden)
self.w2 = torch.nn.Linear(n_hidden, n_out)
def forward(self, x):
x ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | auckland-cosmo/LearnAsYouGoEmulator | Net | false | 3,146 | [
"Apache-2.0"
] | 0 | d29dfb0192d8050003ab4f7e7b18571e21776ba3 | https://github.com/auckland-cosmo/LearnAsYouGoEmulator/tree/d29dfb0192d8050003ab4f7e7b18571e21776ba3 |
GatedConv2d | import torch
import torch.nn as nn
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
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, math as tl_math
im... | autocomic/https-github.com-autocomic-DeepFillv2_Pytorch | GatedConv2d | false | 3,147 | [
"MIT"
] | 0 | 7f6712a9b42dfd827879271f13856f1da5d6a032 | https://github.com/autocomic/https-github.com-autocomic-DeepFillv2_Pytorch/tree/7f6712a9b42dfd827879271f13856f1da5d6a032 |
Conv1DHighwayLayer | import torch
import torch.nn as nn
class Conv1DHighwayLayer(nn.Module):
def __init__(self, inchannels, outchannels, kernelsize, activation=
'relu', stride=1, bias=-1):
super(Conv1DHighwayLayer, self).__init__()
self.inchannels = inchannels
self.outchannels = outchannels
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
assert_... | avinashsai/Highway-Networks | Conv1DHighwayLayer | false | 3,148 | [
"MIT"
] | 0 | fe30629e47b919776f981eaa2bea7d21e648a17f | https://github.com/avinashsai/Highway-Networks/tree/fe30629e47b919776f981eaa2bea7d21e648a17f |
Conv2dLayer | import torch
import torch.nn as nn
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
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 ... | autocomic/https-github.com-autocomic-DeepFillv2_Pytorch | Conv2dLayer | false | 3,149 | [
"MIT"
] | 0 | 7f6712a9b42dfd827879271f13856f1da5d6a032 | https://github.com/autocomic/https-github.com-autocomic-DeepFillv2_Pytorch/tree/7f6712a9b42dfd827879271f13856f1da5d6a032 |
HighwayFC | import torch
import torch.nn as nn
class HighwayFC(nn.Module):
def __init__(self, indim, outdim, activation='relu', bias=-1):
super(HighwayFC, self).__init__()
self.indim = indim
self.outdim = outdim
if activation == 'selu':
self.activation = nn.SELU()
elif act... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | avinashsai/Highway-Networks | HighwayFC | false | 3,150 | [
"MIT"
] | 0 | fe30629e47b919776f981eaa2bea7d21e648a17f | https://github.com/avinashsai/Highway-Networks/tree/fe30629e47b919776f981eaa2bea7d21e648a17f |
VertexDirectEmbedder | import torch
import torch.utils.data
from torch import nn
def normalize_embeddings(embeddings: 'torch.Tensor', epsilon: 'float'=1e-06
) ->torch.Tensor:
"""
Normalize N D-dimensional embedding vectors arranged in a tensor [N, D]
Args:
embeddings (tensor [N, D]): N D-dimensional embedding vecto... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
from... | av777x/detectron2 | VertexDirectEmbedder | false | 3,151 | [
"Apache-2.0"
] | 0 | c1794881d6d2fac6af0b3206937d32628677469c | https://github.com/av777x/detectron2/tree/c1794881d6d2fac6af0b3206937d32628677469c |
Conv2DHighwayLayer | import torch
import torch.nn as nn
class Conv2DHighwayLayer(nn.Module):
def __init__(self, inchannels, outchannels, kernelsize, activation=
'relu', stride=1, bias=-1):
super(Conv2DHighwayLayer, self).__init__()
self.inchannels = inchannels
self.outchannels = outchannels
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
assert_... | avinashsai/Highway-Networks | Conv2DHighwayLayer | false | 3,152 | [
"MIT"
] | 0 | fe30629e47b919776f981eaa2bea7d21e648a17f | https://github.com/avinashsai/Highway-Networks/tree/fe30629e47b919776f981eaa2bea7d21e648a17f |
LayerNorm | import torch
import torch.nn.init
import torch.optim.lr_scheduler
class LayerNorm(torch.nn.Module):
"""
An implementation of `Layer Normalization
<https://www.semanticscholar.org/paper/Layer-Normalization-Ba-Kiros/97fb4e3d45bb098e27e0071448b6152217bd35a5>`_ .
Layer Normalization stabilises the traini... | 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.init
import torch.optim.lr_scheduler
assert_size_stride = torch... | azraelzhor/allen-nlp-rc | LayerNorm | false | 3,153 | [
"Apache-2.0"
] | 0 | b114c00a8f364b18e3c427c1a447be9c65ede551 | https://github.com/azraelzhor/allen-nlp-rc/tree/b114c00a8f364b18e3c427c1a447be9c65ede551 |
SimpleResidualBlock | import torch
import torch.nn as nn
class SimpleResidualBlock(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=3, kernel_size=3,
stride=1, padding=1)
self.relu1 = nn.ReLU()
self.conv2 = nn.Conv2d(in_channels=3, out_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_... | ayanch07/ResNet-cifar-10-pytorch | SimpleResidualBlock | false | 3,154 | [
"MIT"
] | 0 | bafc945a022a2e3ada689a831c7e57b5bdb0e8bd | https://github.com/ayanch07/ResNet-cifar-10-pytorch/tree/bafc945a022a2e3ada689a831c7e57b5bdb0e8bd |
TransposeGatedConv2d | import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-08, affine=True):
super(LayerNorm, self).__init__()
self.num_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | autocomic/https-github.com-autocomic-DeepFillv2_Pytorch | TransposeGatedConv2d | false | 3,155 | [
"MIT"
] | 0 | 7f6712a9b42dfd827879271f13856f1da5d6a032 | https://github.com/autocomic/https-github.com-autocomic-DeepFillv2_Pytorch/tree/7f6712a9b42dfd827879271f13856f1da5d6a032 |
SimpleNet | import torch
import torch.nn as nn
from torch.functional import F
import torch.nn.functional as F
class SimpleNet(nn.Module):
"""
Simple Neural Net model
"""
def __init__(self):
"""
Creates layers as class attributes.
"""
super(SimpleNet, self).__init__()
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | avizyt/PytorchMLDLStudy | SimpleNet | false | 3,156 | [
"MIT"
] | 0 | ccb552809e7ab4438576e6d3b7cd7ca3b73235ed | https://github.com/avizyt/PytorchMLDLStudy/tree/ccb552809e7ab4438576e6d3b7cd7ca3b73235ed |
FFN | import torch
import torch.nn as nn
class FFN(nn.Module):
def __init__(self, input_dim, num_class):
super().__init__()
self.layer1 = nn.Linear(input_dim, 256)
self.layer2 = nn.Linear(256, 128)
self.layer3 = nn.Linear(128, 128)
self.out = nn.Linear(128, num_class)
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
assert_... | baburamShapure/federatedGraphConv | FFN | false | 3,157 | [
"MIT"
] | 0 | 015e502fcf1b911ab23572b00c547591a4bdf378 | https://github.com/baburamShapure/federatedGraphConv/tree/015e502fcf1b911ab23572b00c547591a4bdf378 |
TreeStandardize | import torch
from torch import nn
import torch.utils.data
class TreeStandardize(nn.Module):
def forward(self, trees):
mu = torch.mean(trees[0], dim=(1, 2)).unsqueeze(1).unsqueeze(1)
s = torch.std(trees[0], dim=(1, 2)).unsqueeze(1).unsqueeze(1)
standardized = (trees[0] - mu) / (s + 1e-05)
... | 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.utils.data
assert_size_stride = torch._C._dyn... | balsa-project/balsa | TreeStandardize | false | 3,158 | [
"Apache-2.0"
] | 0 | 36f3fb35d33589928d761b89de52367d18d08fd8 | https://github.com/balsa-project/balsa/tree/36f3fb35d33589928d761b89de52367d18d08fd8 |
TreeMaxPool | import torch
from torch import nn
import torch.utils.data
class TreeMaxPool(nn.Module):
def forward(self, trees):
return trees[0].max(dim=2).values
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards... | balsa-project/balsa | TreeMaxPool | false | 3,159 | [
"Apache-2.0"
] | 0 | 36f3fb35d33589928d761b89de52367d18d08fd8 | https://github.com/balsa-project/balsa/tree/36f3fb35d33589928d761b89de52367d18d08fd8 |
MetricLoss | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class MetricLoss(nn.Module):
"""Loss designed to train a true metric, as opposed to a
sigmoid classifier.
"""
def __init__(self):
super(MetricLoss, self).__init__()
def forward(self, input, target):
weight = 1.0 - 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
import torch.jit
import torch.nn
assert_size_stride = torch._C._dyn... | ankmathur96/torchsupport | MetricLoss | false | 3,160 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
NotNorm | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class NotNorm(nn.Module):
def __init__(self, in_size):
super().__init__()
self.in_size = in_size
def forward(self, inputs):
[1] * (inputs.dim() - 2)
out = inputs.view(inputs.size(0), inputs.size(1), -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 libdevice
import torch.nn as nn
import torch.jit
import torch.nn
assert_size_stride = tor... | ankmathur96/torchsupport | NotNorm | false | 3,162 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
AdaptiveInstanceNorm | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class AdaptiveInstanceNorm(nn.Module):
def __init__(self, in_size, ada_size):
super(AdaptiveInstanceNorm, self).__init__()
self.scale = nn.Linear(ada_size, in_size)
self.bias = nn.Linear(ada_size, in_size)
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.triton_helpers import libdevice
import torch.nn as ... | ankmathur96/torchsupport | AdaptiveInstanceNorm | false | 3,163 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
DCCWeightedELoss | import torch
import numpy as np
import torch.nn as nn
import torch.jit
import torch.nn
class DCCWeightedELoss(nn.Module):
def __init__(self, size_average=True):
super(DCCWeightedELoss, self).__init__()
self.size_average = size_average
def forward(self, inputs, outputs, weights):
out ... | 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... | ankmathur96/torchsupport | DCCWeightedELoss | false | 3,164 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
AdaptiveLayerNorm | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class AdaptiveLayerNorm(nn.Module):
def __init__(self, in_size, ada_size):
super(AdaptiveLayerNorm, self).__init__()
self.scale = nn.Linear(ada_size, in_size)
self.bias = nn.Linear(ada_size, in_size)
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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | ankmathur96/torchsupport | AdaptiveLayerNorm | false | 3,165 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
ConvMeanPool | import torch
from torch import nn
from matplotlib import pyplot as pyplot
class MyConvo2d(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, he_init=True,
stride=1, bias=True):
super(MyConvo2d, self).__init__()
self.he_init = he_init
self.padding = int((kernel_size... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from matplotlib import pyplot as pyplot
assert_size_stride ... | ameya005/Conn_InvNet | ConvMeanPool | false | 3,166 | [
"MIT"
] | 0 | 848a90e45808e540d3047d92b8d0a220da1bc5e7 | https://github.com/ameya005/Conn_InvNet/tree/848a90e45808e540d3047d92b8d0a220da1bc5e7 |
ProposalNet | import torch
from torch import nn
import torch.utils.data
class ProposalNet(nn.Module):
def __init__(self):
super(ProposalNet, self).__init__()
self.down1 = nn.Conv2d(2048, 128, 3, 1, 1)
self.down2 = nn.Conv2d(128, 128, 3, 2, 1)
self.down3 = nn.Conv2d(128, 128, 3, 2, 1)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | Syderny/NTS-Net | ProposalNet | false | 3,167 | [
"MIT"
] | 0 | 02d29e8e46aca7698c3102626eec33b12ddd7669 | https://github.com/Syderny/NTS-Net/tree/02d29e8e46aca7698c3102626eec33b12ddd7669 |
AdaptiveFilterResponseNorm | import torch
import torch.nn as nn
import torch.nn.functional as func
import torch.jit
import torch.nn
class AdaptiveFilterResponseNorm(nn.Module):
def __init__(self, in_size, ada_size, eps=1e-16):
super().__init__()
self.eps = eps
self.in_size = in_size
self.scale = nn.Linear(ada... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ankmathur96/torchsupport | AdaptiveFilterResponseNorm | false | 3,168 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
DepthWiseSeparableConv1d | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class DepthWiseSeparableConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1, bias=True):
"""Depthwise separable 1D convolution.
Args:
in_channels (int): number ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.jit
import torch.nn
assert_size_stride = torc... | ankmathur96/torchsupport | DepthWiseSeparableConv1d | false | 3,169 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
SemiNorm | import torch
import torch.nn as nn
from torch.nn.utils import spectral_norm
import torch.jit
import torch.nn
from torch.nn.utils.spectral_norm import spectral_norm
class SemiNorm(nn.Module):
def __init__(self, in_size, normalization=None):
super().__init__()
normalization = normalization or spect... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ankmathur96/torchsupport | SemiNorm | false | 3,170 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
ScaleNorm | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class ScaleNorm(nn.Module):
def __init__(self, *args):
super().__init__()
self.scale = nn.Parameter(torch.tensor(1.0, dtype=torch.float))
def forward(self, inputs):
out = inputs.view(inputs.size(0), -1)
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
import torch.jit
import torch.nn
assert_size_stride = tor... | ankmathur96/torchsupport | ScaleNorm | false | 3,171 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
AuxiliaryConvolutions | import torch
import torch.utils.data
from torch import nn
import torch.nn.functional as F
from itertools import product as product
import torch.optim
class AuxiliaryConvolutions(nn.Module):
"""
Additional convolutions to produce higher-level feature maps.
"""
def __init__(self):
super(Auxilia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | adityag6994/pytorch_ssd_training | AuxiliaryConvolutions | false | 3,172 | [
"MIT"
] | 0 | 404f3cbef815e314337ec2c1b4f06a2403a7ce03 | https://github.com/adityag6994/pytorch_ssd_training/tree/404f3cbef815e314337ec2c1b4f06a2403a7ce03 |
neuralNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class neuralNet(nn.Module):
def __init__(self):
super(neuralNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=6, kernel_size=5)
self.conv2 = nn.Conv2d(in_channels=6, out_channels=12, kernel_size=5)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ayushmaan02/Plant-Disease-Detection | neuralNet | false | 3,173 | [
"MIT"
] | 0 | 35e5b8112e933fd558a80a1e5350df541c29bd6b | https://github.com/ayushmaan02/Plant-Disease-Detection/tree/35e5b8112e933fd558a80a1e5350df541c29bd6b |
Splitter | import torch
import numpy as np
class Splitter(torch.nn.Module):
"""
An implementation of "Splitter: Learning Node Representations that Capture Multiple Social Contexts" (WWW 2019).
Paper: http://epasto.org/papers/www2019splitter.pdf
"""
def __init__(self, dimensions, lambd, base_node_count, node... | 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 nump... | balla2081/SpliiterPytorch | Splitter | false | 3,174 | [
"MIT"
] | 0 | 366742166470dc730fe761bae081779d737e1315 | https://github.com/balla2081/SpliiterPytorch/tree/366742166470dc730fe761bae081779d737e1315 |
DecoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttention(nn.Module):
def __init__(self, heads, d_model, dropout=0.1):
super().__init__()
self.d_model = d_model
self.d_k = d_model // heads
self.h = heads
self.q_linear = 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._inductor.runtime.... | b19e93n/PLC-Pyramid | DecoderLayer | false | 3,175 | [
"MIT"
] | 0 | 6d5b57be6995a94ef7402144cee965862713b031 | https://github.com/b19e93n/PLC-Pyramid/tree/6d5b57be6995a94ef7402144cee965862713b031 |
StandardWNetDown | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class DepthWiseSeparableConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=1, dilation=1, bias=True):
"""Depthwise separable 2D convolution.
Args:
in_channels (int): number ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | ankmathur96/torchsupport | StandardWNetDown | false | 3,176 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
AdaptiveInstanceNormPP | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class AdaptiveInstanceNorm(nn.Module):
def __init__(self, in_size, ada_size):
super(AdaptiveInstanceNorm, self).__init__()
self.scale = nn.Linear(ada_size, in_size)
self.bias = nn.Linear(ada_size, in_size)
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.triton_helpers import libdevice
import torch.nn as ... | ankmathur96/torchsupport | AdaptiveInstanceNormPP | false | 3,177 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
NonLocal | import torch
import torch.nn as nn
import torch.nn.functional as func
import torch.jit
import torch.nn
class NonLocal(nn.Module):
def __init__(self, in_size, attention_size=32, size=None, scale=None):
super(NonLocal, self).__init__()
self.size = size
self.scale = scale
self.attent... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ankmathur96/torchsupport | NonLocal | false | 3,178 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
MultiheadSimilarity | import torch
import torch.utils.data
from torch import nn
class MultiheadSimilarity(nn.Module):
def __init__(self, d_model, num_head, seq_len):
super().__init__()
self.num_head = num_head
self.seq_len = seq_len
self.d_head = d_model // num_head
self.q_in_proj = nn.Linear(d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dyna... | bearcatt/SimpleBaseline | MultiheadSimilarity | false | 3,179 | [
"MIT"
] | 0 | 9ae38f289688c0e671efb50985d3b8fe2da47d69 | https://github.com/bearcatt/SimpleBaseline/tree/9ae38f289688c0e671efb50985d3b8fe2da47d69 |
ContrastivePairwiseEmbeddingLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.loss import *
from torch.nn.modules import *
from torch.optim import *
from torch.optim.lr_scheduler import *
import torch.distributed
class ContrastivePairwiseEmbeddingLoss(nn.Module):
"""
ContrastivePairwiseEmbeddingLos... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | bbradt/catalyst | ContrastivePairwiseEmbeddingLoss | false | 3,180 | [
"Apache-2.0"
] | 0 | 38a503c8af040906e377b7485d7fe15a7bc1de19 | https://github.com/bbradt/catalyst/tree/38a503c8af040906e377b7485d7fe15a7bc1de19 |
NormalizedDistance | import torch
import torch.nn as nn
import torch.jit
import torch.nn
def normalized_distance(data, distance):
data = data.view(data.size(0), -1)
reference = data[:, None]
comparison = data[None, :]
result = distance(reference, comparison)
result = result / result.sum(dim=1, keepdim=True).detach()
... | 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.jit
import torch.nn
assert_size_stride = tor... | ankmathur96/torchsupport | NormalizedDistance | false | 3,181 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
ContrastiveDistanceLoss | import torch
import torch.nn as nn
from torch.nn.modules.loss import *
from torch.nn.modules import *
from torch.optim import *
from torch.optim.lr_scheduler import *
import torch.distributed
class ContrastiveDistanceLoss(nn.Module):
"""
Contrastive distance loss
"""
def __init__(self, margin=1.0, re... | 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
from torch.nn.modules.loss import *
from torch.nn.modules import *
... | bbradt/catalyst | ContrastiveDistanceLoss | false | 3,182 | [
"Apache-2.0"
] | 0 | 38a503c8af040906e377b7485d7fe15a7bc1de19 | https://github.com/bbradt/catalyst/tree/38a503c8af040906e377b7485d7fe15a7bc1de19 |
ContrastiveEmbeddingLoss | import torch
import torch.nn as nn
from torch.nn.modules.loss import *
from torch.nn.modules import *
from torch.optim import *
from torch.optim.lr_scheduler import *
import torch.distributed
class ContrastiveEmbeddingLoss(nn.Module):
"""
Contrastive embedding loss
paper: http://yann.lecun.com/exdb/publi... | 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
from t... | bbradt/catalyst | ContrastiveEmbeddingLoss | false | 3,183 | [
"Apache-2.0"
] | 0 | 38a503c8af040906e377b7485d7fe15a7bc1de19 | https://github.com/bbradt/catalyst/tree/38a503c8af040906e377b7485d7fe15a7bc1de19 |
FiLMNetwork | import torch
import torch.nn as nn
class FiLMNetwork(nn.Module):
def __init__(self, in_sz, out_sz):
super(FiLMNetwork, self).__init__()
self.f = nn.Linear(in_sz, out_sz)
self.h = nn.Linear(in_sz, out_sz)
def forward(self, inputs, features):
gamma = self.f(inputs).unsqueeze(1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | bblinn2017/IM-NET-pytorch | FiLMNetwork | false | 3,184 | [
"MIT"
] | 0 | 82ff646aaf2f93ae1560debb40fe05f1420ff655 | https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655 |
MLP_FiLM | import torch
import torch.nn as nn
class FiLMNetwork(nn.Module):
def __init__(self, in_sz, out_sz):
super(FiLMNetwork, self).__init__()
self.f = nn.Linear(in_sz, out_sz)
self.h = nn.Linear(in_sz, out_sz)
def forward(self, inputs, features):
gamma = self.f(inputs).unsqueeze(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.triton_helpers import libdevice
import torch.nn as ... | bblinn2017/IM-NET-pytorch | MLP_FiLM | false | 3,185 | [
"MIT"
] | 0 | 82ff646aaf2f93ae1560debb40fe05f1420ff655 | https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655 |
CnnViewModel | import torch
import torch.nn as nn
class CnnViewModel(nn.Module):
def __init__(self, out_dim=10):
super(CnnViewModel, self).__init__()
self.cnn1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=5,
stride=1, padding=2)
self.relu1 = nn.ReLU()
self.maxpool1 = nn.Ma... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | bbrighttaer/DCCA_demo | CnnViewModel | false | 3,186 | [
"MIT"
] | 0 | c5410f2e163c6538899bf8f5f9afe031a517408f | https://github.com/bbrighttaer/DCCA_demo/tree/c5410f2e163c6538899bf8f5f9afe031a517408f |
FastestBlock | import torch
import torch.nn as nn
def get_operator_from_cfg(operator_cfg):
operator_cfg_copy = operator_cfg.copy()
construct_str = 'nn.'
construct_str += operator_cfg_copy.pop('type') + '('
for k, v in operator_cfg_copy.items():
construct_str += k + '=' + str(v) + ','
construct_str += ')'... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | becauseofAI/DemoHub | FastestBlock | false | 3,187 | [
"Apache-2.0"
] | 0 | 2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da | https://github.com/becauseofAI/DemoHub/tree/2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da |
Resize | import torch
import torch.nn as nn
import torch.nn.functional as F
class Resize(nn.Module):
def __init__(self, input_size=[224, 224]):
super(Resize, self).__init__()
self.input_size = input_size
def forward(self, input):
x = F.interpolate(input, size=self.input_size, mode='bilinear',... | 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... | beibuwandeluori/Attack-ImageNet-tianchi | Resize | false | 3,188 | [
"MIT"
] | 0 | 85294952ac1a190c26bba5e8f141b1c68e72668a | https://github.com/beibuwandeluori/Attack-ImageNet-tianchi/tree/85294952ac1a190c26bba5e8f141b1c68e72668a |
ConvGRUCellNd | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class ConvGRUCellNd(nn.Module):
def __init__(self, in_size, out_size, kernel_size, N=1, **kwargs):
super(ConvGRUCellNd, self).__init__()
conv = eval(f'nn.Conv{N}d')
self.conv_ir = conv(in_size, out_size, kernel_size, **kw... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ankmathur96/torchsupport | ConvGRUCellNd | false | 3,189 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
Unet | import torch
from torch import nn
from torch.nn import functional as F
class ContractingBlock(nn.Module):
"""
ContractingBlock Class
Performs two convolutions followed by a max pool operation.
Values:
input_channels: the number of channels to expect from a given input
"""
def __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 import nn
from tor... | akanametov/unet-pytorch | Unet | false | 3,190 | [
"MIT"
] | 0 | 6cf0f70674958356ea4ac36fe61b0415921f72ae | https://github.com/akanametov/unet-pytorch/tree/6cf0f70674958356ea4ac36fe61b0415921f72ae |
SortNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class SortNet(nn.Module):
def __init__(self, input_size, hidden_size):
super(SortNet, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.fc1 = nn.Linear(input_size, hidden_size, bias=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | bashish101/sort | SortNet | false | 3,191 | [
"MIT"
] | 0 | c8f3e4875c039e6eb935c34ed8403c5d439bf8ad | https://github.com/bashish101/sort/tree/c8f3e4875c039e6eb935c34ed8403c5d439bf8ad |
Lambda | import torch
import torch.nn as nn
class Lambda(nn.Module):
def forward(self, t, y):
t = t.unsqueeze(0)
equation = -1000 * y + 3000 - 2000 * torch.exp(-t)
return equation
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
retur... | 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... | arnabgho/torchdiffeq | Lambda | false | 3,192 | [
"MIT"
] | 0 | d4f73440d0e714b87ea133610e61eefbd673e5f5 | https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5 |
SineODE | import math
import torch
class SineODE(torch.nn.Module):
def __init__(self, device):
super(SineODE, self).__init__()
def forward(self, t, y):
return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3
def y_exact(self, t):
return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | arnabgho/torchdiffeq | SineODE | false | 3,193 | [
"MIT"
] | 0 | d4f73440d0e714b87ea133610e61eefbd673e5f5 | https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5 |
generator | import torch
import torch.nn as nn
import torch.nn.functional as F
class generator(nn.Module):
def __init__(self, z_dim, point_dim, gf_dim):
super(generator, self).__init__()
self.z_dim = z_dim
self.point_dim = point_dim
self.gf_dim = gf_dim
self.linear_1 = nn.Linear(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_... | bblinn2017/IM-NET-pytorch | generator | false | 3,194 | [
"MIT"
] | 0 | 82ff646aaf2f93ae1560debb40fe05f1420ff655 | https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655 |
encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class encoder(nn.Module):
def __init__(self, ef_dim, z_dim):
super(encoder, self).__init__()
self.ef_dim = ef_dim
self.z_dim = z_dim
self.conv_1 = nn.Conv3d(1, self.ef_dim, 4, stride=2, padding=1,
bias=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | bblinn2017/IM-NET-pytorch | encoder | false | 3,195 | [
"MIT"
] | 0 | 82ff646aaf2f93ae1560debb40fe05f1420ff655 | https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655 |
Permute | import torch
import torch.nn as nn
class Permute(nn.Module):
def __init__(self, permutation=[2, 1, 0]):
super().__init__()
self.permutation = permutation
def forward(self, input):
return input[:, self.permutation]
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_in... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | beibuwandeluori/Attack-ImageNet-tianchi | Permute | false | 3,196 | [
"MIT"
] | 0 | 85294952ac1a190c26bba5e8f141b1c68e72668a | https://github.com/beibuwandeluori/Attack-ImageNet-tianchi/tree/85294952ac1a190c26bba5e8f141b1c68e72668a |
FastBlock | import torch
import torch.nn as nn
def get_operator_from_cfg(operator_cfg):
operator_cfg_copy = operator_cfg.copy()
construct_str = 'nn.'
construct_str += operator_cfg_copy.pop('type') + '('
for k, v in operator_cfg_copy.items():
construct_str += k + '=' + str(v) + ','
construct_str += ')'... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | becauseofAI/DemoHub | FastBlock | false | 3,197 | [
"Apache-2.0"
] | 0 | 2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da | https://github.com/becauseofAI/DemoHub/tree/2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da |
DepthWiseSeparableConv2d | import torch
import torch.nn as nn
import torch.jit
import torch.nn
class DepthWiseSeparableConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=1, dilation=1, bias=True):
"""Depthwise separable 2D convolution.
Args:
in_channels (int): number ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.jit
import torch.nn
assert_size_stride = torc... | ankmathur96/torchsupport | DepthWiseSeparableConv2d | false | 3,198 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, latent_dim=4, obs_dim=2, nhidden=20):
super(Decoder, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.fc1 = nn.Linear(latent_dim, nhidden)
self.fc2 = nn.Linear(nhidden, obs_dim)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | arnabgho/torchdiffeq | Decoder | false | 3,199 | [
"MIT"
] | 0 | d4f73440d0e714b87ea133610e61eefbd673e5f5 | https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5 |
FilterResponseNorm | import torch
import torch.nn as nn
import torch.nn.functional as func
import torch.jit
import torch.nn
class FilterResponseNorm(nn.Module):
def __init__(self, in_size, eps=1e-16):
super().__init__()
self.eps = eps
self.in_size = in_size
self.register_parameter('scale', nn.Paramete... | 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... | ankmathur96/torchsupport | FilterResponseNorm | false | 3,200 | [
"MIT"
] | 0 | 77bf4a90b8770a408665e2604428808c3ed2f979 | https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979 |
ConstantODE | import torch
class ConstantODE(torch.nn.Module):
def __init__(self, device):
super(ConstantODE, self).__init__()
self.a = torch.nn.Parameter(torch.tensor(0.2))
self.b = torch.nn.Parameter(torch.tensor(3.0))
def forward(self, t, y):
return self.a + (y - (self.a * t + self.b)) ... | 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... | arnabgho/torchdiffeq | ConstantODE | false | 3,201 | [
"MIT"
] | 0 | d4f73440d0e714b87ea133610e61eefbd673e5f5 | https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5 |
FasterBlock | import torch
import torch.nn as nn
def get_operator_from_cfg(operator_cfg):
operator_cfg_copy = operator_cfg.copy()
construct_str = 'nn.'
construct_str += operator_cfg_copy.pop('type') + '('
for k, v in operator_cfg_copy.items():
construct_str += k + '=' + str(v) + ','
construct_str += ')'... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | becauseofAI/DemoHub | FasterBlock | false | 3,202 | [
"Apache-2.0"
] | 0 | 2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da | https://github.com/becauseofAI/DemoHub/tree/2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da |
LinearProximal | import math
import torch
import torch.nn.functional as functional
from torch import nn
class LinearProximal(nn.Module):
"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b`
Args:
in_features: size of each input sample
out_features: size of each output sample
b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | belbahrim/twin-causal-net | LinearProximal | false | 3,203 | [
"MIT"
] | 0 | f45d5a61ed9039ae7d0cd615d95212f11a5a2086 | https://github.com/belbahrim/twin-causal-net/tree/f45d5a61ed9039ae7d0cd615d95212f11a5a2086 |
TwoLayerNet | import torch
class TwoLayerNet(torch.nn.Module):
"""
This class is copied from PyTorch's documentation and is meant to be the
simplest, non-trivial custom NN we can use for testing provenance.
See [here](https://pytorch.org/tutorials/beginner/examples_nn/two_layer_net_module.html#sphx-glr-beginner-exa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | benfogelson/provenance | TwoLayerNet | false | 3,204 | [
"MIT"
] | 0 | e61095e767e8786943ea76bef9b5dd6dd9575041 | https://github.com/benfogelson/provenance/tree/e61095e767e8786943ea76bef9b5dd6dd9575041 |
Conv2dBlock | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | belphegor2211/KLTN_GANwriting | Conv2dBlock | false | 3,205 | [
"MIT"
] | 0 | 67d4d5c286ec45ef704b49c5abf9774d38bf65eb | https://github.com/belphegor2211/KLTN_GANwriting/tree/67d4d5c286ec45ef704b49c5abf9774d38bf65eb |
Biaffine | import torch
import torch.nn as nn
import torch.utils.checkpoint
class Biaffine(nn.Module):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True):
super(Biaffine, self).__init__()
self.n_in = n_in
self.n_out = n_out
self.bias_x = bias_x
self.bias_y = bias_y
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.checkpoint
assert_size_stride = torch._... | benjamin-mlr/lightning-language-modeling | Biaffine | false | 3,206 | [
"Apache-2.0"
] | 0 | 62b497cc2a01bdae0451ebe0f314f7fcb0f7eef3 | https://github.com/benjamin-mlr/lightning-language-modeling/tree/62b497cc2a01bdae0451ebe0f314f7fcb0f7eef3 |
ActFirstResBlock | import torch
import torch.nn.functional as F
from torch import nn
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | belphegor2211/KLTN_GANwriting | ActFirstResBlock | false | 3,207 | [
"MIT"
] | 0 | 67d4d5c286ec45ef704b49c5abf9774d38bf65eb | https://github.com/belphegor2211/KLTN_GANwriting/tree/67d4d5c286ec45ef704b49c5abf9774d38bf65eb |
PrimaryCapsLayer | import torch
import torch.nn as nn
def squash(x):
lengths2 = x.pow(2).sum(dim=2)
lengths = lengths2.sqrt()
x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1)
return x
class PrimaryCapsLayer(nn.Module):
def __init__(self, input_channels, output_caps, output_dim, kernel_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | bentrevett/capsules | PrimaryCapsLayer | false | 3,208 | [
"MIT"
] | 0 | 239273de25c607d7a7504e8c6900772fddd15cd3 | https://github.com/bentrevett/capsules/tree/239273de25c607d7a7504e8c6900772fddd15cd3 |
policy_net | import torch
import torch.nn.functional as F
import torch.nn as nn
class policy_net(nn.Module):
def __init__(self, n_states, n_actions, n_hidden=128):
super(policy_net, self).__init__()
self.affine1 = nn.Linear(n_states, n_hidden)
self.affine2 = nn.Linear(n_hidden, n_actions)
def for... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | bigtreeljc/force_learning | policy_net | false | 3,209 | [
"MIT"
] | 0 | 183a7c96c411e282966604e3cb375ba49e91a88c | https://github.com/bigtreeljc/force_learning/tree/183a7c96c411e282966604e3cb375ba49e91a88c |
spectral_model | import torch
import torch.nn as nn
import torch.nn.functional as F
class spectral_model(nn.Module):
def __init__(self, num_classes):
super(spectral_model, self).__init__()
self.mlp1 = nn.Conv1d(6, 64, 1)
self.mlp2 = nn.Conv1d(64, 128, 1)
self.mlp3 = nn.Conv1d(128, 256, 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_... | berkbilir/point-cloud-classification | spectral_model | false | 3,210 | [
"MIT"
] | 0 | 4188b317acc8efccb694831b26a3a8564dee5530 | https://github.com/berkbilir/point-cloud-classification/tree/4188b317acc8efccb694831b26a3a8564dee5530 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.