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 |
|---|---|---|---|---|---|---|---|---|---|---|
RNNModel | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def initialize(dims, connection_prob=1.0, shape=0.1, scale=1.0):
w = np.random.gamma(shape, scale, size=dims)
w *= np.random.rand(*dims) < connection_prob
return np.float32(w)
class VanillaRNNCell(nn.Module... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | YuXie96/time | RNNModel | false | 1,279 | [
"MIT"
] | 0 | 8539d55d2449c712f54331b06720ab7faf3593df | https://github.com/YuXie96/time/tree/8539d55d2449c712f54331b06720ab7faf3593df |
NHDUnitV2 | import torch
import torch.nn as nn
class NHDUnitV2(nn.Module):
def __init__(self, in_channels, hidden_channels, *args, **kwargs):
super(NHDUnitV2, self).__init__()
self.in_channels = in_channels
self.hidden_channels = hidden_channels
self._build()
def _build(self):
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_... | YiqunChen1999/NTIRE2021NHDehazing | NHDUnitV2 | false | 1,280 | [
"MIT"
] | 0 | 3341ae561ac8caff7f40ddf6d4408032a28ff13c | https://github.com/YiqunChen1999/NTIRE2021NHDehazing/tree/3341ae561ac8caff7f40ddf6d4408032a28ff13c |
EmbeddingLayer | import torch
import torch.nn.functional
class EmbeddingLayer(torch.nn.Module):
"""Attention layer."""
def __init__(self, feature_number: 'int'):
"""Initialize the relational embedding layer.
:param feature_number: Number of features.
"""
super().__init__()
self.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
from torch._inductor.runtime.... | YuWVandy/chemicalx | EmbeddingLayer | false | 1,281 | [
"Apache-2.0"
] | 0 | c02f979a502409c26700e6d5a1b2e6c0aa77e64c | https://github.com/YuWVandy/chemicalx/tree/c02f979a502409c26700e6d5a1b2e6c0aa77e64c |
VanillaRNNCell | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class VanillaRNNCell(nn.Module):
def __init__(self, input_size, hidden_size, nonlinearity='tanh', ct=False):
super(VanillaRNNCell, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | YuXie96/time | VanillaRNNCell | false | 1,282 | [
"MIT"
] | 0 | 8539d55d2449c712f54331b06720ab7faf3593df | https://github.com/YuXie96/time/tree/8539d55d2449c712f54331b06720ab7faf3593df |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv2d(2, 1, 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 import triton_helpers
import torch.nn as nn
assert_... | YuanZi1501040205/Ice-detection-for-smart-track-heating-with-normal-only-self-supervised-learning | SpatialAttention | false | 1,283 | [
"MIT"
] | 0 | ac7603dc27cf1cc9ce29cfae6c525dd5dbbcdd83 | https://github.com/YuanZi1501040205/Ice-detection-for-smart-track-heating-with-normal-only-self-supervised-learning/tree/ac7603dc27cf1cc9ce29cfae6c525dd5dbbcdd83 |
ResidualUnit | import torch
import torch.nn as nn
def defaultConv(inChannels, outChannels, kernelSize, bias=True):
return nn.Conv2d(inChannels, outChannels, kernelSize, padding=
kernelSize // 2, bias=bias)
class ResidualUnit(nn.Module):
def __init__(self, inChannel, outChannel, reScale, kernelSize=1, bias=True
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | YingqiLiulll/scrips_for_SR | ResidualUnit | false | 1,284 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
ClassificationModel | import torch
import torch.nn as nn
import torch.utils.data.distributed
class ClassificationModel(nn.Module):
def __init__(self, num_features_in, num_anchors=1, num_classes=80,
prior=0.01, feature_size=256):
super(ClassificationModel, self).__init__()
self.num_classes = 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | YuBeomGon/pytorch_retina | ClassificationModel | false | 1,285 | [
"Apache-2.0"
] | 0 | a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8 | https://github.com/YuBeomGon/pytorch_retina/tree/a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8 |
TopicMemeoryMechanism | import torch
import torch.multiprocessing
from torch import nn
import torch.utils.data
class TopicMemeoryMechanism(nn.Module):
def __init__(self, topic_num, bow_size, embed_size):
super(TopicMemeoryMechanism, self).__init__()
self.topic_num = topic_num
self.bow_size = bow_size
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.multiprocessing
... | WuDiDaBinGe/TAKG | TopicMemeoryMechanism | false | 1,286 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
Lda2Vec | import torch
from torch.nn import functional as F
import torch.multiprocessing
from torch import nn
import torch.utils.data
class ContextGate(nn.Module):
def __init__(self, vector_dim, topic_dim):
super().__init__()
assert vector_dim == topic_dim
self.fusion_linear = nn.Linear(vector_dim ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | WuDiDaBinGe/TAKG | Lda2Vec | false | 1,287 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
PA_UP | import torch
import torch.nn as nn
import torch.nn.functional as F
class PA(nn.Module):
"""PA is pixel attention"""
def __init__(self, nf):
super(PA, self).__init__()
self.conv = nn.Conv2d(nf, nf, 1)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
y = self.conv(x)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | YingqiLiulll/scrips_for_SR | PA_UP | false | 1,288 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
BCEDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, eps: 'float'=1e-09):
super(DiceLoss, self).__init__()
self.smooth = 1.0
self.eps = eps
def forward(self, y_pred, y_true):
num = y_true.size(0)
probability = torch.sigmoid(y_pred)
... | 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... | Yukei7/Multimodal-Segmentation-Network | BCEDiceLoss | false | 1,289 | [
"MIT"
] | 0 | 0a38aa8bbd2eb87e28209c810438248c0464a240 | https://github.com/Yukei7/Multimodal-Segmentation-Network/tree/0a38aa8bbd2eb87e28209c810438248c0464a240 |
Upsample | import torch
import torch.nn.functional as F
import torch.nn as nn
def conv_nd(dims, *args, **kwargs):
"""
Create a 1D, 2D, or 3D convolution module.
"""
if dims == 1:
return nn.Conv1d(*args, **kwargs)
elif dims == 2:
return nn.Conv2d(*args, **kwargs)
elif dims == 3:
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ZGCTroy/guided-diffusion | Upsample | false | 1,290 | [
"MIT"
] | 0 | af987bb2b65db2875148a5466df79736ea5ae6a1 | https://github.com/ZGCTroy/guided-diffusion/tree/af987bb2b65db2875148a5466df79736ea5ae6a1 |
ValueNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class ValueNetwork(nn.Module):
def __init__(self, num_inputs, hidd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Yunaik/drl_env | ValueNetwork | false | 1,291 | [
"MIT"
] | 0 | d284e79847c59daa6ccb222f30fc7e2a86375546 | https://github.com/Yunaik/drl_env/tree/d284e79847c59daa6ccb222f30fc7e2a86375546 |
QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class QNetwork(nn.Module):
def __init__(self, num_inputs, num_acti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Yunaik/drl_env | QNetwork | false | 1,292 | [
"MIT"
] | 0 | d284e79847c59daa6ccb222f30fc7e2a86375546 | https://github.com/Yunaik/drl_env/tree/d284e79847c59daa6ccb222f30fc7e2a86375546 |
InnerProductModel | import torch
class InnerProductModel(torch.nn.Module):
@staticmethod
def is_valid_model_type(model_type):
raise NotImplementedError
@staticmethod
def get_model_from_type(model_type):
raise NotImplementedError
@property
def loss_criterion(self):
return torch.nn.MSELos... | 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
reinterpret... | Yufei-Kang/plato | InnerProductModel | false | 1,293 | [
"Apache-2.0"
] | 0 | 16b170698242b1e11677e80229c3439a9e26965a | https://github.com/Yufei-Kang/plato/tree/16b170698242b1e11677e80229c3439a9e26965a |
SequenceSummaryLayer | import torch
import torch.nn as nn
class SequenceSummaryLayer(nn.Module):
def __init__(self, hidden_size, summary_layers):
super().__init__()
self.summary_layers = summary_layers
self.linear = nn.Linear(hidden_size * summary_layers, hidden_size)
self.pooler = nn.Linear(hidden_size... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Zaaachary/CSQA | SequenceSummaryLayer | false | 1,294 | [
"BSD-3-Clause"
] | 0 | 6da6e076f67e9458deacb665d31463db14c7d860 | https://github.com/Zaaachary/CSQA/tree/6da6e076f67e9458deacb665d31463db14c7d860 |
EltwiseProdScoring | import torch
import torch.nn as nn
class EltwiseProdScoring(nn.Module):
"""
Linearly mapping h and v to the same dimension, and do a elementwise
multiplication and a linear scoring
"""
def __init__(self, h_dim, a_dim, dot_dim=256):
"""Initialize layer."""
super(EltwiseProdScoring,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | YzyLmc/AC-GG_0.2 | EltwiseProdScoring | false | 1,295 | [
"BSD-2-Clause",
"MIT"
] | 0 | ddedbbe4062f6646041e24c16593b087d3cf0095 | https://github.com/YzyLmc/AC-GG_0.2/tree/ddedbbe4062f6646041e24c16593b087d3cf0095 |
AttentionMerge | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionMerge(nn.Module):
def __init__(self, input_size, attention_size, dropout_prob=0.1):
super(AttentionMerge, self).__init__()
self.attention_size = attention_size
self.hidden_layer = nn.Linear(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.triton_helpers import libdevice
import torch.nn as ... | Zaaachary/CSQA | AttentionMerge | false | 1,297 | [
"BSD-3-Clause"
] | 0 | 6da6e076f67e9458deacb665d31463db14c7d860 | https://github.com/Zaaachary/CSQA/tree/6da6e076f67e9458deacb665d31463db14c7d860 |
ConformerFeedForward | import torch
from torch import nn
import torch.utils.data
import torch.optim
class Swish(nn.Module):
"""
Swish activation function introduced in 'https://arxiv.org/abs/1710.05941'
"""
def forward(self, x):
return x * torch.sigmoid(x)
class ConformerFeedForward(nn.Module):
"""
feed-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 import nn
import torch.utils.data
import torch.optim
assert_size_stri... | Zenodia/NeMo | ConformerFeedForward | false | 1,298 | [
"Apache-2.0"
] | 0 | 3c288d8a7caf667c95444c39434e3ebc5f53d911 | https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911 |
MultiLayerPerceptron | import torch
import torch.utils.data
import torch.optim
class MultiLayerPerceptron(torch.nn.Module):
"""
A simple MLP that can either be used independently or put on top
of pretrained models (such as BERT) and act as a classifier.
Args:
hidden_size (int): the size of each layer
num_cla... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Zenodia/NeMo | MultiLayerPerceptron | false | 1,299 | [
"Apache-2.0"
] | 0 | 3c288d8a7caf667c95444c39434e3ebc5f53d911 | https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911 |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self, out_dim=64):
super(Encoder, self).__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=1, 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
assert_... | YoniSchirris/SimCLR | Encoder | false | 1,300 | [
"MIT"
] | 0 | a99b7f7d0fdbc5a9747abf70a8b216b328608796 | https://github.com/YoniSchirris/SimCLR/tree/a99b7f7d0fdbc5a9747abf70a8b216b328608796 |
mnist_model | import torch
import torch.nn as nn
import torch.nn.functional as F
class mnist_model(nn.Module):
def __init__(self):
super(mnist_model, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1, 0)
self.conv2 = nn.Conv2d(32, 64, 3, 1, 0)
self.conv3 = nn.Conv2d(64, 128, 1, 1, 0)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Xenovortex/INN_Embedding_Classification | mnist_model | false | 1,302 | [
"MIT"
] | 0 | df31ec3dcf70780cae5140a69ffafdd64f218e5f | https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f |
ConvGLU | import torch
from torch import nn
import torch.utils.data
import torch.optim
def str2act(txt):
"""Translates text to neural network activation"""
return {'sigmoid': nn.Sigmoid(), 'relu': nn.ReLU(), 'none': nn.
Sequential(), 'lrelu': nn.LeakyReLU(0.2), 'selu': nn.SELU()}[txt.
lower()]
class C... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
import torch.optim
assert_size_stri... | Zenodia/NeMo | ConvGLU | false | 1,303 | [
"Apache-2.0"
] | 0 | 3c288d8a7caf667c95444c39434e3ebc5f53d911 | https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Andr3wis2Cool4School/AI-pro | BertSelfAttention | false | 1,304 | [
"MIT"
] | 0 | dfe5f5959bc187d899a86f13b84158c66f64d1cc | https://github.com/Andr3wis2Cool4School/AI-pro/tree/dfe5f5959bc187d899a86f13b84158c66f64d1cc |
ResidualBlock_noBN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, nn.Conv2d):
init.kaimin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | YingqiLiulll/scrips_for_SR | ResidualBlock_noBN | false | 1,306 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
AttentionPool2d | import math
import torch
import numpy as np
import torch as th
import torch.nn as nn
def count_flops_attn(model, _x, y):
"""
A counter for the `thop` package to count the operations in an
attention operation.
Meant to be used like:
macs, params = thop.profile(
model,
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.... | ZGCTroy/guided-diffusion | AttentionPool2d | false | 1,307 | [
"MIT"
] | 0 | af987bb2b65db2875148a5466df79736ea5ae6a1 | https://github.com/ZGCTroy/guided-diffusion/tree/af987bb2b65db2875148a5466df79736ea5ae6a1 |
MaxPoolBlock | import torch
import torch.nn as nn
class Block(nn.Module):
def __init__(self):
"""Initialisation for a lower-level DeepLPF conv block
:returns: N/A
:rtype: N/A
"""
super(Block, self).__init__()
def conv3x3(self, in_channels, out_channels, stride=1):
"""Repre... | 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... | ZombaSY/DeepLPF | MaxPoolBlock | false | 1,310 | [
"BSD-3-Clause"
] | 0 | adce64ae01bc9e32f465a354cb1f6534f0d13597 | https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597 |
NumericalFeaturesEmbedding | import torch
import torch.utils.tensorboard
import torch.utils.data
import torch.distributed
class NumericalFeaturesEmbedding(torch.nn.Module):
"""Transform a sequence of numerical feature vectors into a single vector.
Currently, this module simply aggregates the features by averaging, although more
elab... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.tensorboard
import torch.utils.data
import torch.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_str... | JoeLambourne/SketchGraphs | NumericalFeaturesEmbedding | false | 1,312 | [
"MIT"
] | 0 | 183c65f82d71d82c62b253092e9b7fa65846a3e6 | https://github.com/JoeLambourne/SketchGraphs/tree/183c65f82d71d82c62b253092e9b7fa65846a3e6 |
BinaryLayer | import torch
import torch.nn as nn
class BinaryLayer(nn.Module):
def forward(self, input):
"""Forward function for binary layer
:param input: data
:returns: sign of data
:rtype: Tensor
"""
return torch.sign(input)
def backward(self, grad_output):
"""... | 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... | ZombaSY/DeepLPF | BinaryLayer | false | 1,314 | [
"BSD-3-Clause"
] | 0 | adce64ae01bc9e32f465a354cb1f6534f0d13597 | https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, numberOfInputs):
super(Critic, self).__init__()
self.fc1 = nn.Linear(numberOfInputs, 4096)
self.fc2 = nn.Linear(4096, 2048)
self.fc3 = nn.Linear(2048, 1024)
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_... | ZY-KK/panda | Critic | false | 1,315 | [
"MIT"
] | 0 | 48fcbd65d563ef74aab2554be8de7662560c43da | https://github.com/ZY-KK/panda/tree/48fcbd65d563ef74aab2554be8de7662560c43da |
FC2LayersShortcut | import torch
import torch.nn as nn
import torch.nn.functional as F
class FC2LayersShortcut(nn.Module):
def __init__(self, n_in, n_hidden, n_out, activation=F.relu):
super(FC2LayersShortcut, self).__init__()
self.fc1 = nn.Linear(n_in, n_hidden)
self.fc2 = nn.Linear(n_hidden + n_in, n_out)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | ZhiangChen/vca | FC2LayersShortcut | false | 1,316 | [
"MIT"
] | 0 | 22b7568ac1894a56e7e64443565f7e44e096d778 | https://github.com/ZhiangChen/vca/tree/22b7568ac1894a56e7e64443565f7e44e096d778 |
EncoderImagePrecomp | import torch
import numpy as np
from collections import OrderedDict
import torch.nn as nn
import torch.nn.init
def l2norm(x, dim=-1):
return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06)
class EncoderImagePrecomp(nn.Module):
""" image encoder """
def __init__(self, img_dim, embed_size, no_imgno... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ZhouXing19/VGNSL_multilang | EncoderImagePrecomp | false | 1,317 | [
"MIT"
] | 0 | 097ed7bf978dbff052075a26231984ade5522409 | https://github.com/ZhouXing19/VGNSL_multilang/tree/097ed7bf978dbff052075a26231984ade5522409 |
InvConvNear | import torch
from torch.nn import functional as F
from torch import nn
import torch.utils.data
import torch.optim
class InvConvNear(nn.Module):
def __init__(self, channels, n_split=4, no_jacobian=False, **kwargs):
super().__init__()
assert n_split % 2 == 0
self.channels = channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
import torch.optim
assert_size_stri... | Zenodia/NeMo | InvConvNear | false | 1,318 | [
"Apache-2.0"
] | 0 | 3c288d8a7caf667c95444c39434e3ebc5f53d911 | https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911 |
BCELosswithLogits | import torch
import torch.nn as nn
import torch.nn.functional as F
class BCELosswithLogits(nn.Module):
def __init__(self, pos_weight=1, reduction='mean'):
super(BCELosswithLogits, self).__init__()
self.pos_weight = pos_weight
self.reduction = reduction
def forward(self, logits, targe... | 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
... | ZonghaiZhu/EZBM | BCELosswithLogits | false | 1,319 | [
"MIT"
] | 0 | b4f6fbd10598c79f144b778ef848554ac62a173a | https://github.com/ZonghaiZhu/EZBM/tree/b4f6fbd10598c79f144b778ef848554ac62a173a |
GateLayer | import torch
from torch import nn
class GateLayer(nn.Module):
def __init__(self, input_dim):
super(GateLayer, self).__init__()
self._norm_layer1 = nn.Linear(input_dim * 2, input_dim)
self._norm_layer2 = nn.Linear(input_dim, 1)
def forward(self, input1, input2):
norm_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Zilize/CRSLab | GateLayer | false | 1,320 | [
"MIT"
] | 0 | fb357d0dfb7d2cf7b67b892d98e52032a31ca564 | https://github.com/Zilize/CRSLab/tree/fb357d0dfb7d2cf7b67b892d98e52032a31ca564 |
NormedLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
class NormedLinear(nn.Module):
def __init__(self, in_features, out_features):
super(NormedLinear, self).__init__()
self.weight = Parameter(torch.Tensor(in_features, out_features))
self.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
from torch._inductor.runtime.... | ZonghaiZhu/EZBM | NormedLinear | false | 1,321 | [
"MIT"
] | 0 | b4f6fbd10598c79f144b778ef848554ac62a173a | https://github.com/ZonghaiZhu/EZBM/tree/b4f6fbd10598c79f144b778ef848554ac62a173a |
RFDB | import torch
import torch.nn as nn
import torch.nn.functional as F
class ESA(nn.Module):
def __init__(self, num_feat=50, conv=nn.Conv2d, p=0.25):
super(ESA, self).__init__()
f = num_feat // 4
BSConvS_kwargs = {}
if conv.__name__ == 'BSConvS':
BSConvS_kwargs = {'p': p}
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YingqiLiulll/scrips_for_SR | RFDB | false | 1,322 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
GeneralizedFocalLoss | import torch
import torch.utils.data
from torch import nn
class GeneralizedFocalLoss(nn.Module):
def __init__(self, beta=2):
super(GeneralizedFocalLoss, self).__init__()
self.beta = beta
def forward(self, prediction, target, cls_weights):
cls_weights = cls_weights.unsqueeze(-1).unsqu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | ZhuokunYao/smoke | GeneralizedFocalLoss | false | 1,323 | [
"MIT"
] | 0 | d524fbe43b1aba6078c25d9aca7924b71a635e1d | https://github.com/ZhuokunYao/smoke/tree/d524fbe43b1aba6078c25d9aca7924b71a635e1d |
ClsConvHead | import torch
import torch.nn as nn
import torch.nn.parallel
class ClsConvHead(nn.Module):
"""Global average pooling + conv head for classification
"""
def __init__(self, input_dim, output_dim):
super().__init__()
self.avg_pool = nn.AdaptiveAvgPool2d((1, 1))
self.conv = nn.Conv2d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
assert_size_stride = torch._C._dy... | a1004123217/pytorch-mobile | ClsConvHead | false | 1,324 | [
"MIT"
] | 0 | 97974af3259a2073efbc334d57841efbd3eaadfb | https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb |
ConvBlock | import torch
import torch.nn as nn
class Block(nn.Module):
def __init__(self):
"""Initialisation for a lower-level DeepLPF conv block
:returns: N/A
:rtype: N/A
"""
super(Block, self).__init__()
def conv3x3(self, in_channels, out_channels, stride=1):
"""Repre... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ZombaSY/DeepLPF | ConvBlock | false | 1,325 | [
"BSD-3-Clause"
] | 0 | adce64ae01bc9e32f465a354cb1f6534f0d13597 | https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597 |
TorchMulScalar | import torch
import torch.nn as nn
import torch.nn.parallel
from torch.nn.quantized.modules import FloatFunctional
class TorchMulScalar(nn.Module):
"""Wrapper around torch.mul so that all ops can be found at build
y must be a scalar, needed for quantization
"""
def __init__(self):
super()... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
from torch.nn.quantized.modules import FloatFunctional
assert_size_stride = torch._C._dynamo.... | a1004123217/pytorch-mobile | TorchMulScalar | false | 1,326 | [
"MIT"
] | 0 | 97974af3259a2073efbc334d57841efbd3eaadfb | https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb |
SelfAttentionBatch | import torch
from torch import nn
import torch.nn.functional as F
class SelfAttentionBatch(nn.Module):
def __init__(self, dim, da, alpha=0.2, dropout=0.5):
super(SelfAttentionBatch, self).__init__()
self.dim = dim
self.da = da
self.alpha = alpha
self.dropout = dropout
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Zilize/CRSLab | SelfAttentionBatch | false | 1,327 | [
"MIT"
] | 0 | fb357d0dfb7d2cf7b67b892d98e52032a31ca564 | https://github.com/Zilize/CRSLab/tree/fb357d0dfb7d2cf7b67b892d98e52032a31ca564 |
Swish | import torch
import torch.nn as nn
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
self.beta = nn.Parameter(torch.tensor(1.0))
def forward(self, x):
return x * torch.sigmoid(self.beta * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | a07458666/UncertaintyFlow | Swish | false | 1,328 | [
"MIT"
] | 0 | cef2512901d4e27bb22fc3997522cd47c03b569c | https://github.com/a07458666/UncertaintyFlow/tree/cef2512901d4e27bb22fc3997522cd47c03b569c |
MultiHeadAttention | import math
import torch
from torch import nn
import torch.utils.data
import torch.optim
class MultiHeadAttention(nn.Module):
"""
Multi-head scaled dot-product attention layer.
Args:
hidden_size: size of the embeddings in the model, also known as d_model
num_attention_heads: number of hea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Zenodia/NeMo | MultiHeadAttention | false | 1,329 | [
"Apache-2.0"
] | 0 | 3c288d8a7caf667c95444c39434e3ebc5f53d911 | https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911 |
LambdaLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class LambdaLayer(nn.Module):
def __init__(self, planes):
super(LambdaLayer, 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... | ZonghaiZhu/EZBM | LambdaLayer | false | 1,330 | [
"MIT"
] | 0 | b4f6fbd10598c79f144b778ef848554ac62a173a | https://github.com/ZonghaiZhu/EZBM/tree/b4f6fbd10598c79f144b778ef848554ac62a173a |
AttentionVasvani | import torch
from torch import nn
class AttentionVasvani(nn.Module):
def __init__(self, encoder_dim=128, decoder_dim=128):
super(AttentionVasvani, self).__init__()
def forward(self, k, q):
x = torch.sum(k * q, dim=1, keepdim=True)
x /= torch.sqrt(torch.norm(k, p=1, dim=1, keepdim=Tru... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.gua... | a1247418/MT18_LH_human-sleep-classification | AttentionVasvani | false | 1,333 | [
"MIT"
] | 0 | c4a40571390aaa14b1cc8a458100e21252fe05d2 | https://github.com/a1247418/MT18_LH_human-sleep-classification/tree/c4a40571390aaa14b1cc8a458100e21252fe05d2 |
LocalResponseNormLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class LocalResponseNormLayer(nn.Module):
def forward(self, tensor, size=5, alpha=9.999999747378752e-05, beta=
0.75, k=1.0):
return F.local_response_norm(tensor, size=size, alpha=alpha, beta=
beta, k=k)
def get_inputs... | 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_... | a-kore/lucent | LocalResponseNormLayer | false | 1,334 | [
"Apache-2.0"
] | 0 | 6b2b4dfea45c36c99e16f9923104a532df80e0a8 | https://github.com/a-kore/lucent/tree/6b2b4dfea45c36c99e16f9923104a532df80e0a8 |
HSigmoid | import torch
import torch.nn as nn
import torch.nn.parallel
from torch.nn.quantized.modules import FloatFunctional
class TorchAddScalar(nn.Module):
""" Wrapper around torch.add so that all ops can be found at build
y must be a scalar, needed for quantization
"""
def __init__(self):
super(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
from torch.nn.quantized.modules import Flo... | a1004123217/pytorch-mobile | HSigmoid | false | 1,335 | [
"MIT"
] | 0 | 97974af3259a2073efbc334d57841efbd3eaadfb | https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb |
BinaryClassifier | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class BinaryClassifier(nn.Module):
"""
Define a neural network that performs binary classification.
The network should accept your number of features as input, and produce
a single sigmoid value, that can be ro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | ZombieSocrates/ml-udacity-case-studies | BinaryClassifier | false | 1,336 | [
"MIT"
] | 0 | e4552a11276dc7564c51dac86ae854ca92a88659 | https://github.com/ZombieSocrates/ml-udacity-case-studies/tree/e4552a11276dc7564c51dac86ae854ca92a88659 |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, numberOfInputs, numberOfOutputs):
super(Actor, self).__init__()
self.fc1 = nn.Linear(numberOfInputs, 4096)
self.fc2 = nn.Linear(4096, 2048)
self.fc3 = nn.Linear(2048, 1024... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ZY-KK/panda | Actor | false | 1,337 | [
"MIT"
] | 0 | 48fcbd65d563ef74aab2554be8de7662560c43da | https://github.com/ZY-KK/panda/tree/48fcbd65d563ef74aab2554be8de7662560c43da |
HSwish | import torch
import torch.nn as nn
import torch.nn.parallel
from torch.nn.quantized.modules import FloatFunctional
class TorchAddScalar(nn.Module):
""" Wrapper around torch.add so that all ops can be found at build
y must be a scalar, needed for quantization
"""
def __init__(self):
super(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
from torch.nn.quantized.modules import Flo... | a1004123217/pytorch-mobile | HSwish | false | 1,338 | [
"MIT"
] | 0 | 97974af3259a2073efbc334d57841efbd3eaadfb | https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb |
MSERegularizedLoss | from torch.nn import Module
import torch
import torch as tc
import torch.nn.functional as F
from torch.nn.modules.module import Module
class MSERegularizedLoss(Module):
def __init__(self, alpha=1):
super(MSERegularizedLoss, self).__init__()
self.alpha = alpha
def forward(self, weights, predi... | 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.nn import Module
from torch.nn.modules.module import Module
assert_size_stride... | aalto-intelligent-robotics/mc-dropout-notebooks | MSERegularizedLoss | false | 1,339 | [
"MIT"
] | 0 | fc174c05166061eb21d4c5816c519828c8e72916 | https://github.com/aalto-intelligent-robotics/mc-dropout-notebooks/tree/fc174c05166061eb21d4c5816c519828c8e72916 |
CompositeActivation | import torch
class CompositeActivation(torch.nn.Module):
def forward(self, x):
x = torch.atan(x)
return torch.cat([x / 0.67, x * x / 0.6], 1)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | a-kore/lucent | CompositeActivation | false | 1,340 | [
"Apache-2.0"
] | 0 | 6b2b4dfea45c36c99e16f9923104a532df80e0a8 | https://github.com/a-kore/lucent/tree/6b2b4dfea45c36c99e16f9923104a532df80e0a8 |
Upsample | import torch
import torch.nn as nn
class Upsample(nn.Module):
def __init__(self, factor):
super(Upsample, self).__init__()
self.factor = factor
def forward(self, x):
x = nn.functional.interpolate(x, scale_factor=self.factor, mode=
'bilinear', align_corners=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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | a3ahmad/DDPM | Upsample | false | 1,341 | [
"MIT"
] | 0 | 180440740cb82c2b4e7e0b06a0d8e662b5aa3f05 | https://github.com/a3ahmad/DDPM/tree/180440740cb82c2b4e7e0b06a0d8e662b5aa3f05 |
UpSample | import torch
import torch.nn as nn
class UpSample(nn.Module):
def __init__(self, n_channels, factor=2):
super(UpSample, self).__init__()
out_channels = n_channels * factor * factor
self.proj = nn.Conv2d(n_channels, out_channels, 1, 1, 0)
self.up = nn.PixelShuffle(factor)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | aa10402tw/RealTime-Segmentation | UpSample | false | 1,342 | [
"MIT"
] | 0 | 8c5cf13cd5570c48fa7bae9e6ec014989450889d | https://github.com/aa10402tw/RealTime-Segmentation/tree/8c5cf13cd5570c48fa7bae9e6ec014989450889d |
Attention | import torch
import torch.nn.functional as F
import torch.nn as nn
def new_parameter(*size):
out = nn.Parameter(torch.FloatTensor(*size))
torch.nn.init.xavier_normal_(out)
return out
class Attention(nn.Module):
def __init__(self, attention_size):
super(Attention, self).__init__()
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._inductor.runtime.... | aaronbae/acl2020-dialogue-coherence-assessment | Attention | false | 1,343 | [
"MIT"
] | 0 | 98142558b2f80ace390d6b583a3242a373803a85 | https://github.com/aaronbae/acl2020-dialogue-coherence-assessment/tree/98142558b2f80ace390d6b583a3242a373803a85 |
MaxPool2dLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaxPool2dLayer(nn.Module):
def forward(self, tensor, kernel_size=(3, 3), stride=(1, 1), padding=0,
ceil_mode=False):
return F.max_pool2d(tensor, kernel_size, stride=stride, padding=
padding, ceil_mode=ceil_mode)
... | 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... | a-kore/lucent | MaxPool2dLayer | false | 1,344 | [
"Apache-2.0"
] | 0 | 6b2b4dfea45c36c99e16f9923104a532df80e0a8 | https://github.com/a-kore/lucent/tree/6b2b4dfea45c36c99e16f9923104a532df80e0a8 |
LocalNet | import torch
import torch.nn as nn
class LocalNet(nn.Module):
def forward(self, x_in):
"""Double convolutional block
:param x_in: image features
:returns: image features
:rtype: Tensor
"""
x = self.lrelu(self.conv1(self.refpad(x_in)))
x = self.lrelu(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 math as tl_math
import torch.... | ZombaSY/DeepLPF | LocalNet | false | 1,345 | [
"BSD-3-Clause"
] | 0 | adce64ae01bc9e32f465a354cb1f6534f0d13597 | https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597 |
InvConv | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class InvConv(nn.Module):
"""Invertible 1x1 Convolution for 2D inputs. Originally described in Glow
(https://arxiv.org/abs/1807.03039). Does not support LU-decomposed version.
Args:
num_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.optim
assert_size_stride =... | a-heintz/Flow-based-RelativeStateEstimation | InvConv | false | 1,346 | [
"MIT"
] | 0 | 9633fd74323db1206969186c2d2caa7a766e1948 | https://github.com/a-heintz/Flow-based-RelativeStateEstimation/tree/9633fd74323db1206969186c2d2caa7a766e1948 |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, predict, target):
N = target.size(0)
smooth = 1
predict_flat = predict.view(N, -1)
target_flat = target.view(N, -1)
intersection... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | abc008/MT-Brain-Network | DiceLoss | false | 1,347 | [
"MIT"
] | 0 | a823722d4d3211c955bc1370bd8399d27c6640f4 | https://github.com/abc008/MT-Brain-Network/tree/a823722d4d3211c955bc1370bd8399d27c6640f4 |
GLU | import torch
from torch import nn
class GLU(nn.Module):
def __init__(self, input_num):
super(GLU, self).__init__()
self.sigmoid = nn.Sigmoid()
self.linear = nn.Linear(input_num, input_num)
def forward(self, x):
lin = self.linear(x.permute(0, 2, 3, 1))
lin = lin.permut... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | aagnone3/dc19t2 | GLU | false | 1,348 | [
"Apache-2.0"
] | 0 | cc7baf2a8fe73d28c224f0bf68b5355efd96c24f | https://github.com/aagnone3/dc19t2/tree/cc7baf2a8fe73d28c224f0bf68b5355efd96c24f |
SqueezeExcite | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
def _make_divisible(v, divisor, min_value=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel number that is divisible by 8
It can be seen here:
https://gi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | a1004123217/pytorch-mobile | SqueezeExcite | false | 1,349 | [
"MIT"
] | 0 | 97974af3259a2073efbc334d57841efbd3eaadfb | https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb |
SpeakNet | import math
import torch
import torch.nn as nn
import torch.optim
def xavier_init(module):
"""
Xavier initializer for module parameters.
"""
for parameter in module.parameters():
if len(parameter.data.shape) == 1:
parameter.data.fill_(0)
else:
fan_in = parameter... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | aaronmueller/discourse-hw3 | SpeakNet | false | 1,350 | [
"MIT"
] | 0 | 93313a2ce83fde9480914384be52ec9160e967af | https://github.com/aaronmueller/discourse-hw3/tree/93313a2ce83fde9480914384be52ec9160e967af |
StochasticPool2D | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
class StochasticPool2D(nn.Module):
"""
Args:
kernel_size : size of the pooling kernel
stride : pool stride
Note: valid padding is implemented
"""
def __init__(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from torch.nn.modules.utils import _pair
assert_size_stride = torch... | abhishek30-ml/Multiple-Deep-Network-Learning | StochasticPool2D | false | 1,351 | [
"MIT"
] | 0 | adf705c004cc8a1e517eeed99e7030acb476dfd9 | https://github.com/abhishek30-ml/Multiple-Deep-Network-Learning/tree/adf705c004cc8a1e517eeed99e7030acb476dfd9 |
AvgPool2d | from torch.nn import Module
import torch
import torch as th
class AvgPool2d(Module):
"""
This class is the beginning of an exact python port of the torch.nn.AvgPool2d
module. Because PySyft cannot hook into layers which are implemented in C++,
our special functionalities (such as encrypted computation... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._em... | abogaziah/PySyft | AvgPool2d | false | 1,352 | [
"Apache-2.0"
] | 0 | 812dc6f350261793c67a928786fc081158f22a76 | https://github.com/abogaziah/PySyft/tree/812dc6f350261793c67a928786fc081158f22a76 |
ResidualBlock | import torch
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, in_channels):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=
in_channels, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(in_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_... | abhay97ps/visual-control-ppo-procgen | ResidualBlock | false | 1,353 | [
"MIT"
] | 0 | 765fe1ddb289d384abddc4df8eb865379c8da76a | https://github.com/abhay97ps/visual-control-ppo-procgen/tree/765fe1ddb289d384abddc4df8eb865379c8da76a |
Attention | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Attention(nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | abhinavrangarajan/genienlp | Attention | false | 1,354 | [
"BSD-3-Clause"
] | 0 | ba121274b3365739ce9e5a8facc9a2904149b9c7 | https://github.com/abhinavrangarajan/genienlp/tree/ba121274b3365739ce9e5a8facc9a2904149b9c7 |
LinearAttentionBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class LinearAttentionBlock(nn.Module):
def __init__(self, in_features):
super(LinearAttentionBlock, self).__init__()
self.op = nn.Conv2d(in_channels=in_features, out_channels=1,
kernel_size=1, padding=0, bias=False)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | abhay97ps/visual-control-ppo-procgen | LinearAttentionBlock | false | 1,355 | [
"MIT"
] | 0 | 765fe1ddb289d384abddc4df8eb865379c8da76a | https://github.com/abhay97ps/visual-control-ppo-procgen/tree/765fe1ddb289d384abddc4df8eb865379c8da76a |
SirenLayer | import torch
import numpy as np
from torch import nn
class SirenLayer(nn.Module):
def __init__(self, in_f, out_f, w0=30, is_first=False, is_last=False):
super().__init__()
self.in_f = in_f
self.w0 = w0
self.linear = nn.Linear(in_f, out_f)
self.is_first = is_first
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 math as tl_math
import numpy ... | abrilcf/pixel-nerf | SirenLayer | false | 1,356 | [
"BSD-2-Clause"
] | 0 | 9a6a8ab6c39ec01d52df3bf4c03830f7162cc679 | https://github.com/abrilcf/pixel-nerf/tree/9a6a8ab6c39ec01d52df3bf4c03830f7162cc679 |
ContextGating | import torch
from torch import nn
class ContextGating(nn.Module):
def __init__(self, input_num):
super(ContextGating, self).__init__()
self.sigmoid = nn.Sigmoid()
self.linear = nn.Linear(input_num, input_num)
def forward(self, x):
lin = self.linear(x.permute(0, 2, 3, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | aagnone3/dc19t2 | ContextGating | false | 1,357 | [
"Apache-2.0"
] | 0 | cc7baf2a8fe73d28c224f0bf68b5355efd96c24f | https://github.com/aagnone3/dc19t2/tree/cc7baf2a8fe73d28c224f0bf68b5355efd96c24f |
MultiHead | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Attention(nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | abhinavrangarajan/genienlp | MultiHead | false | 1,358 | [
"BSD-3-Clause"
] | 0 | ba121274b3365739ce9e5a8facc9a2904149b9c7 | https://github.com/abhinavrangarajan/genienlp/tree/ba121274b3365739ce9e5a8facc9a2904149b9c7 |
Net1 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.utils.data.distributed
class Net1(nn.Module):
def __init__(self):
super(Net1, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.conv2 = nn.Conv2d(32, 64, 3, 1)
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
import ... | abhinavs95/deep-learning-containers | Net1 | false | 1,359 | [
"Apache-2.0"
] | 0 | bd1cb70a8cd1cbb5d39bc825fc7ab9f53ebf9f89 | https://github.com/abhinavs95/deep-learning-containers/tree/bd1cb70a8cd1cbb5d39bc825fc7ab9f53ebf9f89 |
WeightedL2 | import torch
import torch.nn as nn
class WeightedL2(nn.Module):
def __init__(self):
super(WeightedL2, self).__init__()
def forward(self, x, target, w):
return torch.sum(w * (x - target) ** 2)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand(
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | acrosson/dl | WeightedL2 | false | 1,360 | [
"MIT"
] | 0 | 94e68533b38f53f09e9bef460ba96fa389fc8eb4 | https://github.com/acrosson/dl/tree/94e68533b38f53f09e9bef460ba96fa389fc8eb4 |
CustomGruCell | import torch
import numpy as np
import torch.nn as nn
class CustomGruCell(nn.Module):
"""
A forward only GRU cell.
Input should be: (sequence length x batch size x input_size).
The output is the output of the final forward call.
It's not clear if it would be possible to use the output from each ce... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | abogaziah/PySyft | CustomGruCell | false | 1,361 | [
"Apache-2.0"
] | 0 | 812dc6f350261793c67a928786fc081158f22a76 | https://github.com/abogaziah/PySyft/tree/812dc6f350261793c67a928786fc081158f22a76 |
ImpalaBlock | import torch
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, in_channels):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=
in_channels, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(in_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_... | abhay97ps/visual-control-ppo-procgen | ImpalaBlock | false | 1,362 | [
"MIT"
] | 0 | 765fe1ddb289d384abddc4df8eb865379c8da76a | https://github.com/abhay97ps/visual-control-ppo-procgen/tree/765fe1ddb289d384abddc4df8eb865379c8da76a |
MultiHeadAttention | import math
import torch
import torch.utils.checkpoint
from torch import nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
def forward(self, query, key, value, mask=None):
dk = query.size()[-1]
scores = query.matmul(key.transpose(-2, -1)) / math.sqrt(dk)
if 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
from torch._inductor.runtime.... | abedi1/ECLARe | MultiHeadAttention | false | 1,363 | [
"Apache-2.0"
] | 0 | a446b8086404b058923a9b3ce47e75cc40436a58 | https://github.com/abedi1/ECLARe/tree/a446b8086404b058923a9b3ce47e75cc40436a58 |
BertSelfOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.onnx
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Alwaysproblem/examples-1 | BertSelfOutput | false | 1,364 | [
"MIT"
] | 0 | 9754fa63ed1931489a21ac1f5b299f945e369a5c | https://github.com/Alwaysproblem/examples-1/tree/9754fa63ed1931489a21ac1f5b299f945e369a5c |
LinearWithChannel | import math
import torch
import torch.nn as nn
class LinearWithChannel(nn.Module):
def __init__(self, channel_size, input_size, output_size):
super(LinearWithChannel, self).__init__()
self.weight = torch.nn.Parameter(torch.zeros(channel_size,
output_size, input_size))
self.bia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | adam-coogan/swyft | LinearWithChannel | false | 1,365 | [
"MIT"
] | 0 | c54bdd9f77ddf02fda857e26640df012cbe545fc | https://github.com/adam-coogan/swyft/tree/c54bdd9f77ddf02fda857e26640df012cbe545fc |
WeightedL1 | import torch
import torch.nn as nn
class WeightedL1(nn.Module):
def __init__(self):
super(WeightedL1, self).__init__()
def forward(self, x, target, w):
return (w * torch.abs(x - target)).mean()
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand(
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | acrosson/dl | WeightedL1 | false | 1,366 | [
"MIT"
] | 0 | 94e68533b38f53f09e9bef460ba96fa389fc8eb4 | https://github.com/acrosson/dl/tree/94e68533b38f53f09e9bef460ba96fa389fc8eb4 |
minibatch_std_concat_layer | import copy
import torch
import torch.utils.data
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
class minibatch_std_concat_layer(nn.Module):
def __init__(self, averaging='all'):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
from torch.utils import data as data
import torch.nn as... | achrefjarray/ESRGANplus-master | minibatch_std_concat_layer | false | 1,367 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
ResidualBlockNoBN | import torch
import torch.utils.data
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torch.nn.modules.batchnorm import _BatchNorm
from torchvision.models import vgg as vgg
from torch import autograd as autograd
@torch.no_grad()
def default_init_weights(module_list, sc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | achrefjarray/ESRGANplus-master | ResidualBlockNoBN | false | 1,368 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
MySoftmax | import torch
import torch.nn as nn
import torch.nn.functional as F
class MySoftmax(nn.Module):
def forward(self, input_):
batch_size = input_.size()[0]
output_ = torch.stack([F.softmax(input_[i]) for i in range(
batch_size)], 0)
return output_
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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | acrosson/dl | MySoftmax | false | 1,369 | [
"MIT"
] | 0 | 94e68533b38f53f09e9bef460ba96fa389fc8eb4 | https://github.com/acrosson/dl/tree/94e68533b38f53f09e9bef460ba96fa389fc8eb4 |
CBR | import torch
import torch.nn as nn
class CBR(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size):
super(CBR, self).__init__()
self.cnn = nn.Conv2d(in_channels, out_channels, kernel_size, stride
=2, padding=2)
self.relu = nn.ReLU()
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | adamkrekorian/CI-UNet | CBR | false | 1,370 | [
"MIT"
] | 0 | fab0f8806540f5d79911bd81ba54dff135f9814f | https://github.com/adamkrekorian/CI-UNet/tree/fab0f8806540f5d79911bd81ba54dff135f9814f |
TransformerEncoderLayer | import math
import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class LayerNorm(nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | abhinavrangarajan/genienlp | TransformerEncoderLayer | false | 1,371 | [
"BSD-3-Clause"
] | 0 | ba121274b3365739ce9e5a8facc9a2904149b9c7 | https://github.com/abhinavrangarajan/genienlp/tree/ba121274b3365739ce9e5a8facc9a2904149b9c7 |
DCT | import torch
import torch.nn as nn
class DCT(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, out_pad=0):
super(DCT, self).__init__()
self.dcnn = nn.ConvTranspose2d(in_channels, out_channels,
kernel_size=2, stride=2, output_padding=out_pad)
self.tanh = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | adamkrekorian/CI-UNet | DCT | false | 1,372 | [
"MIT"
] | 0 | fab0f8806540f5d79911bd81ba54dff135f9814f | https://github.com/adamkrekorian/CI-UNet/tree/fab0f8806540f5d79911bd81ba54dff135f9814f |
CL | import torch
import torch.nn as nn
class CL(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size):
super(CL, self).__init__()
self.cnn = nn.Conv2d(in_channels, out_channels, kernel_size, stride
=2, padding=2)
self.lr = nn.LeakyReLU(negative_slope=0.2)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | adamkrekorian/CI-UNet | CL | false | 1,373 | [
"MIT"
] | 0 | fab0f8806540f5d79911bd81ba54dff135f9814f | https://github.com/adamkrekorian/CI-UNet/tree/fab0f8806540f5d79911bd81ba54dff135f9814f |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
import torch.utils.data
from torch.nn import functional as F
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
def pad(pad_type, padd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.autograd... | achrefjarray/ESRGANplus-master | ModulatedConv2d | false | 1,374 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
ToRGB | from torch.autograd import Function
import math
import torch
import torch.utils.data
from torch.nn import functional as F
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
def pad(pad_type, padd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
import torch.utils.data
from tor... | achrefjarray/ESRGANplus-master | ToRGB | false | 1,375 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
HighwayLayer | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
def my_xavier_init(m, gain=1):
"""Xavier initialization: weights initialization that tries to make variance of outputs
of a layer equal to variance of its inputs.
"""
for p in m.parameters():
if p.di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | adamlerer/droidlet | HighwayLayer | false | 1,376 | [
"MIT"
] | 0 | ada38d191dadcea9aba12330e35e8e7d6d1663d9 | https://github.com/adamlerer/droidlet/tree/ada38d191dadcea9aba12330e35e8e7d6d1663d9 |
GramMatrix | import torch
import torch.nn as nn
import torch.onnx
class GramMatrix(nn.Module):
def forward(self, input):
a, b, c, d = input.size()
features = input.view(a, b, c * d)
G = torch.matmul(features, torch.transpose(features, 1, 2))
return G.div(a * b * c * d)
def get_inputs():
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | adi-horowitz/final-project | GramMatrix | false | 1,377 | [
"MIT"
] | 0 | 0fd864663e92a6bcaa5f068e3e45b2a76460d335 | https://github.com/adi-horowitz/final-project/tree/0fd864663e92a6bcaa5f068e3e45b2a76460d335 |
MDN | import torch
import torch.nn as nn
import torch.nn.functional as F
class MDN(nn.Module):
def __init__(self, input_size, hidden_size, output_size, batch_size):
super(MDN, self).__init__()
self.hidden_size = hidden_size
self.batch_size = batch_size
self.z_h = nn.Linear(input_size, h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | adelaunay3/DL-Seq2Seq | MDN | false | 1,378 | [
"MIT"
] | 0 | 7b83e2501b26780ff2dec140ac15a6664699dc16 | https://github.com/adelaunay3/DL-Seq2Seq/tree/7b83e2501b26780ff2dec140ac15a6664699dc16 |
ConvReLUNorm | import torch
import torch.cuda
import torch.distributed
import torch.optim
class ConvReLUNorm(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0):
super(ConvReLUNorm, self).__init__()
self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_size=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | admariner/NeMo | ConvReLUNorm | false | 1,379 | [
"Apache-2.0"
] | 0 | e542d7f9063a40afa4119a3b94de4c2c636a37bb | https://github.com/admariner/NeMo/tree/e542d7f9063a40afa4119a3b94de4c2c636a37bb |
MultiHeadDense | import math
import torch
import torch.nn as nn
class MultiHeadDense(nn.Module):
def __init__(self, d):
super(MultiHeadDense, self).__init__()
self.weight = nn.Parameter(torch.Tensor(d, d))
self.register_parameter('bias', None)
self.reset_parameters()
def reset_parameters(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | afperezm/DeepGlobe-Road-Extraction-Challenge | MultiHeadDense | false | 1,380 | [
"MIT"
] | 0 | d3e0a8123d64baa3975663ece053edbc4bbdc4e6 | https://github.com/afperezm/DeepGlobe-Road-Extraction-Challenge/tree/d3e0a8123d64baa3975663ece053edbc4bbdc4e6 |
EqualLinear | from torch.autograd import Function
import math
import torch
import torch.utils.data
from torch.nn import functional as F
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
def fused_leaky_relu(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
import torch.utils.data
from tor... | achrefjarray/ESRGANplus-master | EqualLinear | false | 1,381 | [
"Apache-2.0"
] | 0 | ba470ec5c565a6dc8b48575b1e185ef6b796aec6 | https://github.com/achrefjarray/ESRGANplus-master/tree/ba470ec5c565a6dc8b48575b1e185ef6b796aec6 |
GlobalMaxPool1d | import torch
from torch import nn
class GlobalMaxPool1d(nn.Module):
"""Performs global max pooling over the entire length of a batched 1D tensor
# Arguments
input: Input tensor
"""
def forward(self, input):
return nn.functional.max_pool1d(input, kernel_size=input.size()[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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | aiswaryasankar/Few_shot_exp | GlobalMaxPool1d | false | 1,382 | [
"MIT"
] | 0 | 21c5a5d93dc69715b037a0fd2dca1b6f7d9de773 | https://github.com/aiswaryasankar/Few_shot_exp/tree/21c5a5d93dc69715b037a0fd2dca1b6f7d9de773 |
VectorQuantizer | import torch
from torch import Tensor
from torch import nn
from torch.nn import functional as F
class VectorQuantizer(nn.Module):
"""
Reference:
[1] https://github.com/deepmind/sonnet/blob/v2/sonnet/src/nets/vqvae.py
"""
def __init__(self, num_embeddings: 'int', embedding_dim: 'int', beta:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | adammoss/vae | VectorQuantizer | false | 1,383 | [
"Apache-2.0"
] | 0 | 52f0f56492e3ac7c8b866ae99d5333b4281a371f | https://github.com/adammoss/vae/tree/52f0f56492e3ac7c8b866ae99d5333b4281a371f |
VectorQuantizer | import torch
import torch.nn as nn
import torch.nn.functional as F
class VectorQuantizer(nn.Module):
def __init__(self, num_embeddings, embedding_dim, commitment_cost):
super(VectorQuantizer, self).__init__()
self._embedding_dim = embedding_dim
self._num_embeddings = num_embeddings
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | acyclics/neurips2020-procgen-starter-kit | VectorQuantizer | false | 1,384 | [
"Apache-2.0"
] | 0 | 16d52eb72d41c6b808c20644501710842134add4 | https://github.com/acyclics/neurips2020-procgen-starter-kit/tree/16d52eb72d41c6b808c20644501710842134add4 |
ANN | import torch
import torch.nn as nn
import torch.nn.functional as F
class ANN(nn.Module):
def __init__(self, n_li, n_l1, n_l2, n_l3, n_lo):
super(ANN, self).__init__()
self.lin_in = nn.Linear(n_li, n_l1)
self.lin_h1 = nn.Linear(n_l1, n_l2)
self.lin_h2 = nn.Linear(n_l2, n_l3)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | aixpact/python | ANN | false | 1,385 | [
"MIT"
] | 0 | 41256672472fec2c0f8bf6a9146c4053b16fd907 | https://github.com/aixpact/python/tree/41256672472fec2c0f8bf6a9146c4053b16fd907 |
Affine | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class Affine(nn.Module):
def __init__(self, dim):
super().__init__()
self.alpha = nn.Parameter(torch.ones((1, 1, dim)))
self.beta = nn.Parameter(torch.zeros((1, 1, dim)))
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | akarshkumar0101/timm-mlp-shaker | Affine | false | 1,386 | [
"Apache-2.0"
] | 0 | ab211dd137b790ac57f5ed924c2ada148d54a194 | https://github.com/akarshkumar0101/timm-mlp-shaker/tree/ab211dd137b790ac57f5ed924c2ada148d54a194 |
WeightedAttention | import torch
from torch import nn
class WeightedAttention(nn.Module):
def __init__(self, dim, eps=1e-08, softmax_dim=1, weighted_mean_dim=2):
super().__init__()
self.norm_input = nn.LayerNorm(dim)
self.norm_context = nn.LayerNorm(dim)
self.to_q = nn.Linear(dim, dim)
self.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.... | ajabri/slot-attention | WeightedAttention | false | 1,387 | [
"MIT"
] | 0 | 32acb6614f1bd511f2dc3c263f852ed2dbe9c213 | https://github.com/ajabri/slot-attention/tree/32acb6614f1bd511f2dc3c263f852ed2dbe9c213 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.