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 |
|---|---|---|---|---|---|---|---|---|---|---|
ConvBlock | import torch
import torch.nn as nn
from math import *
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self):
super(ConvBlock, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
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
from ma... | a8252525/NIID-Bench | ConvBlock | false | 3,007 | [
"MIT"
] | 0 | 33df8d3a7b941884eec3c7bd52adb8a9476eb282 | https://github.com/a8252525/NIID-Bench/tree/33df8d3a7b941884eec3c7bd52adb8a9476eb282 |
Unet | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout=False, norm=
'batch', residual=True, activation='leakyrelu', transpose=False):
super(ConvBlock, self).__init__()
self.dropout = dropout
self.residual = residual
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | XinweiYu/noise2self | Unet | false | 3,008 | [
"MIT"
] | 0 | 04e0379a67e1cb0c807abd3f8d4fd1666db5a793 | https://github.com/XinweiYu/noise2self/tree/04e0379a67e1cb0c807abd3f8d4fd1666db5a793 |
ResNetV2 | import torch
import torch.nn as nn
from collections import OrderedDict
import torch.nn.functional as F
def conv1x1(cin, cout, stride=1, bias=False):
return StdConv2d(cin, cout, kernel_size=1, stride=stride, padding=0,
bias=bias)
def conv3x3(cin, cout, stride=1, groups=1, bias=False):
return StdConv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HodaEb/ViT-pytorch | ResNetV2 | false | 3,009 | [
"MIT"
] | 0 | 2643740b1d846ae666635bb0f5a71bceba208675 | https://github.com/HodaEb/ViT-pytorch/tree/2643740b1d846ae666635bb0f5a71bceba208675 |
TransformerLayer | import torch
import numpy as np
import torch.nn as nn
import torch.distributions
class MultiHeadAttention(nn.Module):
def __init__(self, d_model, n_heads, kq_same=False, bias=True):
super().__init__()
"""
It has projection layer for getting keys, queries and values. Followed by attention.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Yingting-dev/ReChorus | TransformerLayer | false | 3,010 | [
"MIT"
] | 0 | a16bc1e42f3e90e889133d7476c52ada44db573b | https://github.com/Yingting-dev/ReChorus/tree/a16bc1e42f3e90e889133d7476c52ada44db573b |
Discriminator | import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 64, kernel_size=5, padding=2)
self.activation1 = nn.Tanh()
self.maxpool1 = nn.MaxPool2d(kernel_size=(2, 2))
self.conv2 = nn.Conv2d(64, 128, k... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ziems/pytorch-dcgan | Discriminator | false | 3,011 | [
"MIT"
] | 0 | 1a251a330b9b0df6061a10463bce8057f1230797 | https://github.com/Ziems/pytorch-dcgan/tree/1a251a330b9b0df6061a10463bce8057f1230797 |
SelfAttention | import math
import torch
import torch.nn as nn
from torch.autograd import *
class SelfAttention(nn.Module):
dim_in: 'int'
dim_k: 'int'
dim_v: 'int'
def __init__(self, dim_in, dim_k, dim_v):
super(SelfAttention, self).__init__()
self.dim_in = dim_in
self.dim_k = dim_k
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.... | YapingZ/News-image-caption | SelfAttention | false | 3,012 | [
"Apache-2.0"
] | 0 | fcccf51bbe5607adbf71c1da8ecdc6693555993f | https://github.com/YapingZ/News-image-caption/tree/fcccf51bbe5607adbf71c1da8ecdc6693555993f |
BasicBlock | import torch
import torch.utils.data
import torch.nn as nn
def conv3x3(in_planes, out_planes, dilation=1, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=int(dilation * (3 - 1) / 2), dilation=dilation, bias=False)
class Basi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ZurMaD/DAIN | BasicBlock | false | 3,013 | [
"MIT"
] | 0 | 22570e51e84f7dfd48ba4f88e6ee7c9ff1b0b123 | https://github.com/ZurMaD/DAIN/tree/22570e51e84f7dfd48ba4f88e6ee7c9ff1b0b123 |
SimpleNet | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
class SimpleNet(nn.Module):
def __init__(self):
super(SimpleNet, self).__init__()
self.fc1 = nn.Linear(12288, 84)
self.fc2 = nn.Linear(84, 50)
self.fc3 = nn.Linear(50, 2)
def forward(se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | aakgun/pytorch-VideoDataset | SimpleNet | false | 3,014 | [
"MIT"
] | 0 | 619e385f37b99bfabca0b814673825ed902242b2 | https://github.com/aakgun/pytorch-VideoDataset/tree/619e385f37b99bfabca0b814673825ed902242b2 |
WineLoss | import torch
import torch.nn as nn
class WineLoss(nn.Module):
def __init__(self):
super(WineLoss, self).__init__()
self.smoothl1 = nn.SmoothL1Loss()
def forward(self, pred, label):
loss = self.smoothl1(pred, label)
return loss
def get_inputs():
return [torch.rand([4, 4,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ZhongyuanW/foundation_wines | WineLoss | false | 3,015 | [
"Apache-2.0"
] | 0 | 92b9ae0ece46ecd291a9101ebef9e9421ead92d6 | https://github.com/ZhongyuanW/foundation_wines/tree/92b9ae0ece46ecd291a9101ebef9e9421ead92d6 |
SA | import torch
import torch.nn as nn
class SA(nn.Module):
def __init__(self, kernel_size=7):
super(SA, self).__init__()
assert kernel_size in (3, 7)
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv2d(2, 1, kernel_size=kernel_size, padding=padding)
self.sigmoid = 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 import triton_helpers
import torch.nn as nn
assert_... | ZhijieXiao-0624/CNXA | SA | false | 3,016 | [
"MIT"
] | 0 | a63b3561010cf87f696a005f8ea252e7cdaa7ca2 | https://github.com/ZhijieXiao-0624/CNXA/tree/a63b3561010cf87f696a005f8ea252e7cdaa7ca2 |
GELU | import torch
import torch.nn as nn
import torch.nn.functional as F
class GELU(nn.Module):
def forward(self, input):
return F.gelu(input)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | ag8/mrl | GELU | false | 3,017 | [
"MIT"
] | 0 | f05b00347f88020cbeb216c7e4764a4d2523b67e | https://github.com/ag8/mrl/tree/f05b00347f88020cbeb216c7e4764a4d2523b67e |
TransformerDecoderLayer | import torch
from typing import Optional
from torch import nn
def _get_activation_fn(activation: 'str'):
if activation == 'relu':
return nn.functional.relu
elif activation == 'gelu':
return nn.functional.gelu
raise RuntimeError('activation should be relu/gelu, not {}'.format(
activ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | aarora8/icefall | TransformerDecoderLayer | false | 3,018 | [
"Apache-2.0"
] | 0 | 8cb7f712e413fffbcdfdd865be73d6ff43f0ce7a | https://github.com/aarora8/icefall/tree/8cb7f712e413fffbcdfdd865be73d6ff43f0ce7a |
SE | import torch
import torch.nn as nn
import torch.nn.functional as F
def swish(x):
return x * x.sigmoid()
class SE(nn.Module):
"""Squeeze-and-Excitation block with Swish."""
def __init__(self, in_planes, se_planes):
super(SE, self).__init__()
self.se1 = nn.Conv2d(in_planes, se_planes, ker... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | adarsh-kr/CVModelsBenchmark | SE | false | 3,019 | [
"MIT"
] | 0 | 85aeb76c7c796d86baa97e1272aea83d734665b5 | https://github.com/adarsh-kr/CVModelsBenchmark/tree/85aeb76c7c796d86baa97e1272aea83d734665b5 |
TransformerEncoderLayer | import torch
from typing import Optional
from torch import nn
def _get_activation_fn(activation: 'str'):
if activation == 'relu':
return nn.functional.relu
elif activation == 'gelu':
return nn.functional.gelu
raise RuntimeError('activation should be relu/gelu, not {}'.format(
activ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | aarora8/icefall | TransformerEncoderLayer | false | 3,020 | [
"Apache-2.0"
] | 0 | 8cb7f712e413fffbcdfdd865be73d6ff43f0ce7a | https://github.com/aarora8/icefall/tree/8cb7f712e413fffbcdfdd865be73d6ff43f0ce7a |
SimpleFC | import torch
import torch.nn as nn
import torch.onnx
class SimpleFC(nn.Module):
def __init__(self, input_size, num_classes, name='SimpleFC'):
super(SimpleFC, self).__init__()
self.FC = nn.Parameter(torch.randn([input_size, num_classes]))
self.FCbias = nn.Parameter(torch.randn([num_classes... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.onnx
assert_size_stride = torch._C._dynamo.gu... | adityakusupati/EdgeML | SimpleFC | false | 3,021 | [
"MIT"
] | 0 | 65933a6fdfc38945f4311043a62e120784b2b0bf | https://github.com/adityakusupati/EdgeML/tree/65933a6fdfc38945f4311043a62e120784b2b0bf |
DummyAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class DummyAttention(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.linear1 = nn.Linear(in_channels, 32)
self.linear2 = nn.Linear(32, 1)
pass
def forward(self, net):
value = net
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | aaalgo/health_outcome_challenge | DummyAttention | false | 3,022 | [
"BSD-3-Clause"
] | 0 | 6d0cb660123ac6fb4939c1d50a8f1914e8e3e165 | https://github.com/aaalgo/health_outcome_challenge/tree/6d0cb660123ac6fb4939c1d50a8f1914e8e3e165 |
ProtoNN | import torch
import numpy as np
import torch.nn as nn
import torch.onnx
class ProtoNN(nn.Module):
def __init__(self, inputDimension, projectionDimension, numPrototypes,
numOutputLabels, gamma, W=None, B=None, Z=None):
"""
Forward computation graph for ProtoNN.
inputDimension: Inp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy ... | adityakusupati/EdgeML | ProtoNN | false | 3,023 | [
"MIT"
] | 0 | 65933a6fdfc38945f4311043a62e120784b2b0bf | https://github.com/adityakusupati/EdgeML/tree/65933a6fdfc38945f4311043a62e120784b2b0bf |
ReferenceWeightBinarizationModule | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class ReferenceDOREFABinarize(torch.autograd.Function):
@staticmethod
def forward(ctx, x):
norm = x.abs(... | 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
from torch import nn
from torchvision import models as models
import torc... | JinYAnGHe/openvino_training_extensions | ReferenceWeightBinarizationModule | false | 3,024 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
StateInitZero | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class StateInitZero(nn.Module):
def __init__(self, hidden_size, num_layers=1, batch_first=False):
super(Stat... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import tor... | JinYAnGHe/openvino_training_extensions | StateInitZero | false | 3,025 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
FakeReLUM | import torch
import torch.nn as nn
from typing import *
import torch.utils.data
class FakeReLU(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
return input.clamp(min=0)
@staticmethod
def backward(ctx, grad_output):
return grad_output
class FakeReLUM(nn.Module):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from typing import *
import torch.utils.data
assert_size_stride = t... | agarwalsiddhant10/blackbox-smoothing | FakeReLUM | false | 3,026 | [
"MIT"
] | 0 | cf18a9dc45f807494955d0cf19a3d1dd4315b54f | https://github.com/agarwalsiddhant10/blackbox-smoothing/tree/cf18a9dc45f807494955d0cf19a3d1dd4315b54f |
Conv2dSame | import math
import torch
import torch.utils.data
import torch
import torch.nn as nn
class Conv2dSame(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
dilation=1):
super(Conv2dSame, self).__init__()
self.F = kernel_size
self.S = stride
self.D... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | adityamehta00/HIDeGAN | Conv2dSame | false | 3,027 | [
"BSD-3-Clause"
] | 0 | 91a0674e092ccde2784a82bf927dfefd8673eb4c | https://github.com/adityamehta00/HIDeGAN/tree/91a0674e092ccde2784a82bf927dfefd8673eb4c |
VAE | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.init as init
def kaiming_init(m):
if isinstance(m, (nn.Linear, nn.Conv2d)):
init.kaiming_normal(m.weight)
if m.bias is not None:
m.bias.data.fill_(0)
elif isinstance(m, (nn.BatchNorm1d, nn.BatchNorm2d)):
... | 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 import triton_helpers
from... | aasensio/neural_hinode | VAE | false | 3,028 | [
"MIT"
] | 0 | 63ec076d920f82343618ce67669c73a3b5209957 | https://github.com/aasensio/neural_hinode/tree/63ec076d920f82343618ce67669c73a3b5209957 |
UGRNNLRCell | import torch
import torch.nn as nn
import torch.onnx
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm', 'quantSigm4']
"""
if nonlinear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | adityakusupati/EdgeML | UGRNNLRCell | false | 3,029 | [
"MIT"
] | 0 | 65933a6fdfc38945f4311043a62e120784b2b0bf | https://github.com/adityakusupati/EdgeML/tree/65933a6fdfc38945f4311043a62e120784b2b0bf |
LSTMPredictor | import torch
import torch.nn as nn
class LSTMPredictor(nn.Module):
def __init__(self, look_back, target_days):
super(LSTMPredictor, self).__init__()
self.layer_a = nn.Linear(look_back, 32)
self.relu = nn.ReLU()
self.output = nn.Linear(32, target_days)
def predict(self, input)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Yu-Hao-88/NN_stock_prediction | LSTMPredictor | false | 3,030 | [
"MIT"
] | 0 | bb84a3f4450d95af317d60d83dcd53ad4f3d350d | https://github.com/Yu-Hao-88/NN_stock_prediction/tree/bb84a3f4450d95af317d60d83dcd53ad4f3d350d |
ReconstructionBlock | import math
import torch
import torch.utils.data
import torch
import torch.nn as nn
class Conv2dSame(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
dilation=1):
super(Conv2dSame, self).__init__()
self.F = kernel_size
self.S = stride
self.D... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.util... | adityamehta00/HIDeGAN | ReconstructionBlock | false | 3,031 | [
"BSD-3-Clause"
] | 0 | 91a0674e092ccde2784a82bf927dfefd8673eb4c | https://github.com/adityamehta00/HIDeGAN/tree/91a0674e092ccde2784a82bf927dfefd8673eb4c |
FastRNNCell | import torch
import torch.nn as nn
import torch.onnx
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm', 'quantSigm4']
"""
if nonlinear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | adityakusupati/EdgeML | FastRNNCell | false | 3,032 | [
"MIT"
] | 0 | 65933a6fdfc38945f4311043a62e120784b2b0bf | https://github.com/adityakusupati/EdgeML/tree/65933a6fdfc38945f4311043a62e120784b2b0bf |
LocallyConnectedLayer1d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
class LocallyConnectedLayer1d(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, stride, padding=
True, bias=False):
"""
Defines one locally connected layer for one dimensional vector input.... | 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.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | adityayedetore/LCRNN | LocallyConnectedLayer1d | false | 3,033 | [
"MIT"
] | 0 | 7b6afaf6098fed584b90fe0196cfd26aa6a190c5 | https://github.com/adityayedetore/LCRNN/tree/7b6afaf6098fed584b90fe0196cfd26aa6a190c5 |
AugCNN | import torch
import torch.nn as nn
import torch.nn.functional as F
def apply_init_(modules):
"""
Initialize NN modules
"""
for m in modules:
if isinstance(m, nn.Conv2d):
nn.init.xavier_uniform_(m.weight)
if m.bias is not None:
nn.init.constant_(m.bias, 0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | agarwl/auto-drac | AugCNN | false | 3,034 | [
"MIT"
] | 0 | d86c480b51929e6e4ec0ae1adba84d9f78e91705 | https://github.com/agarwl/auto-drac/tree/d86c480b51929e6e4ec0ae1adba84d9f78e91705 |
GRULRCell | import torch
import torch.nn as nn
import torch.onnx
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm', 'quantSigm4']
"""
if nonlinear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | adityakusupati/EdgeML | GRULRCell | false | 3,035 | [
"MIT"
] | 0 | 65933a6fdfc38945f4311043a62e120784b2b0bf | https://github.com/adityakusupati/EdgeML/tree/65933a6fdfc38945f4311043a62e120784b2b0bf |
RGBDiff | import torch
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.onnx
class RGBDiff(nn.Module):
def __init__(self, dim=1):
super().__init__()
self.dim = dim
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
from torch import nn
from torchvision import models as models
import torch.nn.parallel
import torch.optim
import torch.utils.data
import tor... | JinYAnGHe/openvino_training_extensions | RGBDiff | false | 3,036 | [
"Apache-2.0"
] | 0 | a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee | https://github.com/JinYAnGHe/openvino_training_extensions/tree/a0b4456a3c9fe6c1b7eabc9d5eb4e74d01453dee |
BiaffineScorer | import torch
import torch.nn as nn
class BiaffineScorer(nn.Module):
def __init__(self, input1_size, input2_size, output_size):
super().__init__()
self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1,
output_size)
self.W_bilin.weight.data.zero_()
self.W_bilin.bia... | 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... | WEYAI/PhoNLP | BiaffineScorer | false | 3,037 | [
"Apache-2.0"
] | 0 | 8fefe49965dc6346c224a5636d9333a7ddf55a2c | https://github.com/WEYAI/PhoNLP/tree/8fefe49965dc6346c224a5636d9333a7ddf55a2c |
DHead | import torch
import torch.nn as nn
from math import *
class DHead(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Conv2d(256, 1, 4)
def forward(self, x):
output = torch.sigmoid(self.conv(x))
return output
def get_inputs():
return [torch.rand([4, 256, 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
import torch.nn as nn
from math import *
assert_size_stride = torch._C._dynamo.g... | a8252525/NIID-Bench | DHead | false | 3,038 | [
"MIT"
] | 0 | 33df8d3a7b941884eec3c7bd52adb8a9476eb282 | https://github.com/a8252525/NIID-Bench/tree/33df8d3a7b941884eec3c7bd52adb8a9476eb282 |
FeatureExtractionBlock | import math
import torch
import torch.utils.data
import torch
import torch.nn as nn
class Conv2dSame(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
dilation=1):
super(Conv2dSame, self).__init__()
self.F = kernel_size
self.S = stride
self.D... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.util... | adityamehta00/HIDeGAN | FeatureExtractionBlock | false | 3,039 | [
"BSD-3-Clause"
] | 0 | 91a0674e092ccde2784a82bf927dfefd8673eb4c | https://github.com/adityamehta00/HIDeGAN/tree/91a0674e092ccde2784a82bf927dfefd8673eb4c |
FastGRNNCell | import torch
import torch.nn as nn
import torch.onnx
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm', 'quantSigm4']
"""
if nonlinear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | adityakusupati/EdgeML | FastGRNNCell | false | 3,040 | [
"MIT"
] | 0 | 65933a6fdfc38945f4311043a62e120784b2b0bf | https://github.com/adityakusupati/EdgeML/tree/65933a6fdfc38945f4311043a62e120784b2b0bf |
Actor | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, 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.... | ahgit2021/deep-reinforcement-learning | Actor | false | 3,041 | [
"MIT"
] | 0 | 081464ba45f803663e841e1635d829aa00cce870 | https://github.com/ahgit2021/deep-reinforcement-learning/tree/081464ba45f803663e841e1635d829aa00cce870 |
FitNet | import torch
import torch.nn as nn
class FitNet(nn.Module):
def __init__(self, in_feature, out_feature):
super().__init__()
self.in_feature = in_feature
self.out_feature = out_feature
self.transform = nn.Conv2d(in_feature, out_feature, 1, bias=False)
self.transform.weight.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ahu-hpt/AOMD | FitNet | false | 3,043 | [
"Apache-2.0"
] | 0 | 8d99dbb803feaef55fc089bfb3399d2fb21d55d8 | https://github.com/ahu-hpt/AOMD/tree/8d99dbb803feaef55fc089bfb3399d2fb21d55d8 |
AE | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn
class AE(nn.Module):
def __init__(self, num_channels):
super(AE, self).__init__()
self.enc1 = nn.Conv2d(num_channels, 64, kernel_size=3, padding=1)
self.enc2 = nn.Conv2d(64, 32, kernel_size=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
import torch.nn as nn
import ... | ahanagemini/Phd_final_year_old_sr | AE | false | 3,045 | [
"BSD-2-Clause"
] | 0 | 62be9d1294acdb724a2fe424789b657a44e2cd7d | https://github.com/ahanagemini/Phd_final_year_old_sr/tree/62be9d1294acdb724a2fe424789b657a44e2cd7d |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | ahgit2021/deep-reinforcement-learning | Critic | false | 3,046 | [
"MIT"
] | 0 | 081464ba45f803663e841e1635d829aa00cce870 | https://github.com/ahgit2021/deep-reinforcement-learning/tree/081464ba45f803663e841e1635d829aa00cce870 |
Network | import torch
import torch.nn as nn
class Network(nn.Module):
def __init__(self, number_of_inputs, number_of_outputs):
super(Network, self).__init__()
self.l1 = nn.Linear(number_of_inputs, number_of_inputs)
self.l2 = nn.Linear(number_of_inputs, number_of_inputs)
self.l3 = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ajthinking/migration-analysis | Network | false | 3,047 | [
"MIT"
] | 0 | c48312c5bf513a37e23eaaf8aa245921992f8e7f | https://github.com/ajthinking/migration-analysis/tree/c48312c5bf513a37e23eaaf8aa245921992f8e7f |
AttentionTransfer | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionTransfer(nn.Module):
def forward(self, student, teacher):
s_attention = F.normalize(student.pow(2).mean(1).view(student.size(
0), -1))
with torch.no_grad():
t_attention = F.normalize(teacher.... | 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... | ahu-hpt/AOMD | AttentionTransfer | false | 3,048 | [
"Apache-2.0"
] | 0 | 8d99dbb803feaef55fc089bfb3399d2fb21d55d8 | https://github.com/ahu-hpt/AOMD/tree/8d99dbb803feaef55fc089bfb3399d2fb21d55d8 |
HardDarkRank | import torch
import torch.nn as nn
def pdist(e, squared=False, eps=1e-12):
e_square = e.pow(2).sum(dim=1)
prod = e @ e.t()
res = (e_square.unsqueeze(1) + e_square.unsqueeze(0) - 2 * prod).clamp(min
=eps)
if not squared:
res = res.sqrt()
res = res.clone()
res[range(len(e)), rang... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ahu-hpt/AOMD | HardDarkRank | false | 3,049 | [
"Apache-2.0"
] | 0 | 8d99dbb803feaef55fc089bfb3399d2fb21d55d8 | https://github.com/ahu-hpt/AOMD/tree/8d99dbb803feaef55fc089bfb3399d2fb21d55d8 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
def __init__(self, num_channels, embed_size, dropout=True):
"""Stacked attention Module
"""
super(Attention, self).__init__()
self.ff_image = nn.Linear(embed_size, num_channels)
self.ff_questions = nn.Linear(em... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ahmed563/Group14_Project_DLSpring2021 | Attention | false | 3,050 | [
"MIT"
] | 0 | d2b03555cadb483ae472b613f107173f89c07d9b | https://github.com/ahmed563/Group14_Project_DLSpring2021/tree/d2b03555cadb483ae472b613f107173f89c07d9b |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
def set_init(layers):
for layer in layers:
nn.init.normal_(layer.weight, mean=0.0, std=0.1)
nn.init.constant_(layer.bias, 0.0)
class Net(nn.Module):
def __init__(self, s_dim, a_dim, hidden=16):
super(Net, self).__ini... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | aivaslab/marlgrid | Net | false | 3,051 | [
"Apache-2.0"
] | 0 | 10b53d27ce224fadeeb5830d6034350a69feb4b4 | https://github.com/aivaslab/marlgrid/tree/10b53d27ce224fadeeb5830d6034350a69feb4b4 |
Actor | import torch
import numpy as np
from torch import nn
from torch.nn import functional as F
class Actor(nn.Module):
def __init__(self, input_dim, output_dim):
super(Actor, self).__init__()
self.layer1 = nn.Linear(input_dim, output_dim, bias=True)
def _format(self, state):
x = state
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ajy8456/active-recognition | Actor | false | 3,052 | [
"MIT"
] | 0 | 7d3a4bbfceaf5fb32cd43f62636f36a10ab63807 | https://github.com/ajy8456/active-recognition/tree/7d3a4bbfceaf5fb32cd43f62636f36a10ab63807 |
ContractingBlock | 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
assert_s... | akanametov/unet-pytorch | ContractingBlock | false | 3,054 | [
"MIT"
] | 0 | 6cf0f70674958356ea4ac36fe61b0415921f72ae | https://github.com/akanametov/unet-pytorch/tree/6cf0f70674958356ea4ac36fe61b0415921f72ae |
SqueezeExcitation | import torch
import torch.nn as nn
import torch.nn.functional as F
def make_divisible(v, divisor=8, min_value=None):
"""
The channel number of each layer should be divisable by 8.
The function is taken from
github.com/rwightman/pytorch-image-models/master/timm/models/layers/helpers.py
"""
min_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | akashAD98/EfficientNetv2-with-Detectron2 | SqueezeExcitation | false | 3,055 | [
"Apache-2.0"
] | 0 | 1ba7f32cda31550ed4a040c15271612fa3f73d74 | https://github.com/akashAD98/EfficientNetv2-with-Detectron2/tree/1ba7f32cda31550ed4a040c15271612fa3f73d74 |
SimpleGCN | import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.nn import Parameter
import torch.nn
import torch.autograd
class SimpleGCN(nn.Module):
"""A simple graph convolution layer, similar to the one defined in
Kipf et al. https://arxiv.org/abs/1609.02907
.. note:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
from torch.nn.parameter import Parameter
from ... | akashgokul/kaolin | SimpleGCN | false | 3,056 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 6360c4f2bcdd81f461dfb4d96267e79d89d5e112 | https://github.com/akashgokul/kaolin/tree/6360c4f2bcdd81f461dfb4d96267e79d89d5e112 |
Discriminator | import torch
from torch import nn
class Discriminator(nn.Module):
def __init__(self, in_features=1):
super(Discriminator, self).__init__()
self.conv1 = nn.Conv2d(in_features, 96, kernel_size=7, stride=4)
self.relu = nn.ReLU()
self.conv2 = nn.Conv2d(96, 64, kernel_size=5, stride=2)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ajdillhoff/simgan-pytorch | Discriminator | false | 3,057 | [
"MIT"
] | 0 | fb61241a85136aae770944e1496f9319df327561 | https://github.com/ajdillhoff/simgan-pytorch/tree/fb61241a85136aae770944e1496f9319df327561 |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self, input_shape, output_shape):
super(Encoder, self).__init__()
self.input_shape = input_shape
self.encoder_out_shape = output_shape
self.linear_one = nn.Linear(self.input_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | akaprasanga/AutoEncoder | Encoder | false | 3,058 | [
"MIT"
] | 0 | a1562a7a720c199b717796e469b9957eb958264a | https://github.com/akaprasanga/AutoEncoder/tree/a1562a7a720c199b717796e469b9957eb958264a |
Decoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Decoder(nn.Module):
def __init__(self, input_shape, output_shape):
super(Decoder, self).__init__()
self.input_shape = input_shape
self.decoder_out_shape = output_shape
self.linear_one = nn.Linear(self.input_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | akaprasanga/AutoEncoder | Decoder | false | 3,059 | [
"MIT"
] | 0 | a1562a7a720c199b717796e469b9957eb958264a | https://github.com/akaprasanga/AutoEncoder/tree/a1562a7a720c199b717796e469b9957eb958264a |
Model | import torch
from torch import nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, input, hidden, output):
super(Model, self).__init__()
self.l1 = nn.Linear(input, hidden)
self.l2 = nn.Linear(hidden, hidden)
self.l3 = nn.Linear(hidden, 2)
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
from torch import nn
assert_s... | akapoorx00/machinelearning-stuff | Model | false | 3,060 | [
"Apache-2.0"
] | 0 | 53184019b77d3387fd15b13d3bfa75529b8ed003 | https://github.com/akapoorx00/machinelearning-stuff/tree/53184019b77d3387fd15b13d3bfa75529b8ed003 |
DiscShiftLoss | import torch
import torch.nn as nn
class DiscShiftLoss(nn.Module):
"""Disc shift loss.
Args:
loss_weight (float, optional): Loss weight. Defaults to 1.0.
"""
def __init__(self, loss_weight=0.1):
super().__init__()
self.loss_weight = loss_weight
def forward(self, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | akimotty877/mmediting | DiscShiftLoss | false | 3,061 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
Net | import torch
from torch import nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, input, hidden, output):
super(Net, self).__init__()
self.l1 = nn.Linear(input, hidden)
self.l2 = nn.Linear(hidden, hidden)
self.l3 = nn.Linear(hidden, hidden)
self.l4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | akapoorx00/machinelearning-stuff | Net | false | 3,062 | [
"Apache-2.0"
] | 0 | 53184019b77d3387fd15b13d3bfa75529b8ed003 | https://github.com/akapoorx00/machinelearning-stuff/tree/53184019b77d3387fd15b13d3bfa75529b8ed003 |
CharbonnierCompLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | 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 functools
import torc... | akimotty877/mmediting | CharbonnierCompLoss | false | 3,063 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
BboxHead | import torch
from torch import nn
import torch.nn
class BboxHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(BboxHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=(
1, 1), stride=1, padding=0)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn
assert_size_stride = torch._C._dynamo.guard... | ZongqingHou/Pytorch_Retinaface | BboxHead | false | 3,064 | [
"MIT"
] | 0 | 6284b7158a0d9d3d4a2cc267a393c21863a1b938 | https://github.com/ZongqingHou/Pytorch_Retinaface/tree/6284b7158a0d9d3d4a2cc267a393c21863a1b938 |
MSECompositionLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | 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 functools
import torch.nn as nn
from torch.nn import functional as F
assert_size_s... | akimotty877/mmediting | MSECompositionLoss | false | 3,065 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
L1CompositionLoss | import functools
import torch
import torch.nn as nn
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: Reduced lo... | 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 functools
impor... | akimotty877/mmediting | L1CompositionLoss | false | 3,066 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
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_... | akashrajkn/sarcastic-gradients | CustomBatchNormManualModule | false | 3,067 | [
"Apache-2.0"
] | 0 | 5a995ab7822dfd49cdc88855c631dcc8f1b0532f | https://github.com/akashrajkn/sarcastic-gradients/tree/5a995ab7822dfd49cdc88855c631dcc8f1b0532f |
EqualLinearActModule | import torch
import torch.nn as nn
from copy import deepcopy
from functools import partial
from torch.nn.init import _calculate_correct_fan
def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in',
lr_mul=1.0):
"""Equalized Learning Rate.
This trick is proposed in:
Progressive Growing of ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from copy import deepcopy
from functools import partial
fr... | akimotty877/mmediting | EqualLinearActModule | false | 3,068 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
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_... | akashrajkn/sarcastic-gradients | CustomBatchNormAutograd | false | 3,069 | [
"Apache-2.0"
] | 0 | 5a995ab7822dfd49cdc88855c631dcc8f1b0532f | https://github.com/akashrajkn/sarcastic-gradients/tree/5a995ab7822dfd49cdc88855c631dcc8f1b0532f |
MaxFeature | import torch
import torch.nn as nn
class MaxFeature(nn.Module):
"""Conv2d or Linear layer with max feature selector
Generate feature maps with double channels, split them and select the max
feature.
Args:
in_channels (int): Channel number of inputs.
out_channels (int): Channel nu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | akimotty877/mmediting | MaxFeature | false | 3,070 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
PlainRefiner | import torch
import torch.nn as nn
class PlainRefiner(nn.Module):
"""Simple refiner from Deep Image Matting.
Args:
conv_channels (int): Number of channels produced by the three main
convolutional layer.
loss_refine (dict): Config of the loss of the refiner. Default: None.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | akimotty877/mmediting | PlainRefiner | false | 3,071 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
network | import torch
import torch.nn as nn
import torch.nn.functional as F
class network(nn.Module):
def __init__(self, state_size, action_size, seed=0):
super(network, self).__init__()
self.seed = torch.manual_seed(seed)
self.fc1 = nn.Linear(state_size, 32)
self.fc2 = nn.Linear(32, 32)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | akashkmr27089/ReinforcementLearning_Udacity_Deep_Reinforcemnt_Learning | network | false | 3,072 | [
"MIT"
] | 0 | b7dc13b0116898848d8d0b8a95b7af182982bd6b | https://github.com/akashkmr27089/ReinforcementLearning_Udacity_Deep_Reinforcemnt_Learning/tree/b7dc13b0116898848d8d0b8a95b7af182982bd6b |
MultiLayeredConv1d | import torch
class MultiLayeredConv1d(torch.nn.Module):
"""Multi-layered conv1d for Transformer block.
This is a module of multi-leyered conv1d designed to replace positionwise feed-forward network
in Transforner block, which is introduced in `FastSpeech: Fast, Robust and Controllable Text to Speech`_.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | akreal/end-to-end-slu-espnet | MultiLayeredConv1d | false | 3,073 | [
"Apache-2.0"
] | 0 | 0b16dc8b10b31a4567b3312678a753a94bb200da | https://github.com/akreal/end-to-end-slu-espnet/tree/0b16dc8b10b31a4567b3312678a753a94bb200da |
ClassHead | import torch
from torch import nn
import torch.nn
class ClassHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(ClassHead, self).__init__()
self.num_anchors = num_anchors
self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 2,
kernel_size=(1, 1), stri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn
assert_size_stride = torch._C._dynamo.guard... | ZongqingHou/Pytorch_Retinaface | ClassHead | false | 3,074 | [
"MIT"
] | 0 | 6284b7158a0d9d3d4a2cc267a393c21863a1b938 | https://github.com/ZongqingHou/Pytorch_Retinaface/tree/6284b7158a0d9d3d4a2cc267a393c21863a1b938 |
Intensity | import torch
import torch.nn as nn
class Intensity(nn.Module):
def __init__(self, scale):
super().__init__()
self.scale = scale
def forward(self, x):
r = torch.randn((x.size(0), 1, 1, 1), device=x.device)
noise = 1.0 + self.scale * r.clamp(-2.0, 2.0)
return x * noise
... | 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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guar... | alcinos/SPR | Intensity | false | 3,075 | [
"MIT"
] | 0 | dec8df83eeaa25a1d75ecff0cf4ce4bfae9cab4c | https://github.com/alcinos/SPR/tree/dec8df83eeaa25a1d75ecff0cf4ce4bfae9cab4c |
Entropy | import torch
import torch.nn.functional as F
import torch.nn as nn
class Entropy(nn.Module):
def __init__(self):
super(Entropy, self).__init__()
def forward(self, x):
num, ms1, ms2 = x.size()
ent_p2g = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
ent_g2p = F.softmax(x, dim=2... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | akira-l/online_mmdetection | Entropy | false | 3,076 | [
"Apache-2.0"
] | 0 | 10c60467a57a605b783486b7fbc508776394ea79 | https://github.com/akira-l/online_mmdetection/tree/10c60467a57a605b783486b7fbc508776394ea79 |
CifarDownsampling | import torch
import torch.nn as nn
import torch.nn.functional as F
class CifarDownsampling(nn.Module):
def __init__(self, planes):
super(CifarDownsampling, self).__init__()
self.planes = planes
def forward(self, x):
return F.pad(x[:, :, ::2, ::2], (0, 0, 0, 0, self.planes // 4, 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... | alechat/PLCiL | CifarDownsampling | false | 3,077 | [
"Apache-2.0"
] | 0 | f71fe92cb7781097d3320c28601e06add70f64f9 | https://github.com/alechat/PLCiL/tree/f71fe92cb7781097d3320c28601e06add70f64f9 |
ModulatedToRGB | import torch
import torch.nn as nn
from copy import deepcopy
from functools import partial
from torch.nn import functional as F
from torch.nn.init import _calculate_correct_fan
def equalized_lr(module, name='weight', gain=2 ** 0.5, mode='fan_in',
lr_mul=1.0):
"""Equalized Learning Rate.
This trick is pro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from copy import deepcopy
from functools import partial
fr... | akimotty877/mmediting | ModulatedToRGB | false | 3,078 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
MLP | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
from scipy.sparse import *
class MLP(Module):
def __init__(self, features_dim, hidden_dim, out_dim, bias=True,
dropout=0.3):
super(MLP, self).__init__()
self.features_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.nn import Module
f... | TTomatoZhang/GHGCN | MLP | false | 3,079 | [
"Apache-2.0"
] | 0 | 09a07ff9e29e5889b912ca5feff74bb9308eda55 | https://github.com/TTomatoZhang/GHGCN/tree/09a07ff9e29e5889b912ca5feff74bb9308eda55 |
SRCNN | import logging
import torch
import torch.nn as nn
def get_root_logger(log_file=None, log_level=logging.INFO):
"""Get the root logger.
The logger will be initialized if it has not been initialized. By default a
StreamHandler will be added. If `log_file` is specified, a FileHandler will
also be added. ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | akimotty877/mmediting | SRCNN | false | 3,080 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
IOU_Loss | import torch
import torch.nn as nn
class IOU_Loss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, y_pred, y):
i = y_pred.mul(y)
u = y_pred + y - i
mean_iou = torch.mean(i.view(i.shape[0], -1).sum(1) / u.view(i.
shape[0], -1).sum(1))
io... | 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... | allen-q/pytorch | IOU_Loss | false | 3,081 | [
"MIT"
] | 0 | 76947f8d6f0bcee04425ad69f93b9a5e3a5060ae | https://github.com/allen-q/pytorch/tree/76947f8d6f0bcee04425ad69f93b9a5e3a5060ae |
GraphVae | 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.nn import Module
i... | TTomatoZhang/GHGCN | GraphVae | false | 3,082 | [
"Apache-2.0"
] | 0 | 09a07ff9e29e5889b912ca5feff74bb9308eda55 | https://github.com/TTomatoZhang/GHGCN/tree/09a07ff9e29e5889b912ca5feff74bb9308eda55 |
Policy | import torch
import torch.nn as nn
import torch.nn.functional as F
class Policy(nn.Module):
def __init__(self):
super(Policy, self).__init__()
self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False)
self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4)
self.size = 9 * 9... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | akashkmr27089/ReinforcementLearning_Udacity_Deep_Reinforcemnt_Learning | Policy | false | 3,083 | [
"MIT"
] | 0 | b7dc13b0116898848d8d0b8a95b7af182982bd6b | https://github.com/akashkmr27089/ReinforcementLearning_Udacity_Deep_Reinforcemnt_Learning/tree/b7dc13b0116898848d8d0b8a95b7af182982bd6b |
Ranking | import torch
class Ranking(torch.nn.Module):
def __init__(self, delta, use_cosine_similarity):
super(Ranking, self).__init__()
self._cosine_similarity = torch.nn.CosineSimilarity(dim=-1)
self.measure_similarity = self._get_similarity_function(
use_cosine_similarity)
se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | alexcapstick/minder_utils | Ranking | false | 3,084 | [
"MIT"
] | 0 | 3bb9380b7796b5dd5b995ce1839ea6a94321021d | https://github.com/alexcapstick/minder_utils/tree/3bb9380b7796b5dd5b995ce1839ea6a94321021d |
outconv | import torch
import torch.nn as nn
class outconv(nn.Module):
def __init__(self, in_ch, out_ch):
super(outconv, self).__init__()
self.conv = nn.Conv2d(in_ch, out_ch, 1)
self.sig = nn.Sigmoid()
def forward(self, x):
x_conv = self.conv(x)
x = self.sig(x_conv)
ret... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | allen-q/pytorch | outconv | false | 3,085 | [
"MIT"
] | 0 | 76947f8d6f0bcee04425ad69f93b9a5e3a5060ae | https://github.com/allen-q/pytorch/tree/76947f8d6f0bcee04425ad69f93b9a5e3a5060ae |
DurationPredictorLoss | import torch
class DurationPredictorLoss(torch.nn.Module):
"""Loss function module for duration predictor.
The loss value is Calculated in log domain to make it Gaussian.
Args:
offset (float, optional): Offset value to avoid nan in log domain.
"""
def __init__(self, offset=1.0):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | akreal/end-to-end-slu-espnet | DurationPredictorLoss | false | 3,086 | [
"Apache-2.0"
] | 0 | 0b16dc8b10b31a4567b3312678a753a94bb200da | https://github.com/akreal/end-to-end-slu-espnet/tree/0b16dc8b10b31a4567b3312678a753a94bb200da |
RankingLoss | import torch
import torch.nn as nn
class RankingLoss(nn.Module):
"""
ref: https://arxiv.org/abs/2002.10857
"""
def __init__(self, m: 'float', gamma: 'float') ->None:
super(RankingLoss, self).__init__()
self.m = m
self.gamma = gamma
self.soft_plus = nn.Softplus()
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | alipay/Parameter_Inference_Efficient_PIE | RankingLoss | false | 3,087 | [
"Apache-2.0"
] | 0 | 660add7705432a526aa3335fff3d8cf1c7d015a4 | https://github.com/alipay/Parameter_Inference_Efficient_PIE/tree/660add7705432a526aa3335fff3d8cf1c7d015a4 |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = 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 import triton_helpers
from torch._inductor.runtime.... | alexandergg/Deep-Learning-with-Pytorch-and-Azure | CNN | false | 3,088 | [
"MIT"
] | 0 | 8999ce815469ecaf9fb61998372a6e7507c15943 | https://github.com/alexandergg/Deep-Learning-with-Pytorch-and-Azure/tree/8999ce815469ecaf9fb61998372a6e7507c15943 |
NetVLAD | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from sklearn.neighbors import NearestNeighbors
class NetVLAD(nn.Module):
"""NetVLAD layer implementation"""
def __init__(self, num_clusters=64, dim=128, normalize_input=True,
vladv2=False):
"""
Args:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Rick0514/VPR_SMCN | NetVLAD | false | 3,089 | [
"MIT"
] | 0 | 7a00dc8e4de0c21438474c05a4a7be18d05367fa | https://github.com/Rick0514/VPR_SMCN/tree/7a00dc8e4de0c21438474c05a4a7be18d05367fa |
wTransitionLinearUnit | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
from scipy.sparse import *
class wTransitionLinearUnit(Module):
def __init__(self, ori_dim, tar_dim):
super(wTransitionLinearUnit, self).__init__()
self.linear_1 = torch.nn.Linear(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
from torch._inductor.runtime.... | TTomatoZhang/GHGCN | wTransitionLinearUnit | false | 3,090 | [
"Apache-2.0"
] | 0 | 09a07ff9e29e5889b912ca5feff74bb9308eda55 | https://github.com/TTomatoZhang/GHGCN/tree/09a07ff9e29e5889b912ca5feff74bb9308eda55 |
ModMBStddevLayer | import torch
import torch.nn as nn
class ModMBStddevLayer(nn.Module):
"""Modified MiniBatch Stddev Layer.
This layer is modified from ``MiniBatchStddevLayer`` used in PGGAN. In
StyleGAN2, the authors add a new feature, `channel_groups`, into this
layer.
"""
def __init__(self, group_size=4, c... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | akimotty877/mmediting | ModMBStddevLayer | false | 3,091 | [
"Apache-2.0"
] | 0 | cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 | https://github.com/akimotty877/mmediting/tree/cae872d6f3e867ba144c7c0dbc29a0ee1a29e5a6 |
RegModel | import torch
import torch.nn as nn
class RegModel(nn.Module):
def __init__(self, input_size):
super(RegModel, self).__init__()
self.fc1 = nn.Linear(input_size, 50)
self.relu1 = nn.ReLU()
self.dout = nn.Dropout(0.2)
self.fc2 = nn.Linear(50, 100)
self.prelu = nn.PReL... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | amperie/user-models | RegModel | false | 3,092 | [
"Apache-2.0"
] | 0 | 5236c50d0f20a7bac81acc5d1936a3502de2f5f3 | https://github.com/amperie/user-models/tree/5236c50d0f20a7bac81acc5d1936a3502de2f5f3 |
ConvEncoder | import torch
import torch.nn as nn
import torch.autograd
def pytorch_activation(name='relu'):
if name == 'tanh':
return nn.Tanh()
if name == 'identity':
return nn.Identity()
if name == 'hardtanh':
return nn.Hardtanh()
if name == 'prelu':
return nn.PReLU()
if name ==... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | amyhemmeter/baseline | ConvEncoder | false | 3,093 | [
"Apache-2.0"
] | 0 | 101a393398570747d14a32eb3af72664e2774c8b | https://github.com/amyhemmeter/baseline/tree/101a393398570747d14a32eb3af72664e2774c8b |
Critic | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | akashkmr27089/ReinforcementLearning_Udacity_Deep_Reinforcemnt_Learning | Critic | false | 3,094 | [
"MIT"
] | 0 | b7dc13b0116898848d8d0b8a95b7af182982bd6b | https://github.com/akashkmr27089/ReinforcementLearning_Udacity_Deep_Reinforcemnt_Learning/tree/b7dc13b0116898848d8d0b8a95b7af182982bd6b |
AttentionPooling | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch.distributed
import torch.distributions
def compute_attention(q, k, v, dropout=None, mask=None):
"""
:param q: Query [B, NH, NQ, EL] or [NH, 1, EL] (in this case NQ=1)
:param k: Key [B, NH, NK, EL]
: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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Zed-Wu/ManiSkill-Learn | AttentionPooling | false | 3,095 | [
"Apache-2.0"
] | 0 | 8056fe327752cd0863f8730672fe62bd85a0ec12 | https://github.com/Zed-Wu/ManiSkill-Learn/tree/8056fe327752cd0863f8730672fe62bd85a0ec12 |
MultiModel | import torch
import torch.nn as nn
class MultiModel(nn.Module):
def __init__(self, input_size, output_size):
super(MultiModel, self).__init__()
self.layer1 = nn.Linear(input_size, 8)
self.relu = nn.ReLU()
self.layer2 = nn.Linear(8, output_size)
self.out = nn.Softmax()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | amperie/user-models | MultiModel | false | 3,096 | [
"Apache-2.0"
] | 0 | 5236c50d0f20a7bac81acc5d1936a3502de2f5f3 | https://github.com/amperie/user-models/tree/5236c50d0f20a7bac81acc5d1936a3502de2f5f3 |
LandmarkHead | import torch
from torch import nn
import torch.nn
class LandmarkHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(LandmarkHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 40, kernel_size=
(1, 1), stride=1, padding=0)
def forward(se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn
assert_size_stride = torch._C._dynamo.guard... | ZongqingHou/Pytorch_Retinaface | LandmarkHead | false | 3,097 | [
"MIT"
] | 0 | 6284b7158a0d9d3d4a2cc267a393c21863a1b938 | https://github.com/ZongqingHou/Pytorch_Retinaface/tree/6284b7158a0d9d3d4a2cc267a393c21863a1b938 |
LayerNorm | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.optim.lr_scheduler import *
from torch.nn import Parameter
class LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=0.0001):
super(LayerNorm, self).__init__()
self.alpha = Parameter(torch.ones(1, 1, hidd... | 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
from torch.optim... | aerinkim/squad_2018 | LayerNorm | false | 3,098 | [
"BSD-3-Clause"
] | 0 | 4479fa7ce92d8ab2f2eeb1823991d416924d8561 | https://github.com/aerinkim/squad_2018/tree/4479fa7ce92d8ab2f2eeb1823991d416924d8561 |
Clamp | import torch
import torch.nn as nn
import torch.distributed
import torch.distributions
class Clamp(nn.Module):
def __init__(self, min=-1.0, max=1.0):
super(Clamp, self).__init__()
self.min = min
self.max = max
def forward(self, x):
return torch.clamp(x, min=self.min, max=self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.distributed
import torch.distributions
assert_size_str... | Zed-Wu/ManiSkill-Learn | Clamp | false | 3,099 | [
"Apache-2.0"
] | 0 | 8056fe327752cd0863f8730672fe62bd85a0ec12 | https://github.com/Zed-Wu/ManiSkill-Learn/tree/8056fe327752cd0863f8730672fe62bd85a0ec12 |
BinModel | import torch
import torch.nn as nn
class BinModel(nn.Module):
def __init__(self, input_size):
super(BinModel, self).__init__()
self.fc1 = nn.Linear(input_size, 50)
self.relu1 = nn.ReLU()
self.dout = nn.Dropout(0.2)
self.fc2 = nn.Linear(50, 100)
self.prelu = nn.PReL... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | amperie/user-models | BinModel | false | 3,100 | [
"Apache-2.0"
] | 0 | 5236c50d0f20a7bac81acc5d1936a3502de2f5f3 | https://github.com/amperie/user-models/tree/5236c50d0f20a7bac81acc5d1936a3502de2f5f3 |
MultiHeadedAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd
def pytorch_linear(in_sz, out_sz, unif=0, initializer=None):
l = nn.Linear(in_sz, out_sz)
if unif > 0:
l.weight.data.uniform_(-unif, unif)
elif initializer == 'ortho':
nn.init.orthogonal(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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | amyhemmeter/baseline | MultiHeadedAttention | false | 3,101 | [
"Apache-2.0"
] | 0 | 101a393398570747d14a32eb3af72664e2774c8b | https://github.com/amyhemmeter/baseline/tree/101a393398570747d14a32eb3af72664e2774c8b |
ScaleToModel | import torch
import torch.nn as nn
import torch.cuda
from torch import linalg as linalg
class ScaleToModel(nn.Module):
def __init__(self, model_value_range, test_value_range):
super(ScaleToModel, self).__init__()
self.m_min, self.m_max = model_value_range
self.t_min, self.t_max = test_val... | 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.cuda
from torch import linalg as linalg
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
e... | angelvillar96/vp-suite | ScaleToModel | false | 3,102 | [
"MIT"
] | 0 | 3e7c7d852862bad09a771d754fc56a71abf0a25f | https://github.com/angelvillar96/vp-suite/tree/3e7c7d852862bad09a771d754fc56a71abf0a25f |
Attention | import torch
from torch import nn
import torch.nn.functional as F
class Attention(nn.Module):
"""Implements additive attention and return the attention vector used to weight the values.
Additive attention consists in concatenating key and query and then passing them trough a linear layer."""
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.... | alpgokcek/turkish-qg-model | Attention | false | 3,103 | [
"MIT"
] | 0 | e90050d869958325aeaf639a2b1ff5eb2856e318 | https://github.com/alpgokcek/turkish-qg-model/tree/e90050d869958325aeaf639a2b1ff5eb2856e318 |
BayesLinear | from torch.nn import Module
import math
import torch
from torch.nn import Parameter
import torch.nn.functional as F
class BayesLinear(Module):
"""
Applies Bayesian Linear
Arguments:
prior_mu (Float): mean of prior normal distribution.
prior_sigma (Float): sigma of prior normal distributio... | 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 | BayesLinear | false | 3,104 | [
"MIT"
] | 0 | d98df8039e52cd2505dc8a94ed3cd474c2056d9a | https://github.com/anaplasia29/Bayesian-Neural-Network/tree/d98df8039e52cd2505dc8a94ed3cd474c2056d9a |
Normalize | import torch
import torch.nn as nn
class Normalize(nn.Module):
def forward(self, x):
return (x - 0.1307) / 0.3081
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | anianruoss/RIAI | Normalize | false | 3,105 | [
"MIT"
] | 0 | 2ac4ddcfb73c9678b1c4fe94fdaae82baceac4ea | https://github.com/anianruoss/RIAI/tree/2ac4ddcfb73c9678b1c4fe94fdaae82baceac4ea |
MultiHeadSelfAttention | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch.distributed
import torch.distributions
def compute_attention(q, k, v, dropout=None, mask=None):
"""
:param q: Query [B, NH, NQ, EL] or [NH, 1, EL] (in this case NQ=1)
:param k: Key [B, NH, NK, EL]
: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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Zed-Wu/ManiSkill-Learn | MultiHeadSelfAttention | false | 3,106 | [
"Apache-2.0"
] | 0 | 8056fe327752cd0863f8730672fe62bd85a0ec12 | https://github.com/Zed-Wu/ManiSkill-Learn/tree/8056fe327752cd0863f8730672fe62bd85a0ec12 |
KLLoss | import torch
import torch.nn as nn
import torch.cuda
from torch import linalg as linalg
class BaseMeasure(nn.Module):
"""
"""
NAME: 'str' = NotImplemented
REFERENCE: 'str' = None
BIGGER_IS_BETTER = False
OPT_VALUE = 0.0
def __init__(self, device):
"""
Args:
dev... | 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.cuda
from torch import linalg as linal... | angelvillar96/vp-suite | KLLoss | false | 3,107 | [
"MIT"
] | 0 | 3e7c7d852862bad09a771d754fc56a71abf0a25f | https://github.com/angelvillar96/vp-suite/tree/3e7c7d852862bad09a771d754fc56a71abf0a25f |
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.fc = nn.Linear(28 * 28, 200)
self.fc2 = nn.Linear(200, 10)
def forward(self, x):
x = x.view((-1, 28 * 28))
x = F.relu(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
assert_... | anianruoss/RIAI | Net | false | 3,108 | [
"MIT"
] | 0 | 2ac4ddcfb73c9678b1c4fe94fdaae82baceac4ea | https://github.com/anianruoss/RIAI/tree/2ac4ddcfb73c9678b1c4fe94fdaae82baceac4ea |
LocationLayer | import torch
import torch.utils.data
import torch
import torch.nn as nn
class Linear(nn.Module):
def __init__(self, in_features, out_features, bias=True, init_gain='linear'
):
super(Linear, self).__init__()
self.linear_layer = nn.Linear(in_features, out_features, bias=bias)
self._... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = ... | aidiary/tacotron-pytorch | LocationLayer | false | 3,109 | [
"MIT"
] | 0 | 8ea9b1bb61bf753a64ff611b441326ea8c001d20 | https://github.com/aidiary/tacotron-pytorch/tree/8ea9b1bb61bf753a64ff611b441326ea8c001d20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.