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 |
|---|---|---|---|---|---|---|---|---|---|---|
Mix | import torch
import torch.nn as nn
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hidden_features = hidden_features or in_features
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.triton_helpers import libdevice
import torch.nn as ... | gaopengcuhk/deit | Mix | false | 3,516 | [
"Apache-2.0"
] | 0 | de7db8f3a12c35e5e554b385030c574b7c78aaa6 | https://github.com/gaopengcuhk/deit/tree/de7db8f3a12c35e5e554b385030c574b7c78aaa6 |
CQAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
def mask_logits(target, mask):
mask = mask.type(torch.float32)
return target * mask + (1 - mask) * -1e+30
class CQAttention(nn.Module):
def __init__(self, d_model, dropout=0.1):
super().__init__()
w4C = torch.empty(d_mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dcy2018/QANA | CQAttention | false | 3,517 | [
"MIT"
] | 0 | 69d1e4ff408a56317479e22ecc854c91fc0f420f | https://github.com/dcy2018/QANA/tree/69d1e4ff408a56317479e22ecc854c91fc0f420f |
CMlp | import torch
import torch.nn as nn
class CMlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hidden_features = hidden_features or in_features
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | gaopengcuhk/deit | CMlp | false | 3,518 | [
"Apache-2.0"
] | 0 | de7db8f3a12c35e5e554b385030c574b7c78aaa6 | https://github.com/gaopengcuhk/deit/tree/de7db8f3a12c35e5e554b385030c574b7c78aaa6 |
GCN | from torch.nn import Module
import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class GraphConvolution(Module):
"""
A Graph Convolution Layer (GCN)
"""
def __init__(self, in_features, out_features, bias=True):
super(GraphConvolution, self).__init__()
self.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.nn import Module
i... | duzhizhai/HGNN | GCN | false | 3,519 | [
"MIT"
] | 0 | 1d219f9eb773e0d2f585295d6fc13c2eb093d908 | https://github.com/duzhizhai/HGNN/tree/1d219f9eb773e0d2f585295d6fc13c2eb093d908 |
Attention | import torch
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, model_dim, n_heads=1):
super(Attention, self).__init__()
self.model_dim = model_dim
self.dim_per_head = model_dim // n_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.... | footoredo/pymarl | Attention | false | 3,520 | [
"Apache-2.0"
] | 0 | 9c62dda7a7ed984e020f2cafab93601342305af2 | https://github.com/footoredo/pymarl/tree/9c62dda7a7ed984e020f2cafab93601342305af2 |
MaskedMSELoss | import torch
import torch.nn as nn
class MaskedMSELoss(nn.Module):
def __init__(self):
super(MaskedMSELoss, self).__init__()
self.loss = nn.MSELoss(reduction='sum')
def forward(self, pred, target, mask):
"""
pred -> batch*seq_len
target -> batch*seq_len
mask -... | 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... | filkar/CASTLE | MaskedMSELoss | false | 3,521 | [
"MIT"
] | 0 | 128b316d24503875bcc298301c17b003e6d4599d | https://github.com/filkar/CASTLE/tree/128b316d24503875bcc298301c17b003e6d4599d |
Net16 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net16(nn.Module):
def __init__(self, input_dim, output_dim):
super(Net16, self).__init__()
self.linear1 = nn.Linear(input_dim, 16)
self.linear2 = nn.Linear(16, output_dim)
def forward(self, x):
x = F.rel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | gautam-sharma1/Imitation-Learning | Net16 | false | 3,522 | [
"MIT"
] | 0 | 20b6fcd2a8d6de8eb95e6831f5b379a083306361 | https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361 |
LearnablePositionalEncoding | import torch
import torch.nn as nn
class LearnablePositionalEncoding(nn.Module):
def __init__(self, d_model, dropout=0.1, max_len=1024):
super(LearnablePositionalEncoding, self).__init__()
self.dropout = nn.Dropout(p=dropout)
self.pe = nn.Parameter(torch.empty(max_len, 1, d_model))
... | 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... | gaowanting/paper_code0 | LearnablePositionalEncoding | false | 3,523 | [
"MIT"
] | 0 | 15568fc9989b26df7c582b92163d2f262654712e | https://github.com/gaowanting/paper_code0/tree/15568fc9989b26df7c582b92163d2f262654712e |
SBlock | import torch
import torch.nn as nn
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hidden_features = hidden_features or in_features
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.... | gaopengcuhk/deit | SBlock | false | 3,524 | [
"Apache-2.0"
] | 0 | de7db8f3a12c35e5e554b385030c574b7c78aaa6 | https://github.com/gaopengcuhk/deit/tree/de7db8f3a12c35e5e554b385030c574b7c78aaa6 |
PNet | import torch
import torch.nn as nn
from collections import OrderedDict
class PNet(nn.Module):
def __init__(self):
super().__init__()
self.features = nn.Sequential(OrderedDict([('conv1', nn.Conv2d(3,
10, 3, 1)), ('prelu1', nn.PReLU(10)), ('pool1', nn.MaxPool2d(2,
2, ceil_m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | galbiati/mtcnn | PNet | false | 3,525 | [
"MIT"
] | 0 | 6caa8e47ee6c7a01f6f990193129964a2d7e4b52 | https://github.com/galbiati/mtcnn/tree/6caa8e47ee6c7a01f6f990193129964a2d7e4b52 |
FocusLayer | import torch
import torch.nn as nn
class FocusLayer(nn.Module):
def __init__(self, c1, c2, k=1):
super().__init__()
def forward(self, x):
return torch.cat([x[..., ::2], x[..., 1::2]], dim=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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | gdevos010/Informer2020 | FocusLayer | false | 3,526 | [
"Apache-2.0"
] | 0 | 607a1981ff8b8009eda3570a1ea4c9617289c9f2 | https://github.com/gdevos010/Informer2020/tree/607a1981ff8b8009eda3570a1ea4c9617289c9f2 |
NNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class NNet(nn.Module):
def __init__(self, input_dim, output_dim):
super(NNet, self).__init__()
self.linear1 = nn.Linear(input_dim, 64)
self.linear2 = nn.Linear(64, 256)
self.linear3 = nn.Linear(256, output_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
assert_... | gautam-sharma1/Imitation-Learning | NNet | false | 3,527 | [
"MIT"
] | 0 | 20b6fcd2a8d6de8eb95e6831f5b379a083306361 | https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361 |
Temp | import torch
import torch.nn as nn
import torch.nn.functional as F
class Temp(nn.Module):
def __init__(self, input_dim, output_dim):
super(Temp, self).__init__()
self.linear1 = nn.Linear(input_dim, 256)
self.linear2 = nn.Linear(256, 256)
self.linear3 = nn.Linear(256, 256)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | gautam-sharma1/Imitation-Learning | Temp | false | 3,528 | [
"MIT"
] | 0 | 20b6fcd2a8d6de8eb95e6831f5b379a083306361 | https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361 |
Netleaky | import torch
import torch.nn as nn
import torch.nn.functional as F
class Netleaky(nn.Module):
def __init__(self, input_dim, output_dim):
super(Netleaky, self).__init__()
self.linear1 = nn.Linear(input_dim, 32)
self.linear2 = nn.Linear(32, 32)
self.linear3 = nn.Linear(32, 64)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | gautam-sharma1/Imitation-Learning | Netleaky | false | 3,529 | [
"MIT"
] | 0 | 20b6fcd2a8d6de8eb95e6831f5b379a083306361 | https://github.com/gautam-sharma1/Imitation-Learning/tree/20b6fcd2a8d6de8eb95e6831f5b379a083306361 |
HardSigmoid | import torch
from torch import nn
import torch.nn.functional as F
class HardSigmoid(nn.Module):
def __init__(self, slope=0.2, offset=0.5):
super().__init__()
self.slope = slope
self.offset = offset
def forward(self, x):
x = self.slope * x + self.offset
x = F.threshold... | 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... | gentlebreeze1/dbnet | HardSigmoid | false | 3,530 | [
"Apache-2.0"
] | 0 | be28a7ae835af7d6f8b7c2b636b875adc9fc187c | https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c |
ActorNet | from torch.nn import Module
import torch
from torch.nn import Linear
import torch.nn.functional as F
class ActorNet(Module):
def __init__(self, hidden_size, num_programs):
super(ActorNet, self).__init__()
self.l1 = Linear(hidden_size, hidden_size // 2)
self.l2 = Linear(hidden_size // 2, n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | geektoni/AlphaNPI | ActorNet | false | 3,531 | [
"MIT"
] | 0 | ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 | https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 |
ListEnvEncoder | import torch
import torch.nn.functional as F
import torch.nn as nn
class ListEnvEncoder(nn.Module):
"""
Implement an encoder (f_enc) specific to the List environment. It encodes observations e_t into
vectors s_t of size D = encoding_dim.
"""
def __init__(self, observation_dim, encoding_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.... | geektoni/AlphaNPI | ListEnvEncoder | false | 3,532 | [
"MIT"
] | 0 | ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 | https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 |
MaskL1Loss | import torch
from torch import nn
class MaskL1Loss(nn.Module):
def __init__(self, eps=1e-06):
super(MaskL1Loss, self).__init__()
self.eps = eps
def forward(self, pred: 'torch.Tensor', gt, mask):
loss = (torch.abs(pred - gt) * mask).sum() / (mask.sum() + self.eps)
return loss
... | 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
from torch import nn
a... | gentlebreeze1/dbnet | MaskL1Loss | false | 3,533 | [
"Apache-2.0"
] | 0 | be28a7ae835af7d6f8b7c2b636b875adc9fc187c | https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c |
CriticNet | from torch.nn import Module
import torch
from torch.nn import Linear
import torch.nn.functional as F
class CriticNet(Module):
def __init__(self, hidden_size):
super(CriticNet, self).__init__()
self.l1 = Linear(hidden_size, hidden_size // 2)
self.l2 = Linear(hidden_size // 2, 1)
def f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | geektoni/AlphaNPI | CriticNet | false | 3,534 | [
"MIT"
] | 0 | ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 | https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 |
HanoiEnvEncoder | import torch
import torch.nn.functional as F
import torch.nn as nn
class HanoiEnvEncoder(nn.Module):
"""
Implement an encoder (f_enc) specific to the List environment. It encodes observations e_t into
vectors s_t of size D = encoding_dim.
"""
def __init__(self, observation_dim, encoding_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
assert_... | geektoni/AlphaNPI | HanoiEnvEncoder | false | 3,535 | [
"MIT"
] | 0 | ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 | https://github.com/geektoni/AlphaNPI/tree/ab48cb9cfb74f3960e264da4f3eb2d6917bfb9c9 |
MultiHeadAttention | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
def __init__(self, num_q_channels: 'int', num_kv_channels: 'int',
num_heads: 'int', dropout: 'float'):
super().__init__()
self.attention = nn.MultiheadAttention(embed_dim=num_q_channels,
num_heads=num_head... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | felixyu7/perceiver-io-1 | MultiHeadAttention | false | 3,536 | [
"Apache-2.0"
] | 0 | 895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e | https://github.com/felixyu7/perceiver-io-1/tree/895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
"""
Loss function from https://arxiv.org/abs/1707.03237,
where iou computation is introduced heatmap manner to measure the
diversity bwtween tow heatmaps.
"""
def __init__(self, eps=1e-06):
super(DiceLoss, self).__init__()
... | 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... | gentlebreeze1/dbnet | DiceLoss | false | 3,537 | [
"Apache-2.0"
] | 0 | be28a7ae835af7d6f8b7c2b636b875adc9fc187c | https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c |
SEBlock | import torch
from torch import nn
import torch.nn.functional as F
class HardSigmoid(nn.Module):
def __init__(self, slope=0.2, offset=0.5):
super().__init__()
self.slope = slope
self.offset = offset
def forward(self, x):
x = self.slope * x + self.offset
x = F.threshold... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | gentlebreeze1/dbnet | SEBlock | false | 3,538 | [
"Apache-2.0"
] | 0 | be28a7ae835af7d6f8b7c2b636b875adc9fc187c | https://github.com/gentlebreeze1/dbnet/tree/be28a7ae835af7d6f8b7c2b636b875adc9fc187c |
L1Linear | import math
import torch
import warnings
from torch import Tensor
from torch.nn.parameter import Parameter
from torch.nn import functional as F
from torch.nn import init
class L1Linear(torch.nn.Module):
def __init__(self, l1: 'float', in_features: 'int', out_features: 'int',
bias: 'bool'=True, init_zero=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 warnings
from torch.nn.parameter import Parameter
from torch.... | fabian-sp/regular-layers | L1Linear | false | 3,539 | [
"BSD-3-Clause"
] | 0 | 573b652d1e66c4e44cc740dcc8dc618669af5c96 | https://github.com/fabian-sp/regular-layers/tree/573b652d1e66c4e44cc740dcc8dc618669af5c96 |
SelfAttention | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
def __init__(self, num_q_channels: 'int', num_kv_channels: 'int',
num_heads: 'int', dropout: 'float'):
super().__init__()
self.attention = nn.MultiheadAttention(embed_dim=num_q_channels,
num_heads=num_head... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | felixyu7/perceiver-io-1 | SelfAttention | false | 3,540 | [
"Apache-2.0"
] | 0 | 895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e | https://github.com/felixyu7/perceiver-io-1/tree/895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e |
CrossAttention | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
def __init__(self, num_q_channels: 'int', num_kv_channels: 'int',
num_heads: 'int', dropout: 'float'):
super().__init__()
self.attention = nn.MultiheadAttention(embed_dim=num_q_channels,
num_heads=num_head... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | felixyu7/perceiver-io-1 | CrossAttention | false | 3,541 | [
"Apache-2.0"
] | 0 | 895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e | https://github.com/felixyu7/perceiver-io-1/tree/895f09e75e5a4b5e90dfef5d3a86ea26c2f48f4e |
ReflectionPad3d | import torch
import torch.utils.data
import torch
import torch.nn as nn
class ReflectionPad3d(nn.Module):
def __init__(self, padding):
super(ReflectionPad3d, self).__init__()
self.padding = padding
if isinstance(padding, int):
self.padding = (padding,) * 6
def forward(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cud... | giuliabaldini/Pix2PixNIfTI | ReflectionPad3d | false | 3,542 | [
"BSD-3-Clause"
] | 0 | 59ff825760f682d2734bd5e95503a03f80d32414 | https://github.com/giuliabaldini/Pix2PixNIfTI/tree/59ff825760f682d2734bd5e95503a03f80d32414 |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils
class CNN(nn.Module):
"""
Convolutional layer of a character-based convolutional encoder that outputs word embeddings.
"""
def __init__(self, char_embed_size: 'int', word_embed_size: 'int',
kernel_size: '... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | giwankim/cs224n | CNN | false | 3,543 | [
"MIT"
] | 0 | d05d018dd3026aa48810260be50c94cda596dc82 | https://github.com/giwankim/cs224n/tree/d05d018dd3026aa48810260be50c94cda596dc82 |
LinearAdditiveUpsample | import torch
import torch.utils.data
import torch
import torch.nn as nn
class LinearAdditiveUpsample(nn.Module):
"""Bi/Trilinear Additive Upsample
Upsampling strategy described in Wojna et al (https://doi.org/10.1007/s11263-019-01170-8) to avoid checkerboard
patterns while keeping a better performance fo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = torch._C.... | giuliabaldini/Pix2PixNIfTI | LinearAdditiveUpsample | false | 3,544 | [
"BSD-3-Clause"
] | 0 | 59ff825760f682d2734bd5e95503a03f80d32414 | https://github.com/giuliabaldini/Pix2PixNIfTI/tree/59ff825760f682d2734bd5e95503a03f80d32414 |
Entmax15 | from torch.autograd import Function
import torch
from torch import nn
def _make_ix_like(X, dim):
d = X.size(dim)
rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype)
view = [1] * X.dim()
view[0] = -1
return rho.view(view).transpose(0, dim)
def _roll_last(X, dim):
if dim == -1:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd import F... | gitlost-murali/awesome-align | Entmax15 | false | 3,545 | [
"BSD-3-Clause"
] | 0 | 39fb45ca85a98e005447bddb52c48e65ce7d399b | https://github.com/gitlost-murali/awesome-align/tree/39fb45ca85a98e005447bddb52c48e65ce7d399b |
DoubleSwish | import torch
from torch import Tensor
class DoubleSwishFunction(torch.autograd.Function):
"""
double_swish(x) = x * torch.sigmoid(x-1)
This is a definition, originally motivated by its close numerical
similarity to swish(swish(x)), where swish(x) = x * sigmoid(x).
Memory-efficient derivative c... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import Tensor
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty... | glynpu/icefall | DoubleSwish | false | 3,546 | [
"Apache-2.0"
] | 0 | d766dc5aeea1a8aefab033e581948b07c4ac4bc0 | https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0 |
UpConv | import torch
import torch.nn as nn
import torchvision.transforms.functional as TF
class UpConv(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.tconv = nn.ConvTranspose2d(in_channels=in_channels,
out_channels=out_channels, kernel_size=2, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | gandhisamay/Drone-Cam-Segmentation | UpConv | false | 3,547 | [
"MIT"
] | 0 | 7e93b6bb65300aea94dd5e35bb8ca3bd1efbe043 | https://github.com/gandhisamay/Drone-Cam-Segmentation/tree/7e93b6bb65300aea94dd5e35bb8ca3bd1efbe043 |
BertPSIHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class BertPSIHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
self.decoder = nn.Linear(conf... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | gitlost-murali/awesome-align | BertPSIHead | false | 3,548 | [
"BSD-3-Clause"
] | 0 | 39fb45ca85a98e005447bddb52c48e65ce7d399b | https://github.com/gitlost-murali/awesome-align/tree/39fb45ca85a98e005447bddb52c48e65ce7d399b |
MultConst | import torch
import torch.nn as nn
class MultConst(nn.Module):
def forward(self, input):
return 255 * input
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | globz-eu/PyTorch-Multi-Style-Transfer | MultConst | false | 3,549 | [
"MIT"
] | 0 | d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2 | https://github.com/globz-eu/PyTorch-Multi-Style-Transfer/tree/d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2 |
Vgg16 | import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import *
class Vgg16(nn.Module):
def __init__(self):
super(Vgg16, self).__init__()
self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1)
self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | entc17-fyp-27/GCL | Vgg16 | false | 3,550 | [
"MIT"
] | 0 | df3964b1ea07a5b825e35720377153f3c143f79b | https://github.com/entc17-fyp-27/GCL/tree/df3964b1ea07a5b825e35720377153f3c143f79b |
GramMatrix | import torch
import torch.nn as nn
class GramMatrix(nn.Module):
def forward(self, y):
b, ch, h, w = y.size()
features = y.view(b, ch, w * h)
features_t = features.transpose(1, 2)
gram = features.bmm(features_t) / (ch * h * w)
return gram
def get_inputs():
return [tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | globz-eu/PyTorch-Multi-Style-Transfer | GramMatrix | false | 3,551 | [
"MIT"
] | 0 | d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2 | https://github.com/globz-eu/PyTorch-Multi-Style-Transfer/tree/d00ca44ffee6a4eb4b517f3f1a6eabf72db2a3d2 |
ScaledConv2d | import torch
from torch import Tensor
from torch import nn
class ScaledConv2d(nn.Conv2d):
def __init__(self, *args, initial_scale: float=1.0, initial_speed:
float=1.0, **kwargs):
super(ScaledConv2d, self).__init__(*args, **kwargs)
initial_scale = torch.tensor(initial_scale).log()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 im... | glynpu/icefall | ScaledConv2d | false | 3,552 | [
"Apache-2.0"
] | 0 | d766dc5aeea1a8aefab033e581948b07c4ac4bc0 | https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0 |
BasicNorm | import torch
from torch import Tensor
from torch import nn
class BasicNorm(torch.nn.Module):
"""
This is intended to be a simpler, and hopefully cheaper, replacement for
LayerNorm. The observation this is based on, is that Transformer-type
networks, especially with pre-norm, sometimes seem to set one... | 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... | glynpu/icefall | BasicNorm | false | 3,553 | [
"Apache-2.0"
] | 0 | d766dc5aeea1a8aefab033e581948b07c4ac4bc0 | https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0 |
Sparsemax | from torch.autograd import Function
import torch
from torch import nn
def _make_ix_like(X, dim):
d = X.size(dim)
rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype)
view = [1] * X.dim()
view[0] = -1
return rho.view(view).transpose(0, dim)
def _roll_last(X, dim):
if dim == -1:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.autograd import Function
from torch import nn
assert_size_stride = torch._C._d... | gitlost-murali/awesome-align | Sparsemax | false | 3,554 | [
"BSD-3-Clause"
] | 0 | 39fb45ca85a98e005447bddb52c48e65ce7d399b | https://github.com/gitlost-murali/awesome-align/tree/39fb45ca85a98e005447bddb52c48e65ce7d399b |
ScaledLinear | import torch
from torch import Tensor
from torch import nn
class ScaledLinear(nn.Linear):
"""
A modified version of nn.Linear where the parameters are scaled before
use, via:
weight = self.weight * self.weight_scale.exp()
bias = self.bias * self.bias_scale.exp()
Args:
Accept... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 im... | glynpu/icefall | ScaledLinear | false | 3,555 | [
"Apache-2.0"
] | 0 | d766dc5aeea1a8aefab033e581948b07c4ac4bc0 | https://github.com/glynpu/icefall/tree/d766dc5aeea1a8aefab033e581948b07c4ac4bc0 |
BPR | import torch
import torch.nn as nn
import torch.nn.functional as F
class BPR(nn.Module):
def __init__(self, user_size, item_size, dim, weight_decay):
super().__init__()
self.W = nn.Parameter(torch.empty(user_size, dim))
self.H = nn.Parameter(torch.empty(item_size, dim))
nn.init.xa... | 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... | georgezzzh/bpr | BPR | false | 3,556 | [
"MIT"
] | 0 | dd2f39d99f7f06ebb305b66363c89c3606a811a1 | https://github.com/georgezzzh/bpr/tree/dd2f39d99f7f06ebb305b66363c89c3606a811a1 |
RegressionModel | import torch
import torch.nn as nn
class RegressionModel(nn.Module):
def __init__(self, num_features_in, num_anchors=5, feature_size=256):
super(RegressionModel, self).__init__()
self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3,
padding=1)
self.act1 = nn.ReL... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | glhr/swig | RegressionModel | false | 3,557 | [
"MIT"
] | 0 | d6465862ae9adaab6594f79ec8eed211b5d7e4d8 | https://github.com/glhr/swig/tree/d6465862ae9adaab6594f79ec8eed211b5d7e4d8 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""
Layer Normalization
(https://arxiv.org/abs/1607.06450)
"""
def __init__(self, normalized_shape, eps=1e-05):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(normalized_shape))
self.bet... | 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_... | hamishivi/claf | LayerNorm | false | 3,558 | [
"MIT"
] | 0 | 8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 | https://github.com/hamishivi/claf/tree/8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 |
Network | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data.distributed
import torch
class Network(nn.Module):
def __init__(self, num_classes):
super(Network, self).__init__()
self.conv1 = nn.Conv2d(1, 32, kernel_size=3)
self.conv2 = nn.Conv2d(32, 64, 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
from torch._inductor.runtime.... | gregmbi/polyaxon | Network | false | 3,559 | [
"Apache-2.0"
] | 0 | 8f24089fa9cb5df28fc7b70aec27d6d23ee81e8d | https://github.com/gregmbi/polyaxon/tree/8f24089fa9cb5df28fc7b70aec27d6d23ee81e8d |
CNN | import torch
import torch.nn as nn
class CNN(nn.Module):
"""CNN class - defines model and forward operations"""
def __init__(self):
super(CNN, self).__init__()
self.relu = nn.ReLU()
self.pooling = nn.MaxPool2d(kernel_size=2)
self.conv1 = nn.Conv2d(in_channels=1, out_channels=8... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | gnzeleven/Hand-Written-Digits-Recognition-Web-App | CNN | false | 3,560 | [
"Apache-2.0"
] | 0 | b2c654f8b897273323a4930e3064b843b45cd5c6 | https://github.com/gnzeleven/Hand-Written-Digits-Recognition-Web-App/tree/b2c654f8b897273323a4930e3064b843b45cd5c6 |
SeqAttnMatch | import torch
import torch.nn as nn
from torch.nn import functional as F
class SeqAttnMatch(nn.Module):
"""
Given sequences X and Y, match sequence Y to each element in X.
* o_i = sum(alpha_j * y_j) for i in X
* alpha_j = softmax(y_j * x_i)
"""
def __init__(self, embed_dim, identity=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.... | hamishivi/claf | SeqAttnMatch | false | 3,561 | [
"MIT"
] | 0 | 8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 | https://github.com/hamishivi/claf/tree/8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 |
OutputGenerator | import torch
import torch.nn as nn
class OutputGenerator(nn.Module):
def __init__(self, model_dim, tgt_vocab_size):
super().__init__()
self.tgt_vocab_size = tgt_vocab_size
self.linear = nn.Linear(model_dim, tgt_vocab_size, bias=False)
self.log_softmax = nn.LogSoftmax(dim=-1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | guyjacoby/original-transformer-pytorch | OutputGenerator | false | 3,562 | [
"MIT"
] | 0 | 19e9ab4af3f0ee1ca81f6436eb18c36382bfbc1d | https://github.com/guyjacoby/original-transformer-pytorch/tree/19e9ab4af3f0ee1ca81f6436eb18c36382bfbc1d |
PositionwiseFeedForward | import torch
import torch.nn as nn
from torch.nn import functional as F
class PointwiseConv(nn.Module):
"""
Pointwise Convolution (1x1 Conv)
Convolution 1 Dimension (Faster version)
(cf. https://github.com/huggingface/pytorch-openai-transformer-lm/blob/ eafc28abdfadfa0732f03a0fc65805c5bfb2ffe7... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 to... | hamishivi/claf | PositionwiseFeedForward | false | 3,563 | [
"MIT"
] | 0 | 8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 | https://github.com/hamishivi/claf/tree/8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 |
UNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class UNet(nn.Module):
def __init__(self):
super().__init__()
self.lrelu = nn.LeakyReLU(0.2)
self.maxpool = nn.MaxPool2d(2)
self.conv1_0 = nn.Conv2d(3, 32, 3, padding=1)
self.conv1_1 = nn.Conv2d(32, 32, 3, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | frankgu968/learning-to-see-in-the-dark-pytorch | UNet | false | 3,564 | [
"MIT"
] | 0 | 6a59fc64d1f152a2410b9128a6a51687a9b179d1 | https://github.com/frankgu968/learning-to-see-in-the-dark-pytorch/tree/6a59fc64d1f152a2410b9128a6a51687a9b179d1 |
decoder3 | import torch
import torch.nn as nn
class decoder3(nn.Module):
def __init__(self):
super(decoder3, self).__init__()
self.reflecPad7 = nn.ReflectionPad2d((1, 1, 1, 1))
self.conv7 = nn.Conv2d(256, 128, 3, 1, 0)
self.relu7 = nn.ReLU(inplace=True)
self.unpool = nn.UpsamplingNea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | guswl8033/ARtists | decoder3 | false | 3,565 | [
"Apache-2.0"
] | 0 | d353195872c1ef1a1aa68659a32fb47779a416fc | https://github.com/guswl8033/ARtists/tree/d353195872c1ef1a1aa68659a32fb47779a416fc |
SelfAttention | import torch
import torch.nn as nn
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 * self.heads == self.emb... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | h851206/NLP | SelfAttention | false | 3,566 | [
"MIT"
] | 0 | f6dd78db78536f203cf9a6748075351df9daeba3 | https://github.com/h851206/NLP/tree/f6dd78db78536f203cf9a6748075351df9daeba3 |
Gate | import torch
import torch.nn as nn
import torch.nn.functional as F
class Gate(nn.Module):
"""Gate Unit
g = sigmoid(Wx)
x = g * x
"""
def __init__(self, input_size):
super(Gate, self).__init__()
self.linear = nn.Linear(input_size, input_size, bias=False)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | hansd410/mnemonic | Gate | false | 3,567 | [
"BSD-3-Clause"
] | 0 | 409508d08da7f5d5940ffb56fd9715e6ef1e68a3 | https://github.com/hansd410/mnemonic/tree/409508d08da7f5d5940ffb56fd9715e6ef1e68a3 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, observations_dim, actions_dim, hidden_dim=500):
super(Net, self).__init__()
self._input_layer = nn.Linear(observations_dim, hidden_dim)
self._hidden1 = nn.Linear(hidden_dim, hidden_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | hany606/PMLDL-Project | Net | false | 3,568 | [
"MIT"
] | 0 | 40ccf97720c8fd28ed2a8d8101a0499ff58c2b38 | https://github.com/hany606/PMLDL-Project/tree/40ccf97720c8fd28ed2a8d8101a0499ff58c2b38 |
CAM_Module | import torch
import torch.nn as nn
class CAM_Module(nn.Module):
""" Channel attention module"""
def __init__(self, in_dim):
super(CAM_Module, self).__init__()
self.chanel_in = in_dim
self.gamma = nn.Parameter(torch.zeros(1))
self.softmax = nn.Softmax(dim=-1)
def forward(s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | hanhanminnan/Trans-on-BME | CAM_Module | false | 3,569 | [
"Apache-2.0"
] | 0 | f4e27c946a30d11a9e9d2bee8f199fd06fe4bef2 | https://github.com/hanhanminnan/Trans-on-BME/tree/f4e27c946a30d11a9e9d2bee8f199fd06fe4bef2 |
encoder3 | import torch
import torch.nn as nn
class encoder3(nn.Module):
def __init__(self):
super(encoder3, self).__init__()
self.conv1 = nn.Conv2d(3, 3, 1, 1, 0)
self.reflecPad1 = nn.ReflectionPad2d((1, 1, 1, 1))
self.conv2 = nn.Conv2d(3, 64, 3, 1, 0)
self.relu2 = nn.ReLU(inplace=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.... | guswl8033/ARtists | encoder3 | false | 3,570 | [
"Apache-2.0"
] | 0 | d353195872c1ef1a1aa68659a32fb47779a416fc | https://github.com/guswl8033/ARtists/tree/d353195872c1ef1a1aa68659a32fb47779a416fc |
Policy | import torch
import numpy as np
import torch.nn as nn
def orthog_layer_init(layer, std=np.sqrt(2), bias_const=0.0):
torch.nn.init.orthogonal_(layer.weight, std)
torch.nn.init.constant_(layer.bias, bias_const)
return layer
class Policy(nn.Module):
def __init__(self, num_inputs, num_outputs):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | gebob19/natural-policy-gradient-reinforcement-learning | Policy | false | 3,571 | [
"MIT"
] | 0 | 23faa28d746521d6291034bc87d750c665934ff7 | https://github.com/gebob19/natural-policy-gradient-reinforcement-learning/tree/23faa28d746521d6291034bc87d750c665934ff7 |
ActorNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class ActorNetwork(nn.Module):
def __init__(self, obs_dim, hidden_size=256):
super(ActorNetwork, self).__init__()
self._obs_dim = obs_dim
self._l1 = nn.Linear(obs_dim, hidden_size)
self._l2 = 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 import triton_helpers
import torch.nn as nn
assert_... | harwiltz/sac | ActorNetwork | false | 3,572 | [
"MIT"
] | 0 | 076e01e63d8933665fbf4038513f163bbfd62800 | https://github.com/harwiltz/sac/tree/076e01e63d8933665fbf4038513f163bbfd62800 |
LogisticRegressionModel | import torch
import torch.nn as nn
class LogisticRegressionModel(nn.Module):
def __init__(self, input_dim, output_dim):
super(LogisticRegressionModel, self).__init__()
self.linear1 = nn.Linear(input_dim, 1500)
self.linear2 = nn.Linear(1500, 1000)
self.linear3 = nn.Linear(1000, 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
assert_... | harimaruthachalam/PyTorchNNs | LogisticRegressionModel | false | 3,573 | [
"MIT"
] | 0 | 94fe173204e18fbe5087643e3da1cd9cdd6bd2ef | https://github.com/harimaruthachalam/PyTorchNNs/tree/94fe173204e18fbe5087643e3da1cd9cdd6bd2ef |
ResidualBlock | import torch
from torch import nn
class ConvRelu(nn.Module):
def __init__(self, in_: 'int', out: 'int', activate=True):
super(ConvRelu, self).__init__()
self.activate = activate
self.conv = nn.Conv2d(in_, out, 3, padding=1)
self.activation = nn.ReLU(inplace=True)
def forward(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | haonguyen1107/style_transfer | ResidualBlock | false | 3,574 | [
"MIT"
] | 0 | 8df9b20ce8ebc446cf2c0a67393001b3cf318fed | https://github.com/haonguyen1107/style_transfer/tree/8df9b20ce8ebc446cf2c0a67393001b3cf318fed |
SQNet | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Fire(nn.Module):
def __init__(self, inplanes, squeeze_planes, expand_planes):
super(Fire, self).__init__()
self.conv1 = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1,
stride=1)
self.relu1 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dcrmg/Efficient-Segmentation-Networks | SQNet | false | 3,575 | [
"MIT"
] | 0 | e2f2d90d69e4e9af464678b0f02bc754c28f643d | https://github.com/dcrmg/Efficient-Segmentation-Networks/tree/e2f2d90d69e4e9af464678b0f02bc754c28f643d |
LinearFeedforward | import torch
import torch.nn as nn
import torch.utils.data
class Linear(nn.Linear):
def forward(self, x):
size = x.size()
return super().forward(x.contiguous().view(-1, size[-1])).view(*
size[:-1], -1)
class Feedforward(nn.Module):
def __init__(self, d_in, d_out, activation=Non... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | harmdevries89/genienlp | LinearFeedforward | false | 3,576 | [
"BSD-3-Clause"
] | 0 | adf163c63a43adaddecb4b3645635f6ba92772f2 | https://github.com/harmdevries89/genienlp/tree/adf163c63a43adaddecb4b3645635f6ba92772f2 |
SFU | import torch
import torch.nn as nn
import torch.nn.functional as F
class SFU(nn.Module):
"""Semantic Fusion Unit
The ouput vector is expected to not only retrieve correlative information from fusion vectors,
but also retain partly unchange as the input vector
"""
def __init__(self, input_size, fusion_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 ... | hansd410/mnemonic | SFU | false | 3,577 | [
"BSD-3-Clause"
] | 0 | 409508d08da7f5d5940ffb56fd9715e6ef1e68a3 | https://github.com/hansd410/mnemonic/tree/409508d08da7f5d5940ffb56fd9715e6ef1e68a3 |
CoAttention | import torch
import torch.nn as nn
from torch.nn import functional as F
class CoAttention(nn.Module):
"""
CoAttention encoder
in Dynamic Coattention Networks For Question Answering (https://arxiv.org/abs/1611.01604)
check the Figure 2 in paper
* Args:
embed_dim: the number of input e... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | hamishivi/claf | CoAttention | false | 3,578 | [
"MIT"
] | 0 | 8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 | https://github.com/hamishivi/claf/tree/8e35f30e3fc4a45a45cc0766eb6ab55a6ba3f0c2 |
SoftArgMax | import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftArgMax(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, labels, kernel_size=0):
"""
Args
x: [B, C, Nd]
labels: [Nd]
Returns
[B, C]
"... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | hcyz33/PlaneSweepPose | SoftArgMax | false | 3,579 | [
"MIT"
] | 0 | 4ae3a4e7e939fa74c060eb1b354c34ea0fb55248 | https://github.com/hcyz33/PlaneSweepPose/tree/4ae3a4e7e939fa74c060eb1b354c34ea0fb55248 |
AutoEncoder | import torch
import torch.nn as nn
import torch.utils.data
class AutoEncoder(nn.Module):
def __init__(self, num_question, k):
""" Initialize a class AutoEncoder.
:param num_question: int
:param k: int
"""
super(AutoEncoder, self).__init__()
self.g = nn.Linear(num_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | harryye930/ML-Performance-Prediction | AutoEncoder | false | 3,580 | [
"MIT"
] | 0 | 82fac16da3c2dde6054cf5b579aa6864e9d37b30 | https://github.com/harryye930/ML-Performance-Prediction/tree/82fac16da3c2dde6054cf5b579aa6864e9d37b30 |
CharbonnierLoss | import torch
import torch.nn as nn
from torch import autograd as autograd
import torch.fft
from itertools import product as product
class CharbonnierLoss(nn.Module):
"""Charbonnier Loss (L1)"""
def __init__(self, eps=1e-09):
super(CharbonnierLoss, self).__init__()
self.eps = eps
def forw... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from t... | hduba/KAIR | CharbonnierLoss | false | 3,581 | [
"MIT"
] | 0 | dbd7596c7e4a4667b9b7baac369fc6c02571fa58 | https://github.com/hduba/KAIR/tree/dbd7596c7e4a4667b9b7baac369fc6c02571fa58 |
FRM | import torch
import torch.nn as nn
import torch.nn.functional as F
class FRM(nn.Module):
def __init__(self, nb_dim, do_add=True, do_mul=True):
super(FRM, self).__init__()
self.fc = nn.Linear(nb_dim, nb_dim)
self.sig = nn.Sigmoid()
self.do_add = do_add
self.do_mul = do_mul
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | hdubey/RawNet | FRM | false | 3,582 | [
"MIT"
] | 0 | 45589b2da9b0562ef2810e6097d4bdba23eb8a0a | https://github.com/hdubey/RawNet/tree/45589b2da9b0562ef2810e6097d4bdba23eb8a0a |
UpsampleConvLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class UpsampleConvLayer(nn.Module):
"""
Upsamples the input and then does a convolution. This method gives better results
compared to ConvTranspose2d.
"""
def __init__(self, in_channels, out_channels, kernel_size, stride,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | hehichens/NeuralStyle | UpsampleConvLayer | false | 3,583 | [
"Apache-2.0"
] | 0 | cf28a1eefd8713f85e94f50935562a663a53e8b5 | https://github.com/hehichens/NeuralStyle/tree/cf28a1eefd8713f85e94f50935562a663a53e8b5 |
DiscreteCriticNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class DiscreteCriticNetwork(nn.Module):
def __init__(self, obs_dim, act_dim, hidden_size=256):
super(DiscreteCriticNetwork, self).__init__()
self._l1 = nn.Linear(obs_dim, hidden_size)
self._l2 = nn.Linear(hidden_size, 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
assert_... | harwiltz/sac | DiscreteCriticNetwork | false | 3,584 | [
"MIT"
] | 0 | 076e01e63d8933665fbf4038513f163bbfd62800 | https://github.com/harwiltz/sac/tree/076e01e63d8933665fbf4038513f163bbfd62800 |
AFMS | import torch
import torch.nn as nn
import torch.nn.functional as F
class AFMS(nn.Module):
"""
Alpha-Feature map scaling, added to the output of each residual block[1,2].
Reference:
[1] RawNet2 : https://www.isca-speech.org/archive/Interspeech_2020/pdfs/1011.pdf
[2] AMFS : https://www.koreascie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | hdubey/RawNet | AFMS | false | 3,585 | [
"MIT"
] | 0 | 45589b2da9b0562ef2810e6097d4bdba23eb8a0a | https://github.com/hdubey/RawNet/tree/45589b2da9b0562ef2810e6097d4bdba23eb8a0a |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, latent_size, out_size):
super().__init__()
self.linear1 = nn.Linear(latent_size, int(out_size / 4))
self.linear2 = nn.Linear(int(out_size / 4), int(out_size / 2))
self.linear3 = nn.Linear(int(out_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
assert_... | hcgcarry/usad | Decoder | false | 3,586 | [
"BSD-3-Clause"
] | 0 | 4e99a6acd43ef109be4d89b80e96978b9ad61c2f | https://github.com/hcgcarry/usad/tree/4e99a6acd43ef109be4d89b80e96978b9ad61c2f |
SSD300 | import torch
import torchvision
import torch.utils.data
from torch import nn
import torch.nn.functional as F
from math import sqrt
from itertools import product as product
import torch.optim
def decimate(tensor, m):
"""
Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value.
This... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | adityag6994/pytorch_ssd_training | SSD300 | false | 3,587 | [
"MIT"
] | 0 | 404f3cbef815e314337ec2c1b4f06a2403a7ce03 | https://github.com/adityag6994/pytorch_ssd_training/tree/404f3cbef815e314337ec2c1b4f06a2403a7ce03 |
Attention | import torch
import torch.nn as nn
import torch.utils.data
class Attention(nn.Module):
def __init__(self):
super(Attention, self).__init__()
def forward(self, input_hidden_traces, target_hidden_traces):
Attn = torch.bmm(target_hidden_traces, input_hidden_traces.
transpose(1, 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._inductor.runtime.... | hk19960522/2018-DL-Final | Attention | false | 3,588 | [
"MIT"
] | 0 | cbc70260aa22d7df366a1d28bee472f1fc5b82c7 | https://github.com/hk19960522/2018-DL-Final/tree/cbc70260aa22d7df366a1d28bee472f1fc5b82c7 |
Autoencoder | import torch
import torch.nn as nn
class Autoencoder(nn.Module):
def __init__(self):
super(Autoencoder, self).__init__()
self.encoder = nn.Conv2d(1024, 128, kernel_size=1)
self.decoder = nn.Conv2d(128, 1024, kernel_size=1)
self.relu = nn.ReLU()
def forward(self, local_f):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | esha-singh/DL_project | Autoencoder | false | 3,589 | [
"MIT"
] | 0 | 11ac2874845bc3982435cc37f4e0b8896b95660e | https://github.com/esha-singh/DL_project/tree/11ac2874845bc3982435cc37f4e0b8896b95660e |
TVLoss | import torch
from torch import nn
from torch.nn import functional as F
class TVLoss(nn.Module):
"""L2 total variation loss, as in Mahendran et al."""
def forward(self, input):
input = F.pad(input, (0, 1, 0, 1), 'replicate')
x_diff = input[:, :-1, 1:] - input[:, :-1, :-1]
y_diff = inpu... | 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... | hjk0918/style-transfer-pytorch | TVLoss | false | 3,590 | [
"MIT"
] | 0 | acbc054c734aa9c723a3a9bb36e33afb9bd7833b | https://github.com/hjk0918/style-transfer-pytorch/tree/acbc054c734aa9c723a3a9bb36e33afb9bd7833b |
Bar | import torch
import torch.onnx
import torch.nn
class Bar(torch.nn.Module):
def __init__(self, x):
super(Bar, self).__init__()
self.x = x
def forward(self, a, b):
return a * b + self.x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_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.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | hl475/glow | Bar | false | 3,591 | [
"Apache-2.0"
] | 0 | f24d960e3cc80db95ac0bc17b1900dbf60ca044a | https://github.com/hl475/glow/tree/f24d960e3cc80db95ac0bc17b1900dbf60ca044a |
LegacyXOR | import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.utils.data
class LegacyXOR(nn.Module):
def __init__(self, input_dim, output_dim):
super(LegacyXOR, self).__init__()
self.lin1 = nn.Linear(input_dim, 8)
self.lin2 = nn.Linear(8, output_dim)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.... | heyfey/horovod | LegacyXOR | false | 3,592 | [
"Apache-2.0"
] | 0 | 7a697111eef7d88899551c176e31cde5ab61545c | https://github.com/heyfey/horovod/tree/7a697111eef7d88899551c176e31cde5ab61545c |
Upsample | import torch
from torch import nn
class Upsample(nn.Module):
"""
Since the number of channels of the feature map changes after upsampling in HRNet.
we have to write a new Upsample class.
"""
def __init__(self, in_channels, out_channels, scale_factor, mode):
super(Upsample, 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.... | hjk0918/style-transfer-pytorch | Upsample | false | 3,593 | [
"MIT"
] | 0 | acbc054c734aa9c723a3a9bb36e33afb9bd7833b | https://github.com/hjk0918/style-transfer-pytorch/tree/acbc054c734aa9c723a3a9bb36e33afb9bd7833b |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, in_size, latent_size):
super().__init__()
self.linear1 = nn.Linear(in_size, int(in_size / 2))
self.linear2 = nn.Linear(int(in_size / 2), int(in_size / 4))
self.linear3 = nn.Linear(int(in_size / 4), lat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | hcgcarry/usad | Encoder | false | 3,594 | [
"BSD-3-Clause"
] | 0 | 4e99a6acd43ef109be4d89b80e96978b9ad61c2f | https://github.com/hcgcarry/usad/tree/4e99a6acd43ef109be4d89b80e96978b9ad61c2f |
Baz | import torch
import torch.onnx
import torch.nn
class Baz(torch.nn.Module):
def __init__(self, x):
super(Baz, self).__init__()
self.x = x
def forward(self, a, b):
return a + b * self.x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_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.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | hl475/glow | Baz | false | 3,595 | [
"Apache-2.0"
] | 0 | f24d960e3cc80db95ac0bc17b1900dbf60ca044a | https://github.com/hl475/glow/tree/f24d960e3cc80db95ac0bc17b1900dbf60ca044a |
L2_DistanceAttention | import torch
import torch.nn as nn
import torch.utils.data
class L2_DistanceAttention(nn.Module):
def __init__(self):
super(L2_DistanceAttention, self).__init__()
def forward(self, input_hidden_traces, target_hidden_traces):
standard_size = input_hidden_traces.size(0), input_hidden_traces.si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | hk19960522/2018-DL-Final | L2_DistanceAttention | false | 3,596 | [
"MIT"
] | 0 | cbc70260aa22d7df366a1d28bee472f1fc5b82c7 | https://github.com/hk19960522/2018-DL-Final/tree/cbc70260aa22d7df366a1d28bee472f1fc5b82c7 |
PerfectProd | import torch
import torch.utils.data
from torch import nn
class PerfectProd(nn.Module):
def __init__(self, in_features, out_features):
super().__init__()
def reset_parameters(self):
pass
def forward(self, x):
return torch.prod(2 * x[:, :-1], dim=-1, keepdim=True)
def get_input... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | hoedt/stable-nalu | PerfectProd | false | 3,597 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
LearnedUpUnit | import torch
from torch import nn
class LearnedUpUnit(nn.Module):
def __init__(self, in_feats):
super().__init__()
self.up = nn.UpsamplingNearest2d(scale_factor=2)
self.dep_conv = nn.Conv2d(in_feats, in_feats, kernel_size=3, stride
=1, padding=1, groups=in_feats, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | hmdliu/PCGNet | LearnedUpUnit | false | 3,598 | [
"MIT"
] | 0 | c03f25dc1b138afc52f612c1c517b61874baa02a | https://github.com/hmdliu/PCGNet/tree/c03f25dc1b138afc52f612c1c517b61874baa02a |
LMA_Merge | import torch
from torch import nn
class LMA_Merge(nn.Module):
def __init__(self, *args, **kwargs):
super().__init__()
self.lamb = nn.Parameter(torch.zeros(1))
def forward(self, x, y):
return x + self.lamb * y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | hmdliu/PCGNet | LMA_Merge | false | 3,599 | [
"MIT"
] | 0 | c03f25dc1b138afc52f612c1c517b61874baa02a | https://github.com/hmdliu/PCGNet/tree/c03f25dc1b138afc52f612c1c517b61874baa02a |
ESA | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import autograd as autograd
import torch.fft
from itertools import product as product
class ESA(nn.Module):
def __init__(self, channel=64, reduction=4, bias=True):
super(ESA, self).__init__()
self.r_nc = channel // redu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 to... | hduba/KAIR | ESA | false | 3,600 | [
"MIT"
] | 0 | dbd7596c7e4a4667b9b7baac369fc6c02571fa58 | https://github.com/hduba/KAIR/tree/dbd7596c7e4a4667b9b7baac369fc6c02571fa58 |
NormalisedSigmoid | import torch
import torch.utils.data
from torch import nn
class NormalisedSigmoid(nn.Module):
""" Normalised logistic sigmoid function. """
def __init__(self, p: 'float'=1, dim: 'int'=-1):
super().__init__()
self.p = p
self.dim = dim
def forward(self, s: 'torch.Tensor') ->torch.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.utils.dat... | hoedt/stable-nalu | NormalisedSigmoid | false | 3,601 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
DisplacementPrediction | import torch
import torch.nn as nn
import torch.utils.data
class DisplacementPrediction(nn.Module):
def __init__(self, pedestrian_num, input_size, output_size):
super(DisplacementPrediction, self).__init__()
self.pedestrian_num = pedestrian_num
self.input_size = input_size
self.ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | hk19960522/2018-DL-Final | DisplacementPrediction | false | 3,602 | [
"MIT"
] | 0 | cbc70260aa22d7df366a1d28bee472f1fc5b82c7 | https://github.com/hk19960522/2018-DL-Final/tree/cbc70260aa22d7df366a1d28bee472f1fc5b82c7 |
decoder5 | import torch
import torch.nn as nn
class decoder5(nn.Module):
def __init__(self):
super(decoder5, self).__init__()
self.reflecPad15 = nn.ReflectionPad2d((1, 1, 1, 1))
self.conv15 = nn.Conv2d(512, 512, 3, 1, 0)
self.relu15 = nn.ReLU(inplace=True)
self.unpool = nn.Upsampling... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | guswl8033/ARtists | decoder5 | false | 3,603 | [
"Apache-2.0"
] | 0 | d353195872c1ef1a1aa68659a32fb47779a416fc | https://github.com/guswl8033/ARtists/tree/d353195872c1ef1a1aa68659a32fb47779a416fc |
LocationEncoder | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class LocationEncoder(nn.Module):
def __init__(self, pedestrian_num, input_size, hidden_size, batch_size):
super(LocationEncoder, self).__init__()
self.pedestrian_num = pedestrian_num
self.input_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.... | hk19960522/2018-DL-Final | LocationEncoder | false | 3,604 | [
"MIT"
] | 0 | cbc70260aa22d7df366a1d28bee472f1fc5b82c7 | https://github.com/hk19960522/2018-DL-Final/tree/cbc70260aa22d7df366a1d28bee472f1fc5b82c7 |
EncoderNet | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class EncoderNet(nn.Module):
def __init__(self, pedestrian_num, input_size, hidden_size):
super(EncoderNet, self).__init__()
self.pedestrian_num = pedestrian_num
self.input_size = input_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 ... | hk19960522/2018-DL-Final | EncoderNet | false | 3,605 | [
"MIT"
] | 0 | cbc70260aa22d7df366a1d28bee472f1fc5b82c7 | https://github.com/hk19960522/2018-DL-Final/tree/cbc70260aa22d7df366a1d28bee472f1fc5b82c7 |
PosNACLayer | import collections
import torch
import torch.utils.data
def sparsity_error(W):
W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W)))
return torch.max(W_error)
class SummaryWriterNamespaceNoLoggingScope:
def __init__(self, writer):
self._writer = writer
def __enter__(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 collections
import torch.utils.data
assert_size_stride = torch._C._dynamo... | hoedt/stable-nalu | PosNACLayer | false | 3,606 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
MNACLayer | import collections
import math
import torch
import torch.utils.data
def sparsity_error(W):
W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W)))
return torch.max(W_error)
def mnac(x, W, mode='prod'):
out_size, in_size = W.size()
x = x.view(x.size()[0], in_size, 1)
W = W.t().view(1, in_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
import collections
import math
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = ... | hoedt/stable-nalu | MNACLayer | false | 3,607 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
GumbelMNACLayer | import collections
import torch
import torch.utils.data
def mnac(x, W, mode='prod'):
out_size, in_size = W.size()
x = x.view(x.size()[0], in_size, 1)
W = W.t().view(1, in_size, out_size)
if mode == 'prod':
return torch.prod(x * W + 1 - W, -2)
elif mode == 'exp-log':
return torch.ex... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import collections
import torch.utils.data
asser... | hoedt/stable-nalu | GumbelMNACLayer | false | 3,608 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
DocUnetLossPow | import torch
import torch.nn as nn
import torch.nn.functional as F
class DocUnetLossPow(nn.Module):
"""
对应公式5的loss
"""
def __init__(self, r=0.1):
super(DocUnetLossPow, self).__init__()
self.r = r
def forward(self, y, label):
d = y - label
lossf = d.pow(2).mean() -... | 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... | hologerry/DewarpNet | DocUnetLossPow | false | 3,609 | [
"MIT"
] | 0 | b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 | https://github.com/hologerry/DewarpNet/tree/b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 |
MultiplicativeLinear | import collections
import torch
import torch.utils.data
from torch import nn
class SummaryWriterNamespaceNoLoggingScope:
def __init__(self, writer):
self._writer = writer
def __enter__(self):
self._writer._logging_enabled = False
def __exit__(self, type, value, traceback):
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 collec... | hoedt/stable-nalu | MultiplicativeLinear | false | 3,610 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
DocUnetLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class DocUnetLoss(nn.Module):
"""
只使用一个unet的loss 目前使用这个loss训练的比较好
"""
def __init__(self, r=0.1):
super(DocUnetLoss, self).__init__()
self.r = r
def forward(self, y, label):
d = y - label
lossf = to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | hologerry/DewarpNet | DocUnetLoss | false | 3,611 | [
"MIT"
] | 0 | b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 | https://github.com/hologerry/DewarpNet/tree/b0a11b9fbb98bd124e65d3165ce177d9ebf2e836 |
ReRegualizedLinearNACLayer | import collections
import math
import torch
import torch.utils.data
def sparsity_error(W):
W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W)))
return torch.max(W_error)
class SummaryWriterNamespaceNoLoggingScope:
def __init__(self, writer):
self._writer = writer
def __enter__(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 collections
import mat... | hoedt/stable-nalu | ReRegualizedLinearNACLayer | false | 3,612 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
ResidualBlock_noBN | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import autograd as autograd
import torch.nn.init as init
import torch.fft
from itertools import product as product
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from to... | hduba/KAIR | ResidualBlock_noBN | false | 3,613 | [
"MIT"
] | 0 | dbd7596c7e4a4667b9b7baac369fc6c02571fa58 | https://github.com/hduba/KAIR/tree/dbd7596c7e4a4667b9b7baac369fc6c02571fa58 |
ReRegualizedLinearMNACLayer | import collections
import math
import torch
import torch.utils.data
def sparsity_error(W):
W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W)))
return torch.max(W_error)
def mnac(x, W, mode='prod'):
out_size, in_size = W.size()
x = x.view(x.size()[0], in_size, 1)
W = W.t().view(1, in_s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import collections
import math
import torch.utils.data
assert_size_stride = torch._C._dyn... | hoedt/stable-nalu | ReRegualizedLinearMNACLayer | false | 3,614 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
ReRegualizedLinearPosNACLayer | import collections
import math
import torch
import torch.utils.data
def sparsity_error(W):
W_error = torch.min(torch.abs(W), torch.abs(1 - torch.abs(W)))
return torch.max(W_error)
class SummaryWriterNamespaceNoLoggingScope:
def __init__(self, writer):
self._writer = writer
def __enter__(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 collections
import mat... | hoedt/stable-nalu | ReRegualizedLinearPosNACLayer | false | 3,615 | [
"MIT"
] | 0 | 64b3d240db8bff4da857d955f213ef3c7e38e035 | https://github.com/hoedt/stable-nalu/tree/64b3d240db8bff4da857d955f213ef3c7e38e035 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.