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 |
|---|---|---|---|---|---|---|---|---|---|---|
NaiveGroupNorm | from torch.nn import Module
import torch
from torch.nn import Parameter
from torch.nn import init
import torch.nn.parallel
class NaiveGroupNorm(Module):
"""NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch.
It is a temporary solution to export GN by ONNX before the... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
from torch.nn import Parameter
from torch.nn import... | hav4ik/AdelaiDet | NaiveGroupNorm | false | 3,719 | [
"BSD-2-Clause"
] | 0 | 6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2 | https://github.com/hav4ik/AdelaiDet/tree/6ed9c1e1a25a3e25dddfa858ce0f219a30593ce2 |
UpsampleLayer | import torch
import torch.nn as nn
class UpsampleLayer(nn.Module):
"""
"""
def __init__(self, scale_factor, mode='bilinear'):
"""
:param scale_factor:
:param mode:
"""
super().__init__()
self.scale_factor = scale_factor
self.mode = mode
def f... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | jianantian/yolo3-pytorch | UpsampleLayer | false | 3,720 | [
"BSD-3-Clause"
] | 0 | 8966f04c5b514a4f60fcb63b1fc753d0b13ebdcc | https://github.com/jianantian/yolo3-pytorch/tree/8966f04c5b514a4f60fcb63b1fc753d0b13ebdcc |
KLDLoss | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class KLDLoss(nn.Module):
def __init__(self, opt):
super().__init__()
def forward(self, mu, logvar):
kld_loss = torch.mean(-0.5 * torch.sum(1 + logvar - mu.pow(2) -
logvar.exp(), dim=1), dim=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.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | DSciLab/VAE-Lab | KLDLoss | false | 3,721 | [
"MIT"
] | 0 | ab37cc1399e3ece28ce426d8bd31149b8f492f82 | https://github.com/DSciLab/VAE-Lab/tree/ab37cc1399e3ece28ce426d8bd31149b8f492f82 |
MovingAvg | import torch
import torch.nn as nn
import torch.fft
class MovingAvg(nn.Module):
"""Moving average block to highlight the trend of time series."""
def __init__(self, kernel_size, stride):
super(MovingAvg, self).__init__()
self.kernel_size = kernel_size
self.avg = nn.AvgPool1d(kernel_si... | 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.fft
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | jianzhnie/TsFormer | MovingAvg | false | 3,722 | [
"Apache-2.0"
] | 0 | 47e362f02445ba00d5ab8db206667767e72faca7 | https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7 |
MLP | from torch.nn import Module
import torch
from torch.nn import Linear
from torch.nn import Sigmoid
from torch.nn.init import xavier_uniform_
class MLP(Module):
"""
Defines the NN model - in this case, there are 3 hidden layers,
13 inputs (defined by data) in the 1st, 10 inputs in the second,
and 8 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.nn import Module
from torch.nn import Linear
from torch.nn import Sig... | jfmalloy1/UltraMarathon_Prediction | MLP | false | 3,724 | [
"MIT"
] | 0 | 8eef7bd2860ce255994d32a0150c09b3b655cee7 | https://github.com/jfmalloy1/UltraMarathon_Prediction/tree/8eef7bd2860ce255994d32a0150c09b3b655cee7 |
CoarseGenerator | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import spectral_norm as spectral_norm_fn
from torch.nn.utils import weight_norm as weight_norm_fn
def gen_conv(input_dim, output_dim, kernel_size=3, stride=1, padding=0,
rate=1, activation='elu', gated=False):
"""
Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jacobwjs/generative-inpainting-pytorch | CoarseGenerator | false | 3,725 | [
"MIT"
] | 0 | 5cd5e818aa7394444b6c21df448d8b395492e4d7 | https://github.com/jacobwjs/generative-inpainting-pytorch/tree/5cd5e818aa7394444b6c21df448d8b395492e4d7 |
SeasonalLayerNorm | import torch
import torch.nn as nn
import torch.fft
class SeasonalLayerNorm(nn.Module):
"""Special designed layernorm for the seasonal part."""
def __init__(self, channels):
super(SeasonalLayerNorm, self).__init__()
self.layernorm = nn.LayerNorm(channels)
def forward(self, x):
x_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.fft
assert_size_stride = torch._C._dynamo.gu... | jianzhnie/TsFormer | SeasonalLayerNorm | false | 3,726 | [
"Apache-2.0"
] | 0 | 47e362f02445ba00d5ab8db206667767e72faca7 | https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7 |
TokenEmbedding | import torch
import torch.nn as nn
import torch.fft
class TokenEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.fft
assert_size_stride = torch._C._dynamo.gua... | jianzhnie/TsFormer | TokenEmbedding | false | 3,727 | [
"Apache-2.0"
] | 0 | 47e362f02445ba00d5ab8db206667767e72faca7 | https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7 |
InjectNoise | import torch
from torch import nn
import torch.utils.data
class InjectNoise(nn.Module):
def __init__(self, channels):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1, channels, 1, 1))
def forward(self, x):
noise = torch.randn((x.shape[0], 1, x.shape[2], x.shape[3]), devic... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_... | jiazhi412/Machine-Learning-Collection | InjectNoise | false | 3,728 | [
"MIT"
] | 0 | 1c30faf1e27a79eeca966c017e956df8f7f6ef17 | https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17 |
WSConv2d | import torch
from torch import nn
import torch.utils.data
class WSConv2d(nn.Module):
"""
Weight scaled Conv2d (Equalized Learning Rate)
Note that input is multiplied rather than changing weights
this will have the same result.
Inspired and looked at:
https://github.com/nvnbny/progressive_grow... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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
assert_size_stride = torch._C._dyna... | jiazhi412/Machine-Learning-Collection | WSConv2d | false | 3,729 | [
"MIT"
] | 0 | 1c30faf1e27a79eeca966c017e956df8f7f6ef17 | https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17 |
MLP | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class Conv1D(nn.Module):
def __init__(self, nf, nx):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | CaptainJa/demo-torch-gpt2 | MLP | false | 3,730 | [
"MIT"
] | 0 | 83d6074e8b321101e08c0aa5749c8eb988a5faa8 | https://github.com/CaptainJa/demo-torch-gpt2/tree/83d6074e8b321101e08c0aa5749c8eb988a5faa8 |
CNN | import torch
import torch.nn as nn
import torch.fft
class CNN(nn.Module):
"""Convolutional Neural Networks."""
def __init__(self, input_size, hidden_dim, output_size):
super(CNN, self).__init__()
self.Conv1 = nn.Conv1d(in_channels=input_size, out_channels=
hidden_dim, 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
import torch.nn as nn
import ... | jianzhnie/TsFormer | CNN | false | 3,731 | [
"Apache-2.0"
] | 0 | 47e362f02445ba00d5ab8db206667767e72faca7 | https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7 |
SeriesDecomp | import torch
import torch.nn as nn
import torch.fft
class MovingAvg(nn.Module):
"""Moving average block to highlight the trend of time series."""
def __init__(self, kernel_size, stride):
super(MovingAvg, self).__init__()
self.kernel_size = kernel_size
self.avg = nn.AvgPool1d(kernel_si... | 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.fft
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | jianzhnie/TsFormer | SeriesDecomp | false | 3,732 | [
"Apache-2.0"
] | 0 | 47e362f02445ba00d5ab8db206667767e72faca7 | https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7 |
WSLinear | import torch
from torch import nn
import torch.utils.data
class WSLinear(nn.Module):
def __init__(self, in_features, out_features, gain=2):
super(WSLinear, self).__init__()
self.linear = nn.Linear(in_features, out_features)
self.scale = (gain / in_features) ** 0.5
self.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
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dyna... | jiazhi412/Machine-Learning-Collection | WSLinear | false | 3,733 | [
"MIT"
] | 0 | 1c30faf1e27a79eeca966c017e956df8f7f6ef17 | https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17 |
LatentLoss | import torch
from torch import Tensor
import torch.nn as nn
class LatentLoss(nn.Module):
def forward(self, mu: 'Tensor', logvar: 'Tensor') ->Tensor:
loss = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())
return loss
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | jinyeom/vae | LatentLoss | false | 3,734 | [
"MIT"
] | 0 | 861cb2edd5cebc9f56c2677d7b79f5ab0a05f874 | https://github.com/jinyeom/vae/tree/861cb2edd5cebc9f56c2677d7b79f5ab0a05f874 |
DotProductSimilarity | import math
import torch
import torch.nn as nn
class SimilarityFunction(nn.Module):
"""
A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity
function on the vectors in the last dimension. For example, the tensors might both have shape
`(batch_size, sentence_... | 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... | immrz/qagnn | DotProductSimilarity | false | 3,735 | [
"MIT"
] | 0 | 0e695c6fcbefcf25da25c056c0bea1940b3e0f2b | https://github.com/immrz/qagnn/tree/0e695c6fcbefcf25da25c056c0bea1940b3e0f2b |
MultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.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.... | jiahuanluo/Global-Encoding | MultiHeadAttention | false | 3,736 | [
"MIT"
] | 0 | 2adb01def9525588b3a75e6f2a5181a3a11464ed | https://github.com/jiahuanluo/Global-Encoding/tree/2adb01def9525588b3a75e6f2a5181a3a11464ed |
NN | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
class NN(nn.Module):
def __init__(self, input_size, num_classes):
super(NN, self).__init__()
self.fc1 = nn.Linear(input_size, 50)
self.fc2 = nn.Linear(50, num_classes)
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
from torch import nn
import t... | jiazhi412/Machine-Learning-Collection | NN | false | 3,737 | [
"MIT"
] | 0 | 1c30faf1e27a79eeca966c017e956df8f7f6ef17 | https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17 |
DummyLayer | import torch
import torch.nn as nn
class DummyLayer(nn.Module):
def __init__(self):
super().__init__()
self.dummy = nn.Parameter(torch.ones(1, dtype=torch.float))
def forward(self, x):
return x + self.dummy - self.dummy
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | jishnujayakumar/specter | DummyLayer | false | 3,738 | [
"Apache-2.0"
] | 0 | 40e3b5e538004b00b0955f17dd3d71fb1f96b922 | https://github.com/jishnujayakumar/specter/tree/40e3b5e538004b00b0955f17dd3d71fb1f96b922 |
MatrixAttention | import math
import torch
import torch.nn as nn
class SimilarityFunction(nn.Module):
"""
A ``SimilarityFunction`` takes a pair of tensors with the same shape, and computes a similarity
function on the vectors in the last dimension. For example, the tensors might both have shape
`(batch_size, sentence_... | 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 math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | immrz/qagnn | MatrixAttention | false | 3,739 | [
"MIT"
] | 0 | 0e695c6fcbefcf25da25c056c0bea1940b3e0f2b | https://github.com/immrz/qagnn/tree/0e695c6fcbefcf25da25c056c0bea1940b3e0f2b |
BinaryLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class BinaryLoss(nn.Module):
"""
Computes contrastive loss[1, 2] twice, one time for the distance between query and positive example,
and another for the distance between query and negative example. Both use l2-distance.
[1] http:/... | 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... | jishnujayakumar/specter | BinaryLoss | false | 3,740 | [
"Apache-2.0"
] | 0 | 40e3b5e538004b00b0955f17dd3d71fb1f96b922 | https://github.com/jishnujayakumar/specter/tree/40e3b5e538004b00b0955f17dd3d71fb1f96b922 |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed):
"""Initialize parameters and build model.
Params
======
state_size (int): Dimension of each 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
import torch.nn as nn
assert_... | jibin-liu/deep-reinforcement-learning | QNetwork | false | 3,741 | [
"MIT"
] | 0 | 2a91a66a931e891d08cd1af95da973a522381b52 | https://github.com/jibin-liu/deep-reinforcement-learning/tree/2a91a66a931e891d08cd1af95da973a522381b52 |
AdaIN | import torch
from torch import nn
import torch.utils.data
class WSLinear(nn.Module):
def __init__(self, in_features, out_features, gain=2):
super(WSLinear, self).__init__()
self.linear = nn.Linear(in_features, out_features)
self.scale = (gain / in_features) ** 0.5
self.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
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | jiazhi412/Machine-Learning-Collection | AdaIN | false | 3,742 | [
"MIT"
] | 0 | 1c30faf1e27a79eeca966c017e956df8f7f6ef17 | https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17 |
MatrixVectorScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
class MatrixVectorScaledDotProductAttention(nn.Module):
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
self.softmax = nn.Softmax(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.... | immrz/qagnn | MatrixVectorScaledDotProductAttention | false | 3,743 | [
"MIT"
] | 0 | 0e695c6fcbefcf25da25c056c0bea1940b3e0f2b | https://github.com/immrz/qagnn/tree/0e695c6fcbefcf25da25c056c0bea1940b3e0f2b |
Qnet | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
class Qnet(nn.Module):
def __init__(self):
super(Qnet, self).__init__()
self.fc1 = nn.Linear(4, 128)
self.fc2 = nn.Linear(128, 128)
self.fc3 = nn.Linear(128, 2)
def forward(self, x):
x = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import random
import torch.nn... | jinPrelude/minimalRL | Qnet | false | 3,744 | [
"MIT"
] | 0 | 4eba82feac15bb29f4ad715c6c8fd7b11426b840 | https://github.com/jinPrelude/minimalRL/tree/4eba82feac15bb29f4ad715c6c8fd7b11426b840 |
ChannelMaxPool | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelMaxPool(nn.MaxPool1d):
def forward(self, input):
n, c, w, h = input.size()
input = input.view(n, c, w * h).permute(0, 2, 1)
pooled = F.max_pool1d(input, self.kernel_size, self.stride, self.
padding... | 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... | joeization/CycleGAN | ChannelMaxPool | false | 3,745 | [
"MIT"
] | 0 | 9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 | https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 |
Policy | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Policy(nn.Module):
def __init__(self, s_size=4, h_size=16, a_size=2):
super(Policy, self).__init__()
self.fc1 = nn.Linear(s_size, h_size)
self.fc2 = nn.Linear(h_size, a_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jiruifu-jerry0219/DRLND_Jerry | Policy | false | 3,746 | [
"MIT"
] | 0 | 6a342f99119d466f8ae96202452b034f1a2e70e1 | https://github.com/jiruifu-jerry0219/DRLND_Jerry/tree/6a342f99119d466f8ae96202452b034f1a2e70e1 |
SelfAttention | import torch
from torch import nn
import torch.utils.data
class SelfAttention(nn.Module):
def __init__(self, embed_size, heads):
super(SelfAttention, self).__init__()
self.embed_size = embed_size
self.heads = heads
self.head_dim = embed_size // heads
assert self.head_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.... | jiazhi412/Machine-Learning-Collection | SelfAttention | false | 3,747 | [
"MIT"
] | 0 | 1c30faf1e27a79eeca966c017e956df8f7f6ef17 | https://github.com/jiazhi412/Machine-Learning-Collection/tree/1c30faf1e27a79eeca966c017e956df8f7f6ef17 |
GELU | import torch
import numpy as np
import torch.nn as nn
class GELU(nn.Module):
"""Gaussian Error Linear Unit.
Dan Hendrycks∗, Kevin Gimpel
GAUSSIAN ERROR LINEAR UNITS (GELUS), 2016
Args:
x: float Tensor to perform activation.
Returns:
`x` with the GELU activation applied.
"""
... | 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_... | joeization/CycleGAN | GELU | false | 3,748 | [
"MIT"
] | 0 | 9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 | https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 |
BertSelfOutput | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.checkpoint
class BertSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(confi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Hzfinfdu/Black-Box-Tuning | BertSelfOutput | false | 3,749 | [
"MIT"
] | 0 | 64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 | https://github.com/Hzfinfdu/Black-Box-Tuning/tree/64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 |
NPRNNCell | import torch
from torch import nn
class NPRNNCell(nn.Module):
def __init__(self, input_size, hidden_size, output_size, clip=2.0):
super().__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.clip = clip
self.fc_in = nn.Linear(input_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 import triton_helpers
from torch._inductor.runtime.... | jinyeom/ga-plastic-models | NPRNNCell | false | 3,750 | [
"MIT"
] | 0 | e38b245ae51c35a5f32679cc9f215463a3d58f1a | https://github.com/jinyeom/ga-plastic-models/tree/e38b245ae51c35a5f32679cc9f215463a3d58f1a |
BlurPool2d | import torch
import torch.nn as nn
class BlurPool2d(nn.Sequential):
"""Blur Pooling Layer (MaxPool2d replacement)
See: https://richzhang.github.io/antialiased-cnns/
Paper: https://arxiv.org/abs/1904.11486
"""
__constants__ = ['in_features']
_blur_kernel = torch.tensor([[1 / 16, 2 / 16, 1 / 16]... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | johanofverstedt/comir | BlurPool2d | false | 3,751 | [
"MIT"
] | 0 | fced349ebe3a7bf07ac59e25f02ca4780796b041 | https://github.com/johanofverstedt/comir/tree/fced349ebe3a7bf07ac59e25f02ca4780796b041 |
ChannelAvgPool | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelAvgPool(nn.AvgPool1d):
def forward(self, input):
n, c, w, h = input.size()
input = input.view(n, c, w * h).permute(0, 2, 1)
pooled = F.avg_pool1d(input, self.kernel_size, self.stride, self.
padding... | 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... | joeization/CycleGAN | ChannelAvgPool | false | 3,752 | [
"MIT"
] | 0 | 9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 | https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 |
IndependentNACLayer | import collections
import scipy
import torch
import numpy as np
import torch.utils.data
import scipy.stats
import scipy.optimize
def sparsity_error(W):
W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W)))
return torch.max(W_error)
def nac_w_variance(r):
"""Calculates the variance of W.
As... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 collections
... | hoedt/stable-nalu | IndependentNACLayer | false | 3,753 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
Encoder | import torch
from torch import nn
from torch.nn import functional as F
class Encoder(nn.Module):
def __init__(self, latent_size):
super().__init__()
self.latent_size = latent_size
self.conv1 = nn.Conv2d(3, 32, 4, stride=2)
self.conv2 = nn.Conv2d(32, 64, 4, stride=2)
self.c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | jinyeom/ga-plastic-models | Encoder | false | 3,754 | [
"MIT"
] | 0 | e38b245ae51c35a5f32679cc9f215463a3d58f1a | https://github.com/jinyeom/ga-plastic-models/tree/e38b245ae51c35a5f32679cc9f215463a3d58f1a |
Decoder | import torch
from torch import nn
from torch.nn import functional as F
class Decoder(nn.Module):
def __init__(self, latent_size):
super().__init__()
self.latent_size = latent_size
self.fc1 = nn.Linear(latent_size, 1024)
self.deconv1 = nn.ConvTranspose2d(1024, 128, 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... | jinyeom/ga-plastic-models | Decoder | false | 3,755 | [
"MIT"
] | 0 | e38b245ae51c35a5f32679cc9f215463a3d58f1a | https://github.com/jinyeom/ga-plastic-models/tree/e38b245ae51c35a5f32679cc9f215463a3d58f1a |
CoralLayer | import torch
import torch.nn
class CoralLayer(torch.nn.Module):
""" Implements CORAL layer described in
Cao, Mirjalili, and Raschka (2020)
*Rank Consistent Ordinal Regression for Neural Networks
with Application to Age Estimation*
Pattern Recognition Letters, https://doi.org/10.1016/j.patrec.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
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
... | johann-petrak/farm-tools | CoralLayer | false | 3,756 | [
"Apache-2.0"
] | 0 | 7d379bbc5b9b079eedd4a11d7bdb1636c0ad834c | https://github.com/johann-petrak/farm-tools/tree/7d379bbc5b9b079eedd4a11d7bdb1636c0ad834c |
SelfAttention | import torch
from torch.nn import functional as F
from torch import nn
class SelfAttention(nn.Module):
def __init__(self, k, heads=8):
super().__init__()
self.k, self.heads = k, heads
self.toKeys = nn.Linear(k, k * heads, bias=False)
self.toQueries = nn.Linear(k, k * heads, bias=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.... | jiyfeng/transformer-text-tasks | SelfAttention | false | 3,757 | [
"MIT"
] | 0 | b06349ca759bc8084a5880a425153dfdd7b91a98 | https://github.com/jiyfeng/transformer-text-tasks/tree/b06349ca759bc8084a5880a425153dfdd7b91a98 |
Model | import torch
import torch.nn as nn
import torch.nn.functional as f
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.conv = nn.Conv2d(1, 16, 5)
self.pool = nn.MaxPool2d(2, 2)
self.fc = nn.Linear(2304, 10)
def forward(self, x):
x = self.poo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | jizongFox/adversarial-robustness-toolbox | Model | false | 3,758 | [
"MIT"
] | 0 | 0649fe44d42bc7ba39a4b1a2ff95a31320fd1ae5 | https://github.com/jizongFox/adversarial-robustness-toolbox/tree/0649fe44d42bc7ba39a4b1a2ff95a31320fd1ae5 |
DataEmbedding_wo_pos | import math
import torch
import torch.nn as nn
import torch.fft
class PositionalEmbedding(nn.Module):
def __init__(self, d_model, max_len=5000):
super(PositionalEmbedding, self).__init__()
pe = torch.zeros(max_len, d_model).float()
pe.require_grad = False
position = torch.arange(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 math
import torch.nn as nn
import torch.fft
assert_size_stride = torch._C... | jianzhnie/TsFormer | DataEmbedding_wo_pos | false | 3,759 | [
"Apache-2.0"
] | 0 | 47e362f02445ba00d5ab8db206667767e72faca7 | https://github.com/jianzhnie/TsFormer/tree/47e362f02445ba00d5ab8db206667767e72faca7 |
LossLoglikelihoodNb | import torch
class LossLoglikelihoodNb(torch.nn.Module):
def __init__(self, average=True):
super(LossLoglikelihoodNb, self).__init__()
self.average = average
def forward(self, preds, target):
"""Implements the negative log likelihood loss as VAE reconstruction loss"""
x = tar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
assert_size... | johnmous/sfaira | LossLoglikelihoodNb | false | 3,760 | [
"BSD-3-Clause"
] | 0 | c50240a74530e614ab7681bf9c63b04cb815b361 | https://github.com/johnmous/sfaira/tree/c50240a74530e614ab7681bf9c63b04cb815b361 |
BCEAfterSigmoidLoss | import torch
from torch import nn
from torch.nn import functional
import torch.autograd
class Loss(nn.Module):
"""A loss function."""
class PointwiseLoss(Loss):
"""Pointwise loss functions compute an independent loss term for each triple-label pair."""
class BCEAfterSigmoidLoss(PointwiseLoss):
"""A 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, math as tl_math
from torch ... | johnbachman/pykeen | BCEAfterSigmoidLoss | false | 3,761 | [
"MIT"
] | 0 | 6595f6cefc462b6d1e057446e6c3ed66d36a078b | https://github.com/johnbachman/pykeen/tree/6595f6cefc462b6d1e057446e6c3ed66d36a078b |
unet_bottleneck | import torch
import torch.nn as nn
class unet_bottleneck(nn.Module):
def __init__(self, in_ch, out_ch, ker=3):
super(unet_bottleneck, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.conv1 = nn.Conv2d(in_ch, out_ch, 1)
self.bn1 = nn.GroupNorm(out_ch // 4, out_ch)
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.... | joeization/CycleGAN | unet_bottleneck | false | 3,762 | [
"MIT"
] | 0 | 9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 | https://github.com/joeization/CycleGAN/tree/9635c8e3a7b1634b2e2eb5b5299f03a4e0786868 |
LossCrossentropyAgg | import torch
class LossCrossentropyAgg(torch.nn.Module):
def __init__(self):
super(LossCrossentropyAgg, self).__init__()
def forward(self, preds, target):
""" Modified crossentropy that aggregates allowed output classes into single class. """
preds = torch.clamp(preds, min=1e-10, max... | 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... | johnmous/sfaira | LossCrossentropyAgg | false | 3,763 | [
"BSD-3-Clause"
] | 0 | c50240a74530e614ab7681bf9c63b04cb815b361 | https://github.com/johnmous/sfaira/tree/c50240a74530e614ab7681bf9c63b04cb815b361 |
CmapPafHead | import torch
import torch.utils.data
import torch.nn
import torch.optim
class UpsampleCBR(torch.nn.Sequential):
def __init__(self, input_channels, output_channels, count=1, num_flat=0):
layers = []
for i in range(count):
if i == 0:
inch = input_channels
els... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.nn
import torch.optim
assert_size_stride = ... | intflow/trt_openpose | CmapPafHead | false | 3,764 | [
"MIT"
] | 0 | 526b1b0d463f1c86a45ca4d4cd77a41732c7654b | https://github.com/intflow/trt_openpose/tree/526b1b0d463f1c86a45ca4d4cd77a41732c7654b |
NearestInterp | import torch
class NearestInterp(torch.nn.Module):
"""
Nearest neighbor interpolation layer.
note:
From the source code, it appears that Darknet uses
nearest neighbor method for its upsampling layer
(darknet master-30 oct 2018).
Internally calls torch.nn.functional.interpolate
to suppress the war... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | jonathanzjl/cam-vision | NearestInterp | false | 3,765 | [
"BSD-2-Clause"
] | 0 | d1bd865b147ea1137979b624c64a6baa4a4b0714 | https://github.com/jonathanzjl/cam-vision/tree/d1bd865b147ea1137979b624c64a6baa4a4b0714 |
NoisyLinear | import math
import torch
import torch.nn as nn
import torch.nn
import torch.optim
class NoisyLinear(nn.Linear):
def __init__(self, in_dimension, out_dimension, std_dev_init=0.4) ->None:
"""
Noisy Networks for Exploration: https://arxiv.org/abs/1706.10295
Standard linear layer: y = wx + b
... | 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 libd... | johncliu/Horizon | NoisyLinear | false | 3,766 | [
"BSD-3-Clause"
] | 0 | cfa7a873ada5de3bb01e78e2f237d9849b8270b2 | https://github.com/johncliu/Horizon/tree/cfa7a873ada5de3bb01e78e2f237d9849b8270b2 |
ExpandNetLoss | import torch
from torch import nn
class ExpandNetLoss(nn.Module):
def __init__(self, loss_lambda=5):
super(ExpandNetLoss, self).__init__()
self.similarity = torch.nn.CosineSimilarity(dim=1, eps=1e-20)
self.l1_loss = nn.L1Loss()
self.loss_lambda = loss_lambda
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
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | jongwookyi/hdr-expandnet | ExpandNetLoss | false | 3,767 | [
"BSD-3-Clause-Clear"
] | 0 | 0594605c8f2041bc592c20c1e7fd8615994c6b01 | https://github.com/jongwookyi/hdr-expandnet/tree/0594605c8f2041bc592c20c1e7fd8615994c6b01 |
ComplexConv2d | import torch
import torch.nn as nn
class ComplexConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True, **kwargs):
super().__init__()
self.conv_re = nn.Conv2d(in_channels, out_channels, kernel_size,
st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | jonashaag/PhoneFortifiedPerceptualLoss | ComplexConv2d | false | 3,768 | [
"MIT"
] | 0 | 1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd | https://github.com/jonashaag/PhoneFortifiedPerceptualLoss/tree/1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd |
ComplexConvTranspose2d | import torch
import torch.nn as nn
class ComplexConvTranspose2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, output_padding=0, dilation=1, groups=1, bias=True, **kwargs
):
super().__init__()
self.tconv_re = nn.ConvTranspose2d(in_chann... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | jonashaag/PhoneFortifiedPerceptualLoss | ComplexConvTranspose2d | false | 3,769 | [
"MIT"
] | 0 | 1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd | https://github.com/jonashaag/PhoneFortifiedPerceptualLoss/tree/1dabdd4203f59c2d1bfe22bffc4c63b204aa50bd |
AddPositionalEncoding | import torch
import torch.nn as nn
import torch.onnx
class AddPositionalEncoding(nn.Module):
def __init__(self, hidden_size, max_sequence_length):
super(AddPositionalEncoding, self).__init__()
self.hidden_size = hidden_size
self.max_sequence_length = max_sequence_length
self.posit... | 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... | jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch | AddPositionalEncoding | false | 3,770 | [
"MIT"
] | 0 | d27d2d390f0831330405c16bd29c7f331ad2007a | https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a |
GatedConv1d | import torch
import torch.nn as nn
import torch.onnx
class MaskedConv1d(nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, dilation=1,
groups=1, bias=True, causal=True):
if causal:
padding = (kernel_size - 1) * dilation
else:
padding = (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
import torch.nn as nn
import torch.onnx
assert_size_stride = torch._C._dynamo.gu... | jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch | GatedConv1d | false | 3,771 | [
"MIT"
] | 0 | d27d2d390f0831330405c16bd29c7f331ad2007a | https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a |
MaskedConv1d | import torch
import torch.nn as nn
import torch.onnx
class MaskedConv1d(nn.Conv1d):
def __init__(self, in_channels, out_channels, kernel_size, dilation=1,
groups=1, bias=True, causal=True):
if causal:
padding = (kernel_size - 1) * dilation
else:
padding = (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
import torch.nn as nn
import torch.onnx
assert_size_stride = torch._C._dynamo.gu... | jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch | MaskedConv1d | false | 3,772 | [
"MIT"
] | 0 | d27d2d390f0831330405c16bd29c7f331ad2007a | https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a |
Swish | import torch
from torch import nn
class Swish(nn.Module):
def forward(self, x):
return torch.sigmoid(x) * x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | jseppanen/sacking | Swish | false | 3,773 | [
"Apache-2.0"
] | 0 | ff16d9a0cbec2661bc84be33ee4b3987be22228e | https://github.com/jseppanen/sacking/tree/ff16d9a0cbec2661bc84be33ee4b3987be22228e |
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.... | joyce-fang/deep-reinforcement-learning | Actor | false | 3,774 | [
"MIT"
] | 0 | 62cedab584465bd1c3ef112eb149e8fc611546e3 | https://github.com/joyce-fang/deep-reinforcement-learning/tree/62cedab584465bd1c3ef112eb149e8fc611546e3 |
SDPAttention | import torch
import torch.nn as nn
import torch.onnx
import torch.nn.functional as F
class SDPAttention(nn.Module):
"""
Scaled Dot-Product Attention
"""
def __init__(self, dropout=0, causal=False):
super(SDPAttention, self).__init__()
self.causal = causal
self.dropout = nn.Dro... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch | SDPAttention | false | 3,775 | [
"MIT"
] | 0 | d27d2d390f0831330405c16bd29c7f331ad2007a | https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a |
ResidualBlock | import torch
import torch.nn as nn
class CausalConv1d(torch.nn.Conv1d):
"""Causal 1d convolution"""
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
dilation=1, groups=1, bias=True):
self.__padding = (kernel_size - 1) * dilation
super(CausalConv1d, self).__init__(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._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | jonasvj/protein-generation | ResidualBlock | false | 3,776 | [
"MIT"
] | 0 | ad716f2dba6f6642a6d54571571e6f539cee3644 | https://github.com/jonasvj/protein-generation/tree/ad716f2dba6f6642a6d54571571e6f539cee3644 |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | joyce-fang/deep-reinforcement-learning | Critic | false | 3,777 | [
"MIT"
] | 0 | 62cedab584465bd1c3ef112eb149e8fc611546e3 | https://github.com/joyce-fang/deep-reinforcement-learning/tree/62cedab584465bd1c3ef112eb149e8fc611546e3 |
QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed):
"""Initialize parameters and build model.
Params
======
state_size (int): Dimension of each 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
import torch.nn as nn
assert_... | jsztompka/DuelDQN | QNetwork | false | 3,778 | [
"MIT"
] | 0 | 3b1234425b66034ef233ac988305dc13ffbf7ace | https://github.com/jsztompka/DuelDQN/tree/3b1234425b66034ef233ac988305dc13ffbf7ace |
LeakyClamp | import torch
import torch.nn as nn
class LeakyClamp(nn.Module):
def __init__(self, cap):
super(LeakyClamp, self).__init__()
self.cap = cap
self.leakyrelu = nn.LeakyReLU(inplace=False)
self.leakyrelu2 = nn.LeakyReLU(inplace=False)
def forward(self, x):
x = self.leakyre... | 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... | junweima/pytorch-cnn-visualizations | LeakyClamp | false | 3,779 | [
"MIT"
] | 0 | c535e76e0a169d02a17ec5c8cc109ea687d698c1 | https://github.com/junweima/pytorch-cnn-visualizations/tree/c535e76e0a169d02a17ec5c8cc109ea687d698c1 |
MultiHeadAttention | import torch
import numpy as np
from torch import nn
import torch.nn.parallel
class MultiHeadAttention(nn.Module):
def __init__(self, heads_count, d_model, dropout_prob):
super().__init__()
assert d_model % heads_count == 0, f'model dim {d_model} not divisible by {heads_count} heads'
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | junchen14/video_language | MultiHeadAttention | false | 3,780 | [
"Apache-2.0"
] | 0 | 1d6d304b795501d1e0d56351047a259d992fab23 | https://github.com/junchen14/video_language/tree/1d6d304b795501d1e0d56351047a259d992fab23 |
AttentionLayer | import torch
import torch.nn as nn
import torch.onnx
import torch.nn.functional as F
class AttentionLayer(nn.Module):
"""
Attention layer according to https://arxiv.org/abs/1409.0473.
Params:
num_units: Number of units used in the attention layer
"""
def __init__(self, query_size, key_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.... | jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch | AttentionLayer | false | 3,781 | [
"MIT"
] | 0 | d27d2d390f0831330405c16bd29c7f331ad2007a | https://github.com/jonndoe/Character-Level-Language-Modeling-with-Deeper-Self-Attention-pytorch/tree/d27d2d390f0831330405c16bd29c7f331ad2007a |
FourierConv1d | import torch
class FourierConv1d(torch.nn.Module):
def __init__(self, in_channels, out_channels, size, bias=True, periodic
=False):
super(FourierConv1d, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
if not periodic:
self.size ... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty... | julian-parker/DAFX22_FNO | FourierConv1d | false | 3,782 | [
"MIT"
] | 0 | 72f30144317a3f8ba8ea23ecf9a0333c81fc87db | https://github.com/julian-parker/DAFX22_FNO/tree/72f30144317a3f8ba8ea23ecf9a0333c81fc87db |
Duel_QNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class Duel_QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed):
"""Initialize parameters and build model.
Params
======
state_size (int): Dimension of each sta... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | jsztompka/DuelDQN | Duel_QNetwork | false | 3,783 | [
"MIT"
] | 0 | 3b1234425b66034ef233ac988305dc13ffbf7ace | https://github.com/jsztompka/DuelDQN/tree/3b1234425b66034ef233ac988305dc13ffbf7ace |
VAE | import torch
from torch import nn
from torch.nn import functional as F
class Encoder(nn.Module):
def __init__(self, latent_size):
super().__init__()
self.latent_size = latent_size
self.conv1 = nn.Conv2d(3, 32, 4, stride=2)
self.conv2 = nn.Conv2d(32, 64, 4, stride=2)
self.c... | 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... | jinyeom/ga-plastic-models | VAE | false | 3,784 | [
"MIT"
] | 0 | e38b245ae51c35a5f32679cc9f215463a3d58f1a | https://github.com/jinyeom/ga-plastic-models/tree/e38b245ae51c35a5f32679cc9f215463a3d58f1a |
ContrastiveLoss | import torch
from torchvision import transforms as transforms
import torch.nn as nn
import torch.nn.functional as F
class ContrastiveLoss(nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin):
... | 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
from torchvision import tran... | justinluyao/phd_thesis | ContrastiveLoss | false | 3,785 | [
"MIT"
] | 0 | 0a61f5deaac86dd34839ce24c2ad89e1411a8540 | https://github.com/justinluyao/phd_thesis/tree/0a61f5deaac86dd34839ce24c2ad89e1411a8540 |
MultiHeadSelfAttention | from torch.nn import Module
import torch
from torch.nn import Dropout
from torch.nn import Linear
def masked_softmax(vector: 'torch.Tensor', mask: 'torch.Tensor', dim: 'int'=-1
) ->torch.Tensor:
"""
``torch.nn.functional.softmax(vector)`` does not work if some elements of ``vector`` should be
masked. ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | jsonW0/StrokeOrderEmbeddings | MultiHeadSelfAttention | false | 3,786 | [
"Apache-2.0"
] | 0 | aa73b216a118de2efba1d299b96990ba9244fa3f | https://github.com/jsonW0/StrokeOrderEmbeddings/tree/aa73b216a118de2efba1d299b96990ba9244fa3f |
CustomGruCell | import torch
import numpy as np
from torch import 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 cel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | juharris/PySyft | CustomGruCell | false | 3,787 | [
"Apache-2.0"
] | 0 | dbb70f24cc55a7dca032fb06f1a8662cb15092a9 | https://github.com/juharris/PySyft/tree/dbb70f24cc55a7dca032fb06f1a8662cb15092a9 |
EncoderImagePrecomp | import torch
import numpy as np
from collections import OrderedDict
import torch.nn as nn
import torch.nn.init
def l2norm(X):
"""L2-normalize columns of X
"""
norm = torch.pow(X, 2).sum(dim=1, keepdim=True).sqrt()
a = norm.expand_as(X)
X = torch.div(X, a)
return X
class EncoderImagePrecomp(n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | jwehrmann/seamretrieval | EncoderImagePrecomp | false | 3,788 | [
"Apache-2.0"
] | 0 | ff94dccc28d56ffbbb7813832c0adbab7b7c6107 | https://github.com/jwehrmann/seamretrieval/tree/ff94dccc28d56ffbbb7813832c0adbab7b7c6107 |
ATANLoss | import torch
import torch.nn as nn
class ATANLoss(nn.Module):
def __init__(self):
super(ATANLoss, self).__init__()
def forward(self, inputs, targets):
loss = torch.mean(torch.atan(torch.abs(inputs - targets)))
return loss
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | kamomehz/waveletCodingCNN | ATANLoss | false | 3,789 | [
"MIT"
] | 0 | 50c7db9d986039ded38999b7e4f4265e2250fb90 | https://github.com/kamomehz/waveletCodingCNN/tree/50c7db9d986039ded38999b7e4f4265e2250fb90 |
Hidden2DiscreteDeal | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init
class Hidden2DiscreteDeal(nn.Module):
def __init__(self, input_size, z_size, is_lstm=False, has_bias=True):
super(Hidden2DiscreteDeal, self).__init__()
self.z_size = z_size
latent_size = self.z_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.... | justinchiu/NeuralDialog | Hidden2DiscreteDeal | false | 3,790 | [
"Apache-2.0"
] | 0 | f272cc2e12ffdd44c94263ee373208a22c057129 | https://github.com/justinchiu/NeuralDialog/tree/f272cc2e12ffdd44c94263ee373208a22c057129 |
ConvDenoiser | import torch
import torch.nn.init
import torch.nn as nn
import torch.nn.functional as F
class ConvDenoiser(nn.Module):
def __init__(self):
super(ConvDenoiser, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 3, padding=1)
self.conv2 = nn.Conv2d(32, 16, 3, padding=1)
self.conv3 = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.init
import t... | joydeba/autocount | ConvDenoiser | false | 3,791 | [
"MIT"
] | 0 | 52ddb47726fa34d5f54e2850dc6690b67c768728 | https://github.com/joydeba/autocount/tree/52ddb47726fa34d5f54e2850dc6690b67c768728 |
SelfAttn | import torch
from torch import nn
from torch.nn import functional as F
class SelfAttn(nn.Module):
"""
self-attention with learnable parameters
"""
def __init__(self, dhid):
super().__init__()
self.scorer = nn.Linear(dhid, 1)
def forward(self, inp):
scores = F.softmax(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jzhanson/alfred | SelfAttn | false | 3,792 | [
"MIT"
] | 0 | d5b540e7c9b53d3f70cc2907503935fecff00018 | https://github.com/jzhanson/alfred/tree/d5b540e7c9b53d3f70cc2907503935fecff00018 |
FourierConv2d | import torch
class FourierConv2d(torch.nn.Module):
def __init__(self, in_channels, out_channels, size_x, size_y, bias=True,
periodic=False):
super(FourierConv2d, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
if not periodic:
s... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty... | julian-parker/DAFX22_FNO | FourierConv2d | false | 3,793 | [
"MIT"
] | 0 | 72f30144317a3f8ba8ea23ecf9a0333c81fc87db | https://github.com/julian-parker/DAFX22_FNO/tree/72f30144317a3f8ba8ea23ecf9a0333c81fc87db |
RMSELoss | import torch
import torch.nn as nn
class RMSELoss(nn.Module):
def __init__(self):
super(RMSELoss, self).__init__()
def forward(self, inputs, targets):
tmp = (inputs - targets) ** 2
loss = torch.mean(tmp)
return torch.sqrt(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 libdevice
import torch.nn as nn
assert... | kamomehz/waveletCodingCNN | RMSELoss | false | 3,794 | [
"MIT"
] | 0 | 50c7db9d986039ded38999b7e4f4265e2250fb90 | https://github.com/kamomehz/waveletCodingCNN/tree/50c7db9d986039ded38999b7e4f4265e2250fb90 |
Net_L2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net_L2(nn.Module):
def __init__(self, inputSize, kernel=64):
super(Net_L2, self).__init__()
self.inputSize = inputSize
self.kernel = kernel
self.fc1 = nn.Linear(self.inputSize, 256)
self.fc2 = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | kamomehz/waveletCodingCNN | Net_L2 | false | 3,795 | [
"MIT"
] | 0 | 50c7db9d986039ded38999b7e4f4265e2250fb90 | https://github.com/kamomehz/waveletCodingCNN/tree/50c7db9d986039ded38999b7e4f4265e2250fb90 |
ToContinuous | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class ToContinuous(nn.Module):
def __init__(self):
super(ToContinuous, self).__init__()
def forward(self, x):
"""
:param x: tensor with dimension opt(batch x _ x bins x H x W
: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
import torch.nn.parallel
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | kampta/multiview-shapes | ToContinuous | false | 3,796 | [
"MIT"
] | 0 | a79eb4b492be8c2c279e2c69b13d5a19dff1621b | https://github.com/kampta/multiview-shapes/tree/a79eb4b492be8c2c279e2c69b13d5a19dff1621b |
DGMNConv3DLayer | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.init as init
class DGMNConv3DLayer(nn.Module):
def __init__(self, args):
self.args = args
super(DGMNConv3DLayer, self).__init__()
self.conv1 = nn.Conv3d(in_channels=1, out_channels=32, kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Coldog2333/DGMN-pytorch | DGMNConv3DLayer | false | 3,797 | [
"Apache-2.0"
] | 0 | c34248afca516625c2ac2fc6d6f4ce8fe2988c99 | https://github.com/Coldog2333/DGMN-pytorch/tree/c34248afca516625c2ac2fc6d6f4ce8fe2988c99 |
teacherNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class teacherNet(nn.Module):
def __init__(self):
super(teacherNet, self).__init__()
self.fc1 = nn.Linear(28 * 28, 1200)
self.fc2 = nn.Linear(1200, 1200)
self.fc3 = nn.Linear(1200, 10)
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_... | kamiyakenta/knowledge-distillation-pytorch | teacherNet | false | 3,798 | [
"MIT"
] | 0 | 749c6bb353961147718371b2b694046af0a6e3f1 | https://github.com/kamiyakenta/knowledge-distillation-pytorch/tree/749c6bb353961147718371b2b694046af0a6e3f1 |
ToRGB | from torch.autograd import Function
import math
import torch
import torch.nn as nn
from torch.nn import functional as F
import torch.nn.parallel
import torch.utils.data
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.nn as nn
from torch... | kampta/multiview-shapes | ToRGB | false | 3,799 | [
"MIT"
] | 0 | a79eb4b492be8c2c279e2c69b13d5a19dff1621b | https://github.com/kampta/multiview-shapes/tree/a79eb4b492be8c2c279e2c69b13d5a19dff1621b |
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, input_size, output_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.... | kangjie-chen/deep-reinforcement-learning | Actor | false | 3,801 | [
"MIT"
] | 0 | 0706f136834ecafc7391f483a6b3c84365a349eb | https://github.com/kangjie-chen/deep-reinforcement-learning/tree/0706f136834ecafc7391f483a6b3c84365a349eb |
Feature_extraction | import torch
from torchvision import transforms as transforms
import torch.nn as nn
class Feature_extraction(nn.Module):
def __init__(self, k, p):
super(Feature_extraction, self).__init__()
self.conv_1 = nn.Conv2d(3, 64, kernel_size=5, padding=2)
self.conv_2 = nn.Conv2d(64, 64, kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torchvision import trans... | justinluyao/phd_thesis | Feature_extraction | false | 3,803 | [
"MIT"
] | 0 | 0a61f5deaac86dd34839ce24c2ad89e1411a8540 | https://github.com/justinluyao/phd_thesis/tree/0a61f5deaac86dd34839ce24c2ad89e1411a8540 |
CmapPafHeadAttention | import torch
import torch.utils.data
import torch.nn
import torch.optim
class UpsampleCBR(torch.nn.Sequential):
def __init__(self, input_channels, output_channels, count=1, num_flat=0):
layers = []
for i in range(count):
if i == 0:
inch = input_channels
els... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | intflow/trt_openpose | CmapPafHeadAttention | false | 3,805 | [
"MIT"
] | 0 | 526b1b0d463f1c86a45ca4d4cd77a41732c7654b | https://github.com/intflow/trt_openpose/tree/526b1b0d463f1c86a45ca4d4cd77a41732c7654b |
KLNormal | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
class KLNormal(nn.Module):
def __init__(self):
super(KLNormal, self).__init__()
def forward(self, qm, qv, pm, pv):
element_wise = 0.5 * (torch.log(pv) - torch.log(qv) + qv / pv + (qm -
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.utils.data
import torch.utils.data.dis... | kayburns/craftassist | KLNormal | false | 3,806 | [
"MIT"
] | 0 | 07909493d320afc2c9ff428d0891bc3acd4dc68f | https://github.com/kayburns/craftassist/tree/07909493d320afc2c9ff428d0891bc3acd4dc68f |
LabelSmoothingBCE | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
class LabelSmoothingBCE(nn.Module):
def __init__(self, smoothing=0.0):
super(LabelSmoothingBCE, self).__init__()
self.criterion = nn.BCEWithLogitsLoss(reduction='none')
self.confidence = 1.0 - s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | kayburns/craftassist | LabelSmoothingBCE | false | 3,810 | [
"MIT"
] | 0 | 07909493d320afc2c9ff428d0891bc3acd4dc68f | https://github.com/kayburns/craftassist/tree/07909493d320afc2c9ff428d0891bc3acd4dc68f |
HighwayLayer | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
def my_xavier_init(m, gain=1):
for p in m.parameters():
if p.dim() > 1:
nn.init.xavier_uniform_(p, gain)
else:
nn.init.constant_(p, 0)
class HighwayLayer(torch.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 torch.nn as ... | kayburns/craftassist | HighwayLayer | false | 3,811 | [
"MIT"
] | 0 | 07909493d320afc2c9ff428d0891bc3acd4dc68f | https://github.com/kayburns/craftassist/tree/07909493d320afc2c9ff428d0891bc3acd4dc68f |
HighwayNetwork | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
class HighwayNetwork(nn.Module):
def __init__(self, in_dim, out_dim):
super(HighwayNetwork, self).__init__()
self.gate_proj = nn.Linear(in_dim, out_dim)
self.lin_proj = nn.Linear(in_dim, out_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
import torch.nn as nn
import ... | kayburns/craftassist | HighwayNetwork | false | 3,813 | [
"MIT"
] | 0 | 07909493d320afc2c9ff428d0891bc3acd4dc68f | https://github.com/kayburns/craftassist/tree/07909493d320afc2c9ff428d0891bc3acd4dc68f |
SoftmaxRegression | import torch
import torch.nn.functional as F
class SoftmaxRegression(torch.nn.Module):
def __init__(self, num_features, num_classes):
super(SoftmaxRegression, self).__init__()
self.linear = torch.nn.Linear(num_features, num_classes)
def forward(self, x):
logits = self.linear(x)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | kbrezinski/stat-453-deep-learning | SoftmaxRegression | false | 3,817 | [
"BSD-3-Clause"
] | 0 | b10240b5c3a970231dcea9221d3d179d26fc197d | https://github.com/kbrezinski/stat-453-deep-learning/tree/b10240b5c3a970231dcea9221d3d179d26fc197d |
CustomizedNet | import torch
import torch.nn as nn
import torch.utils.data.distributed
class CustomizedNet(nn.Module):
def __init__(self, dropout, input_size, input_feature_num, hidden_dim,
output_size):
"""
Simply use linear layers for multi-variate single-step forecasting.
"""
super()._... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | jason-dai/BigDL | CustomizedNet | false | 3,818 | [
"Apache-2.0"
] | 0 | 81ee60a73707d91c58d9bcd5b17c8e5731741a85 | https://github.com/jason-dai/BigDL/tree/81ee60a73707d91c58d9bcd5b17c8e5731741a85 |
DQN | import torch
import torch.nn as nn
class DQN(nn.Module):
def __init__(self, obs_size: 'int', num_actions: 'int', hidden_size:
'int'=20):
super(DQN, self).__init__()
self.l1 = nn.Linear(obs_size, hidden_size)
self.n1 = nn.LayerNorm(hidden_size, elementwise_affine=True)
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | kcorder/vcg_dqn | DQN | false | 3,819 | [
"MIT"
] | 0 | da43892f701fe88a4c751f209da2743fd824d2f5 | https://github.com/kcorder/vcg_dqn/tree/da43892f701fe88a4c751f209da2743fd824d2f5 |
ActorNN | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def init_hidden(layer):
"""
Initialize NN layers
"""
input_size = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(input_size)
return -lim, lim
class ActorNN(nn.Module):
"""
Actor Class
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | kaustav1987/Tennis-Collaboration-and-Competition-Continuous-Control | ActorNN | false | 3,821 | [
"MIT"
] | 0 | d724e09d7a5948e2023fb86bf977455f3c507054 | https://github.com/kaustav1987/Tennis-Collaboration-and-Competition-Continuous-Control/tree/d724e09d7a5948e2023fb86bf977455f3c507054 |
FeaturewiseAffine | import torch
from typing import Union
import torch.nn as nn
class FeaturewiseAffine(nn.Module):
"""Feature-wise affine layer."""
def __init__(self):
super().__init__()
def forward(self, x, scale: 'Union[float, torch.Tensor]', shift:
'Union[float, torch.Tensor]'):
res = scale * x ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ketan0/ddim | FeaturewiseAffine | false | 3,822 | [
"MIT"
] | 0 | 26f2de1107885a3f332dd8435b73a1eaedbe10a8 | https://github.com/ketan0/ddim/tree/26f2de1107885a3f332dd8435b73a1eaedbe10a8 |
BiAttention | import torch
from typing import Optional
import torch.nn as nn
from torch.nn.parameter import Parameter
class BiAttention(nn.Module):
def __init__(self, input_size_encoder: 'int', input_size_decoder: 'int',
num_labels: 'int', biaffine: 'bool'=True, **kwargs) ->None:
super(BiAttention, 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
import torch.nn as nn
from torch.nn.parameter import Parameter
assert_size_strid... | katie0809/KLUE-baseline | BiAttention | false | 3,823 | [
"Apache-2.0"
] | 0 | 144973359e9dc3bbbb3ce7a0cc765b0207f63775 | https://github.com/katie0809/KLUE-baseline/tree/144973359e9dc3bbbb3ce7a0cc765b0207f63775 |
Mish | import torch
from torch import nn
from torch.nn import functional as F
class Mish(nn.Module):
def forward(self, x):
return x.mul_(F.softplus(x).tanh())
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, math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.gua... | khayliang/single_person_tracking | Mish | false | 3,824 | [
"MIT"
] | 0 | d93aae3742ba3c77f00b3917b182784f03b5d597 | https://github.com/khayliang/single_person_tracking/tree/d93aae3742ba3c77f00b3917b182784f03b5d597 |
TripletLoss | import torch
import torch.utils.data
import torch
import torch.nn as nn
class TripletLoss(nn.Module):
def __init__(self, margin=1.0):
super(TripletLoss, self).__init__()
self.margin = margin
def calc_euclidean(self, x1, x2):
return (x1 - x2).pow(2).sum(1)
def forward(self, ancho... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C.... | ketan-lambat/contrastive-unpaired-translation | TripletLoss | false | 3,825 | [
"BSD-3-Clause"
] | 0 | ea71b3a9603a51b97f1fa8426d5a1beae9260a0d | https://github.com/ketan-lambat/contrastive-unpaired-translation/tree/ea71b3a9603a51b97f1fa8426d5a1beae9260a0d |
CriticNN | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def init_hidden(layer):
"""
Initialize NN layers
"""
input_size = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(input_size)
return -lim, lim
class CriticNN(nn.Module):
"""
Critic class
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | kaustav1987/Tennis-Collaboration-and-Competition-Continuous-Control | CriticNN | false | 3,826 | [
"MIT"
] | 0 | d724e09d7a5948e2023fb86bf977455f3c507054 | https://github.com/kaustav1987/Tennis-Collaboration-and-Competition-Continuous-Control/tree/d724e09d7a5948e2023fb86bf977455f3c507054 |
AmdimNCELoss | import torch
import torch.nn as nn
def tanh_clip(x, clip_val=10.0):
"""
soft clip values to the range [-clip_val, +clip_val]
"""
if clip_val is not None:
x_clip = clip_val * torch.tanh(1.0 / clip_val * x)
else:
x_clip = x
return x_clip
class AmdimNCELoss(nn.Module):
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jfrancis71/pytorch-lightning-bolts | AmdimNCELoss | false | 3,827 | [
"Apache-2.0"
] | 0 | 8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6 | https://github.com/jfrancis71/pytorch-lightning-bolts/tree/8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6 |
Swish | import torch
from torch import nn
class Swish(nn.Module):
def forward(self, x):
return x.mul_(torch.sigmoid(x))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_mul_sigmoid_0(in_ptr... | khayliang/single_person_tracking | Swish | false | 3,828 | [
"MIT"
] | 0 | d93aae3742ba3c77f00b3917b182784f03b5d597 | https://github.com/khayliang/single_person_tracking/tree/d93aae3742ba3c77f00b3917b182784f03b5d597 |
FakeRKHSConvNet | import math
import torch
import numpy as np
import torch.nn as nn
class MaybeBatchNorm2d(nn.Module):
def __init__(self, n_ftr, affine, use_bn):
super(MaybeBatchNorm2d, self).__init__()
self.bn = nn.BatchNorm2d(n_ftr, affine=affine)
self.use_bn = use_bn
def forward(self, x):
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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jfrancis71/pytorch-lightning-bolts | FakeRKHSConvNet | false | 3,829 | [
"Apache-2.0"
] | 0 | 8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6 | https://github.com/jfrancis71/pytorch-lightning-bolts/tree/8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6 |
SchedulerTestNet | import torch
from torch.nn import functional as F
class SchedulerTestNet(torch.nn.Module):
"""
adapted from: https://github.com/pytorch/pytorch/blob/master/test/test_optim.py
"""
def __init__(self):
super(SchedulerTestNet, self).__init__()
self.conv1 = torch.nn.Conv2d(1, 1, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | jfrancis71/pytorch-lightning-bolts | SchedulerTestNet | false | 3,830 | [
"Apache-2.0"
] | 0 | 8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6 | https://github.com/jfrancis71/pytorch-lightning-bolts/tree/8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.