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 |
|---|---|---|---|---|---|---|---|---|---|---|
Normal_Model | import torch
import torch.nn as nn
class Normal_Model(nn.Module):
"""
Example of a module for modeling a probability distribution. This is set up with all pieces
required for use with the rest of this package. (initial parameters; as well as implimented
constrain, forward, and log_prob methods)
""... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | ExamDay/InfoTorch | Normal_Model | false | 9,013 | [
"MIT"
] | 0 | ef13acce5bd8e76f9c3c8aadd1ab804dda9202e7 | https://github.com/ExamDay/InfoTorch/tree/ef13acce5bd8e76f9c3c8aadd1ab804dda9202e7 |
Network | import torch
import torch.nn as nn
import torch.nn.functional as F
class Network(nn.Module):
def __init__(self, input_size, nb_action):
super(Network, self).__init__()
self.input_size = input_size
self.nb_action = nb_action
self.fc1 = nn.Linear(input_size, 30)
self.fc2 = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | ExileExodus/Deep-Reinforcement-Learning | Network | false | 9,014 | [
"MIT"
] | 0 | 0007e5c4b74e920c250a15c18762966e1b55c17d | https://github.com/ExileExodus/Deep-Reinforcement-Learning/tree/0007e5c4b74e920c250a15c18762966e1b55c17d |
BiasAdd | import torch
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
class BiasAdd(nn.Module):
def __init__(self, num_features):
super(BiasAdd, self).__init__()
self.bias = torch.nn.Parameter(torch.Tensor(num_features))
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.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
assert_size_str... | Desmond-97/RepVGG | BiasAdd | false | 9,015 | [
"MIT"
] | 0 | 147490c54ee7b83d4a432a5913b17c8800e55d06 | https://github.com/Desmond-97/RepVGG/tree/147490c54ee7b83d4a432a5913b17c8800e55d06 |
tofp16 | import torch
import torch.nn as nn
import torch.nn.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
class tofp16(nn.Module):
"""
Utility module that implements::
def forward(self, input):
return input.half()
"""
de... | 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.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data... | DeanChan/apex | tofp16 | false | 9,016 | [
"BSD-3-Clause"
] | 0 | a03267e5e1209f559a6671da56c479a216f418d1 | https://github.com/DeanChan/apex/tree/a03267e5e1209f559a6671da56c479a216f418d1 |
MSBlock | import torch
import torch.nn as nn
class MSBlock(nn.Module):
def __init__(self, c_in, rate=4):
super(MSBlock, self).__init__()
self.rate = rate
self.conv = nn.Conv2d(c_in, 32, 3, stride=1, padding=1)
self.relu = nn.ReLU(inplace=True)
dilation = self.rate * 1 if self.rate >... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Ding1119/BDCN-Fiber_Detect | MSBlock | false | 9,017 | [
"MIT"
] | 0 | 7f3db5210a1a87d02c7ef8e79038ba00a8e5ef62 | https://github.com/Ding1119/BDCN-Fiber_Detect/tree/7f3db5210a1a87d02c7ef8e79038ba00a8e5ef62 |
Classifier | import torch
import torch.distributed
import torch
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, hidden_size):
super(Classifier, self).__init__()
self.linear1 = nn.Linear(hidden_size, 1)
self.sigmoid = nn.Sigmoid()
def forward(self, x, mask_cls):
h = 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.distributed
import torch
import torch.nn as nn
assert_size_stride =... | EisakuHiguchi/BertSum | Classifier | false | 9,018 | [
"Apache-2.0"
] | 0 | 67177fe025a26c40707d541bcfa0e723f88110da | https://github.com/EisakuHiguchi/BertSum/tree/67177fe025a26c40707d541bcfa0e723f88110da |
LinearMask | import torch
import torch.optim
import torch.nn as nn
import torch.nn.functional as F
class LinearMask(nn.Linear):
def __init__(self, in_features, out_features, bias=True):
super(LinearMask, self).__init__(in_features, out_features, bias)
def forward(self, x, mask):
params = self.weight * ma... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.optim
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | DMIU-ShELL/deeprl-shell | LinearMask | false | 9,019 | [
"Apache-2.0"
] | 0 | a7845ab1c4967ba2af9486625086c3d0b176d293 | https://github.com/DMIU-ShELL/deeprl-shell/tree/a7845ab1c4967ba2af9486625086c3d0b176d293 |
Conv_Q | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Conv_Q(nn.Module):
def __init__(self, frames, num_actions):
super(Conv_Q, self).__init__()
self.c1 = nn.Conv2d(frames, 32, kernel_size=8, stride=4)
self.c2 = nn.Conv2d(32, 64, kernel_size=4, 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.... | Altriaex/d4rl_evaluations | Conv_Q | false | 9,020 | [
"Apache-2.0"
] | 0 | ceb34c04e98af9332c6338a1414c0c2aa5fea68b | https://github.com/Altriaex/d4rl_evaluations/tree/ceb34c04e98af9332c6338a1414c0c2aa5fea68b |
DCCWeightedELoss | import torch
import numpy as np
import torch.nn as nn
class DCCWeightedELoss(nn.Module):
def __init__(self, size_average=True):
super(DCCWeightedELoss, self).__init__()
self.size_average = size_average
def forward(self, inputs, outputs, weights):
out = (inputs - outputs).view(len(inp... | 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... | Detzy/DCC_childpoet | DCCWeightedELoss | false | 9,021 | [
"MIT"
] | 0 | fc0a90516d7cfe57071801de8e9451381883af78 | https://github.com/Detzy/DCC_childpoet/tree/fc0a90516d7cfe57071801de8e9451381883af78 |
ValueNetwork | import torch
import torch.nn as nn
class ValueNetwork(nn.Module):
def __init__(self):
super(ValueNetwork, self).__init__()
self.relu = nn.ReLU()
self.fc1 = nn.Linear(4, 64)
self.fc2 = nn.Linear(64, 256)
self.fc3 = nn.Linear(256, 1)
def forward(self, x):
x = se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | DeepHaeJoong/reinforcement-learning | ValueNetwork | false | 9,022 | [
"MIT"
] | 0 | 63e3053e3209809e67e97d51adaf5f85ce3799ba | https://github.com/DeepHaeJoong/reinforcement-learning/tree/63e3053e3209809e67e97d51adaf5f85ce3799ba |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
"""
Convolutional Neural Network.
"""
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 20, kernel_size=5, stride=1)
self.fc1 = nn.Linear(8 * 8 * 20, 64)
self.fc2 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EricZLou/Ax | CNN | false | 9,023 | [
"MIT"
] | 0 | 3f8fc6f4a055e93cb69fda3799be41ee9572ef02 | https://github.com/EricZLou/Ax/tree/3f8fc6f4a055e93cb69fda3799be41ee9572ef02 |
SEBlock | import torch
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torch import nn
import torch.nn.functional as F
class SEBlock(nn.Module):
def __init__(self, input_channels, internal_neurons):
super(SEBlock, self).__init__()
self.down = 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.parallel
impo... | Desmond-97/RepVGG | SEBlock | false | 9,024 | [
"MIT"
] | 0 | 147490c54ee7b83d4a432a5913b17c8800e55d06 | https://github.com/Desmond-97/RepVGG/tree/147490c54ee7b83d4a432a5913b17c8800e55d06 |
Gaussian | import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
class Gaussian(nn.Module):
def __init__(self, in_dim, z_dim):
super(Gaussian, self).__init__()
self.mu = nn.Linear(in_dim, z_dim)
self.var = nn.Linear(in_dim, z_dim)
def reparameterize(self... | 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... | Fischer19/GMVAE | Gaussian | false | 9,025 | [
"MIT"
] | 0 | b960e24df8a10e9e07b2111ccb8939dd2556a6c2 | https://github.com/Fischer19/GMVAE/tree/b960e24df8a10e9e07b2111ccb8939dd2556a6c2 |
PolicyNetwork | import torch
import torch.nn as nn
from torch.distributions import Bernoulli
class PolicyNetwork(nn.Module):
def __init__(self):
super(PolicyNetwork, self).__init__()
self.fc1 = nn.Linear(4, 64)
self.fc2 = nn.Linear(64, 128)
self.fc3 = nn.Linear(128, 1)
self.relu = nn.ReLU... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | DeepHaeJoong/reinforcement-learning | PolicyNetwork | false | 9,026 | [
"MIT"
] | 0 | 63e3053e3209809e67e97d51adaf5f85ce3799ba | https://github.com/DeepHaeJoong/reinforcement-learning/tree/63e3053e3209809e67e97d51adaf5f85ce3799ba |
NotearsSobolev | import math
import torch
import numpy as np
import torch.nn as nn
class NotearsSobolev(nn.Module):
def __init__(self, d, k):
"""d: num variables k: num expansion of each variable"""
super(NotearsSobolev, self).__init__()
self.d, self.k = d, k
self.fc1_pos = nn.Linear(d * k, d, bia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | FrankTianTT/notears | NotearsSobolev | false | 9,027 | [
"Apache-2.0"
] | 0 | ead1e4fa966e29343a393d637320f98ee0cada7c | https://github.com/FrankTianTT/notears/tree/ead1e4fa966e29343a393d637320f98ee0cada7c |
LocallyConnected | import math
import torch
import torch.nn as nn
class LocallyConnected(nn.Module):
"""Local linear layer, i.e. Conv1dLocal() with filter size 1.
Args:
num_linear: num of local linear layers, i.e.
in_features: m1
out_features: m2
bias: whether to include bias or not
Shape:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | FrankTianTT/notears | LocallyConnected | false | 9,028 | [
"Apache-2.0"
] | 0 | ead1e4fa966e29343a393d637320f98ee0cada7c | https://github.com/FrankTianTT/notears/tree/ead1e4fa966e29343a393d637320f98ee0cada7c |
OneLayerFCBodyWithAction | import torch
import torch.optim
import torch.nn as nn
import torch.nn.functional as F
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class OneLayerFCBodyWithAction(nn.Module):
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.optim
import tor... | DMIU-ShELL/deeprl-shell | OneLayerFCBodyWithAction | false | 9,029 | [
"Apache-2.0"
] | 0 | a7845ab1c4967ba2af9486625086c3d0b176d293 | https://github.com/DMIU-ShELL/deeprl-shell/tree/a7845ab1c4967ba2af9486625086c3d0b176d293 |
SigmoidFocalClassificationLoss | import torch
import torch.nn as nn
class SigmoidFocalClassificationLoss(nn.Module):
"""
Sigmoid focal cross entropy loss.
"""
def __init__(self, gamma: 'float'=2.0, alpha: 'float'=0.25):
"""
Args:
gamma: Weighting parameter to balance loss for hard and easy examples.
... | 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... | ElodieShan/OpenPCDet | SigmoidFocalClassificationLoss | false | 9,030 | [
"Apache-2.0"
] | 0 | d23959d70c73b29f3f14462628fa8520a64f2eae | https://github.com/ElodieShan/OpenPCDet/tree/d23959d70c73b29f3f14462628fa8520a64f2eae |
Qnet | import random
import torch
import torch.nn as nn
class Qnet(nn.Module):
def __init__(self, actions=2):
super(Qnet, self).__init__()
self.fc1 = nn.Linear(4, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, actions)
self.relu = nn.ReLU()
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import random
import torch.nn... | DeepHaeJoong/reinforcement-learning | Qnet | false | 9,031 | [
"MIT"
] | 0 | 63e3053e3209809e67e97d51adaf5f85ce3799ba | https://github.com/DeepHaeJoong/reinforcement-learning/tree/63e3053e3209809e67e97d51adaf5f85ce3799ba |
FourierFeatures | import math
import torch
from torch import nn
class FourierFeatures(nn.Module):
def __init__(self, in_features, out_features, std=1.0):
super().__init__()
assert out_features % 2 == 0
self.weight = nn.Parameter(torch.randn([out_features // 2,
in_features]) * std)
def forw... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | DeepTitan/v-diffusion-pytorch | FourierFeatures | false | 9,032 | [
"MIT"
] | 0 | 857b6f2a4519973f9a8dc0b6c93f0134cebc3a8d | https://github.com/DeepTitan/v-diffusion-pytorch/tree/857b6f2a4519973f9a8dc0b6c93f0134cebc3a8d |
DuelingQnet | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
class DuelingQnet(nn.Module):
def __init__(self, actions=2):
super(DuelingQnet, self).__init__()
self.fc1 = nn.Linear(4, 128)
self.fc_value = nn.Linear(128, 128)
self.fc_adv = nn.Linear(128, 128)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | DeepHaeJoong/reinforcement-learning | DuelingQnet | false | 9,033 | [
"MIT"
] | 0 | 63e3053e3209809e67e97d51adaf5f85ce3799ba | https://github.com/DeepHaeJoong/reinforcement-learning/tree/63e3053e3209809e67e97d51adaf5f85ce3799ba |
Classifier | import torch
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, n_hid, n_out):
super(Classifier, self).__init__()
self.n_hid = n_hid
self.n_out = n_out
self.linear = nn.Linear(n_hid, n_out)
def forward(self, x):
tx = self.linear(x)
return to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | FengMingquan-sjtu/pyHGT | Classifier | false | 9,034 | [
"MIT"
] | 0 | 3ad1b10ee11358c02fa199667a80c291323e5e2d | https://github.com/FengMingquan-sjtu/pyHGT/tree/3ad1b10ee11358c02fa199667a80c291323e5e2d |
TransformerEncoderLayer | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
from torch.nn import TransformerEncoderLayer
from torch.nn.modules.activation import MultiheadAttention
from torch.nn.init import xavier_uniform_
from torch.nn.modules.dropout import Dropout
from torc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Chertushkin/efficient-dl-systems | TransformerEncoderLayer | false | 9,035 | [
"MIT"
] | 0 | 9541dbbbc92f8cf58d0f14c646562e068089aad0 | https://github.com/Chertushkin/efficient-dl-systems/tree/9541dbbbc92f8cf58d0f14c646562e068089aad0 |
DDPGConvBody | import torch
import torch.optim
import torch.nn as nn
import torch.nn.functional as F
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class DDPGConvBody(nn.Module):
def __init__(self, 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.optim
... | DMIU-ShELL/deeprl-shell | DDPGConvBody | false | 9,036 | [
"Apache-2.0"
] | 0 | a7845ab1c4967ba2af9486625086c3d0b176d293 | https://github.com/DMIU-ShELL/deeprl-shell/tree/a7845ab1c4967ba2af9486625086c3d0b176d293 |
WeightedCrossEntropyLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class WeightedCrossEntropyLoss(nn.Module):
"""
Transform input to fit the fomation of PyTorch offical cross entropy loss
with anchor-wise weighting.
"""
def __init__(self):
super(WeightedCrossEntropyLoss, 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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ElodieShan/OpenPCDet | WeightedCrossEntropyLoss | false | 9,037 | [
"Apache-2.0"
] | 0 | d23959d70c73b29f3f14462628fa8520a64f2eae | https://github.com/ElodieShan/OpenPCDet/tree/d23959d70c73b29f3f14462628fa8520a64f2eae |
FC | import torch
import torch.nn
import torch.utils.checkpoint
import torch.utils.data
import torch.optim
import torch.distributed
import torch.multiprocessing
class FC(torch.nn.Module):
def __init__(self, in_features, out_features, act=torch.nn.ReLU(inplace
=True)):
super().__init__()
self.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
import torch.... | AndrejOrsula/O-CNN | FC | false | 9,038 | [
"MIT"
] | 0 | e17290a206c3fe23d80873fb21d7243f71e2e9df | https://github.com/AndrejOrsula/O-CNN/tree/e17290a206c3fe23d80873fb21d7243f71e2e9df |
ShuffleBlock | import torch
import torch.nn as nn
class ShuffleBlock(nn.Module):
def __init__(self, groups=2):
super(ShuffleBlock, self).__init__()
self.groups = groups
def forward(self, x):
"""Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]"""
N, C, H, W = x.size(... | 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... | BoyuGuan/pytorch-cifar | ShuffleBlock | false | 9,039 | [
"MIT"
] | 0 | b96d0e325c614e8351449d63742fea5d085fdd8e | https://github.com/BoyuGuan/pytorch-cifar/tree/b96d0e325c614e8351449d63742fea5d085fdd8e |
ACNetwork | import torch
import torch.nn as nn
class ACNetwork(nn.Module):
def __init__(self, num_actions, num_states):
super(ACNetwork, self).__init__()
self.fc1 = nn.Linear(num_states, 1024)
self.fc2 = nn.Linear(1024, 512)
self.action = nn.Linear(512, num_actions)
self.softmax = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Devanshu-singh-VR/Reinforcement-Learning_Mixed | ACNetwork | false | 9,040 | [
"MIT"
] | 0 | 6b8b23977864f918ab8958b729d0faabcca720e4 | https://github.com/Devanshu-singh-VR/Reinforcement-Learning_Mixed/tree/6b8b23977864f918ab8958b729d0faabcca720e4 |
SoftQNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftQNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003):
super(SoftQNetwork, self).__init__()
self.linear1 = nn.Linear(num_inputs + num_actions, hidden_size)
self.linear2 = 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 as nn
assert_... | FTC-8856/SAC | SoftQNetwork | false | 9,041 | [
"MIT"
] | 0 | 98898d2c4b2ae99b74a8b5a6934d5d3cb91fe5f4 | https://github.com/FTC-8856/SAC/tree/98898d2c4b2ae99b74a8b5a6934d5d3cb91fe5f4 |
ValueNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class ValueNetwork(nn.Module):
def __init__(self, state_dim, hidden_dim, init_w=0.003):
super(ValueNetwork, self).__init__()
self.linear1 = nn.Linear(state_dim, hidden_dim)
self.linear2 = nn.Linear(hidden_dim, hidden_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_... | FTC-8856/SAC | ValueNetwork | false | 9,042 | [
"MIT"
] | 0 | 98898d2c4b2ae99b74a8b5a6934d5d3cb91fe5f4 | https://github.com/FTC-8856/SAC/tree/98898d2c4b2ae99b74a8b5a6934d5d3cb91fe5f4 |
DistillationLoss | import torch
class DistillationLoss(torch.nn.Module):
def __init__(self, temperature: 'float'=1.0):
super().__init__()
self.temperature = 1.0
def forward(self, student_logits, teacher_logits):
teacher_prediction = torch.exp(torch.log_softmax(teacher_logits /
self.temperat... | 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... | Gugutse/Poly-Encoder | DistillationLoss | false | 9,043 | [
"MIT"
] | 0 | aa3151d5accb240c32ac3d54bc785d904f78fcc7 | https://github.com/Gugutse/Poly-Encoder/tree/aa3151d5accb240c32ac3d54bc785d904f78fcc7 |
DenseModel | import torch
from torch import nn
class DenseModel(nn.Module):
def __init__(self, input_shape, output_shape, hidden_size=150,
activation=None):
super(DenseModel, self).__init__()
self.l1 = nn.Linear(input_shape, hidden_size)
self.l2 = nn.Linear(hidden_size, output_shape)
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
from torch import n... | HSE-LAMBDA/pytorch_ard | DenseModel | false | 9,044 | [
"MIT"
] | 0 | b6b40d4c495d3374180698549d8fef0b768ffd3a | https://github.com/HSE-LAMBDA/pytorch_ard/tree/b6b40d4c495d3374180698549d8fef0b768ffd3a |
SelfAttention2d | import torch
from torch import nn
class SelfAttention2d(nn.Module):
def __init__(self, c_in, n_head=1, dropout_rate=0.1):
super().__init__()
assert c_in % n_head == 0
self.norm = nn.GroupNorm(1, c_in)
self.n_head = n_head
self.qkv_proj = nn.Conv2d(c_in, c_in * 3, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DeepTitan/v-diffusion-pytorch | SelfAttention2d | false | 9,045 | [
"MIT"
] | 0 | 857b6f2a4519973f9a8dc0b6c93f0134cebc3a8d | https://github.com/DeepTitan/v-diffusion-pytorch/tree/857b6f2a4519973f9a8dc0b6c93f0134cebc3a8d |
SE | import torch
import torch.nn as nn
import torch.nn.functional as F
class SE(nn.Module):
"""Squeeze-and-Excitation block."""
def __init__(self, in_planes, se_planes):
super(SE, self).__init__()
self.se1 = nn.Conv2d(in_planes, se_planes, kernel_size=1, bias=True)
self.se2 = nn.Conv2d(se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BoyuGuan/pytorch-cifar | SE | false | 9,046 | [
"MIT"
] | 0 | b96d0e325c614e8351449d63742fea5d085fdd8e | https://github.com/BoyuGuan/pytorch-cifar/tree/b96d0e325c614e8351449d63742fea5d085fdd8e |
PolicyNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
class PolicyNetwork(nn.Module):
def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003,
log_std_min=-20, log_std_max=2):
super(PolicyNetwork, self).__init__()
self.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 import triton_helpers
import torch.nn as nn
from to... | FTC-8856/SAC | PolicyNetwork | false | 9,047 | [
"MIT"
] | 0 | 98898d2c4b2ae99b74a8b5a6934d5d3cb91fe5f4 | https://github.com/FTC-8856/SAC/tree/98898d2c4b2ae99b74a8b5a6934d5d3cb91fe5f4 |
Matcher | import math
import torch
import torch.nn as nn
class Matcher(nn.Module):
"""
Matching between a pair of nodes to conduct link prediction.
Use multi-head attention as matching model.
"""
def __init__(self, n_hid):
super(Matcher, self).__init__()
self.left_linear = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | FengMingquan-sjtu/pyHGT | Matcher | false | 9,048 | [
"MIT"
] | 0 | 3ad1b10ee11358c02fa199667a80c291323e5e2d | https://github.com/FengMingquan-sjtu/pyHGT/tree/3ad1b10ee11358c02fa199667a80c291323e5e2d |
GINPreTransition | import torch
import typing
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, input_dim, hidden_sizes: 'typing.Iterable[int]',
out_dim, activation_function=nn.Sigmoid(), activation_out=None):
super(MLP, self).__init__()
i_h_sizes = [input_dim] + hidden_sizes
self.mlp =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 typing
impor... | FaezehAmou2020/torch_gnn | GINPreTransition | false | 9,049 | [
"BSD-3-Clause"
] | 0 | 996a7f94259e718c625c6b4594729f025c4e4f14 | https://github.com/FaezehAmou2020/torch_gnn/tree/996a7f94259e718c625c6b4594729f025c4e4f14 |
Conv1d | import torch
import torch.nn as nn
import torch.utils.data
class Conv1d(nn.Conv1d):
"""
:param in_channels: Scalar
:param out_channels: Scalar
:param kernel_size: Scalar
:param activation_fn: activation function
:param drop_rate: Scalar. dropout rate
:param stride: Scalar
:param paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | CookiePPP/mellotron | Conv1d | false | 9,050 | [
"BSD-3-Clause"
] | 0 | 488425981c19cd0eddddea13d1348da4bfef8d26 | https://github.com/CookiePPP/mellotron/tree/488425981c19cd0eddddea13d1348da4bfef8d26 |
InstanceSimilarity | import torch
import torch.nn.functional as F
import torch.nn as nn
class InstanceSimilarity(nn.Module):
"""
Instance Similarity based loss
"""
def __init__(self, mse=True):
super(InstanceSimilarity, self).__init__()
self.mse = mse
def _loss(self, fm_s, fm_t):
fm_s = fm_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.... | DemoAuguste/ZAQ-code | InstanceSimilarity | false | 9,051 | [
"MIT"
] | 0 | 9986a2d217ab5cb284e08c062f8726cabacb311e | https://github.com/DemoAuguste/ZAQ-code/tree/9986a2d217ab5cb284e08c062f8726cabacb311e |
GlobalAvgPool2d | import torch
import torch.utils.data
from torch import nn
class GlobalAvgPool2d(nn.Module):
def __init__(self):
"""Global average pooling over the input's spatial dimensions"""
super(GlobalAvgPool2d, self).__init__()
def forward(self, inputs):
in_size = inputs.size()
return 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.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | GOPIKA-0204/Clothing-Detection-and-Recolouring | GlobalAvgPool2d | false | 9,052 | [
"MIT"
] | 0 | b5d436a981b854228314729b41874f31948a33ba | https://github.com/GOPIKA-0204/Clothing-Detection-and-Recolouring/tree/b5d436a981b854228314729b41874f31948a33ba |
Conv2dSamePadding | import torch
from torch import nn
import torch.nn.functional as F
def conv2d_same_padding(input, weight, bias=None, stride=1, dilation=1,
groups=1):
input_rows = input.size(2)
filter_rows = weight.size(2)
effective_filter_size_rows = (filter_rows - 1) * dilation[0] + 1
out_rows = (input_rows + str... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn.functional as F
assert_size_stride = torch.... | Florian-P-Huber/pycrop-yield-prediction | Conv2dSamePadding | false | 9,053 | [
"MIT"
] | 0 | 9c1a000db55589b3480ae3ac2baab8f461947855 | https://github.com/Florian-P-Huber/pycrop-yield-prediction/tree/9c1a000db55589b3480ae3ac2baab8f461947855 |
Highway | import torch
import torch.nn as nn
import torch.utils.data
class Highway(nn.Linear):
"""
:param input_dim: Scalar.
:param drop_rate: Scalar. dropout rate
"""
def __init__(self, input_dim, drop_rate=0.0):
self.drop_rate = drop_rate
super(Highway, self).__init__(input_dim, inpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | CookiePPP/mellotron | Highway | false | 9,054 | [
"BSD-3-Clause"
] | 0 | 488425981c19cd0eddddea13d1348da4bfef8d26 | https://github.com/CookiePPP/mellotron/tree/488425981c19cd0eddddea13d1348da4bfef8d26 |
HighwayConv1d | import torch
import torch.nn as nn
import torch.utils.data
class Conv1d(nn.Conv1d):
"""
:param in_channels: Scalar
:param out_channels: Scalar
:param kernel_size: Scalar
:param activation_fn: activation function
:param drop_rate: Scalar. dropout rate
:param stride: Scalar
:param paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | CookiePPP/mellotron | HighwayConv1d | false | 9,055 | [
"BSD-3-Clause"
] | 0 | 488425981c19cd0eddddea13d1348da4bfef8d26 | https://github.com/CookiePPP/mellotron/tree/488425981c19cd0eddddea13d1348da4bfef8d26 |
IIDIsotropicGaussianUVLoss | import math
import torch
from torch.nn import functional as F
import torch.utils.data
from torch import nn
class IIDIsotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of iid residuals with isotropic covariance:
$Sigma_i = sigma_i^2 I$
The loss (negative log likelihood) is then:
$1/2 sum_{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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import math... | GOPIKA-0204/Clothing-Detection-and-Recolouring | IIDIsotropicGaussianUVLoss | false | 9,056 | [
"MIT"
] | 0 | b5d436a981b854228314729b41874f31948a33ba | https://github.com/GOPIKA-0204/Clothing-Detection-and-Recolouring/tree/b5d436a981b854228314729b41874f31948a33ba |
TransformerNet | import torch
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding)
self.conv2d = torch.nn.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.... | Chandan-h-509/ignite | TransformerNet | false | 9,057 | [
"BSD-3-Clause"
] | 0 | f8c39828cb1dac49b6ef358cdf77865bf2430106 | https://github.com/Chandan-h-509/ignite/tree/f8c39828cb1dac49b6ef358cdf77865bf2430106 |
Conv2d | import torch
import torch.nn as nn
import torch.utils.data
class Conv2d(nn.Conv2d):
"""
:param in_channels: Scalar
:param out_channels: Scalar
:param kernel_size: Scalar
:param activation_fn: activation function
:param drop_rate: Scalar. dropout rate
:param stride: Scalar
:param paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | CookiePPP/mellotron | Conv2d | false | 9,058 | [
"BSD-3-Clause"
] | 0 | 488425981c19cd0eddddea13d1348da4bfef8d26 | https://github.com/CookiePPP/mellotron/tree/488425981c19cd0eddddea13d1348da4bfef8d26 |
ALL_CNN_C | import torch
from torch import nn
import torch.nn.functional as F
class ALL_CNN_C(nn.Module):
def __init__(self, num_classes=10):
super(ALL_CNN_C, self).__init__()
self.model_name = 'ALL_CNN_C'
self.dp0 = nn.Dropout2d(p=0.2)
self.conv1 = nn.Conv2d(3, 96, 3, padding=1)
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 import nn
assert_s... | EIDOSlab/Delving-in-the-loss-landscape-to-embed-robust-watermarks-into-neural-networks | ALL_CNN_C | false | 9,059 | [
"MIT"
] | 0 | 020ea57d48c192cec03c69e66938480cf898b8f2 | https://github.com/EIDOSlab/Delving-in-the-loss-landscape-to-embed-robust-watermarks-into-neural-networks/tree/020ea57d48c192cec03c69e66938480cf898b8f2 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
def set_init(layers):
for layer in layers:
nn.init.normal(layer.weight, mean=0.0, std=0.3)
nn.init.constant(layer.bias, 0.3)
class Net(nn.Module):
def __init__(self, s_dim, a_dim):
super(Net, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | HaiyinPiao/pytorch-a3c | Net | false | 9,060 | [
"MIT"
] | 0 | d151fb4197449610f090c1d687c50a74422f594c | https://github.com/HaiyinPiao/pytorch-a3c/tree/d151fb4197449610f090c1d687c50a74422f594c |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
"""
Applies an attention mechanism on the output features from the decoder.
.. math::
\\begin{array}{ll}
x = context*output \\\\
attn = exp(x_i) / sum_j exp(x_j) \\\\
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HanSeokhyeon/speech_recognition_for_multi_language | Attention | false | 9,061 | [
"Apache-2.0"
] | 0 | 6219186146ec4e47dcb7ac46cdb74ca49dad7770 | https://github.com/HanSeokhyeon/speech_recognition_for_multi_language/tree/6219186146ec4e47dcb7ac46cdb74ca49dad7770 |
MultiHeadAttention | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
class MultiHeadAttention(nn.Module):
"""
input:
query --- [N, T_q, query_dim]
key --- [N, T_k, key_dim]
output:
out --- [N, T_q, num_units]
"""
def __init__(self, query_dim, key_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.... | CookiePPP/mellotron | MultiHeadAttention | false | 9,062 | [
"BSD-3-Clause"
] | 0 | 488425981c19cd0eddddea13d1348da4bfef8d26 | https://github.com/CookiePPP/mellotron/tree/488425981c19cd0eddddea13d1348da4bfef8d26 |
GlobalAttention | import torch
import torch.nn as nn
import torch.cuda
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not all arguments have the same value: ' + str(args)
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.... | FrameNetBrasil/OpenNMT-py | GlobalAttention | false | 9,063 | [
"MIT"
] | 0 | f14a8f325ec2e482ea9aa6e12fbf3544bc68631b | https://github.com/FrameNetBrasil/OpenNMT-py/tree/f14a8f325ec2e482ea9aa6e12fbf3544bc68631b |
BilinearAttention | import torch
import torch.nn as nn
import torch.utils.data
class BilinearAttention(nn.Module):
"""
:param enc_dim: Scalar.
:param dec_dim: Scalar
"""
def __init__(self, enc_dim, dec_dim):
super(BilinearAttention, self).__init__()
self.W = nn.Linear(enc_dim, dec_dim)
def forw... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CookiePPP/mellotron | BilinearAttention | false | 9,064 | [
"BSD-3-Clause"
] | 0 | 488425981c19cd0eddddea13d1348da4bfef8d26 | https://github.com/CookiePPP/mellotron/tree/488425981c19cd0eddddea13d1348da4bfef8d26 |
SmallAdversarialNetwork | import torch
import torch.utils.data
import torch
import torch.nn as nn
class SmallAdversarialNetwork(nn.Module):
def __init__(self, in_feature):
super(SmallAdversarialNetwork, self).__init__()
self.ad_layer1 = nn.Linear(in_feature, 64)
self.ad_layer2 = nn.Linear(64, 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
import torch.utils.data
import torch
import torch.nn as nn
assert_size_stride = ... | FigaroK/pytorch-CycleGAN-and-pix2pix | SmallAdversarialNetwork | false | 9,065 | [
"BSD-3-Clause"
] | 0 | 74407363baf4626782398040e34a342e20915d41 | https://github.com/FigaroK/pytorch-CycleGAN-and-pix2pix/tree/74407363baf4626782398040e34a342e20915d41 |
Encoder | import torch
from torch import nn
import torch.hub
import torch.nn.functional as F
class Encoder(nn.Module):
"""Estimation of the nonnegative mixture weight by a 1-D conv layer.
"""
def __init__(self, L, N, audio_channels):
super(Encoder, self).__init__()
self.L, self.N = L, N
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | FindingBen/demucs-copy | Encoder | false | 9,066 | [
"MIT"
] | 0 | b607e9c91b776eb03bf95a2aa9c4900c92fc7c3f | https://github.com/FindingBen/demucs-copy/tree/b607e9c91b776eb03bf95a2aa9c4900c92fc7c3f |
UpConv | import torch
from collections import OrderedDict
import torch.nn as nn
class UpConv(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.up_conv = nn.Sequential(OrderedDict([('up', nn.Upsample(
scale_factor=2)), ('conv', nn.Conv2d(in_channels, in_channels //
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from collections import OrderedDict
import torch.nn as nn
assert_size_stride = t... | HCMUS-ROBOTICS/ssdf-perception | UpConv | false | 9,067 | [
"MIT"
] | 0 | c3eb426397a542da49509bb381972c8ff877597b | https://github.com/HCMUS-ROBOTICS/ssdf-perception/tree/c3eb426397a542da49509bb381972c8ff877597b |
GramLoss | import torch
import torch.utils.data
import torch
import torch.nn as nn
from torch.nn import functional as F
class GramLoss(nn.Module):
def __init__(self):
super(GramLoss, self).__init__()
def forward(self, input, target):
input = input.reshape(input.shape[0], input.shape[1], -1)
tar... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Dimlife/pytorch-CycleGAN-and-pix2pix | GramLoss | false | 9,068 | [
"BSD-3-Clause"
] | 0 | 7f43282e8f816d103e3c0e9e5df008a463cdfdc4 | https://github.com/Dimlife/pytorch-CycleGAN-and-pix2pix/tree/7f43282e8f816d103e3c0e9e5df008a463cdfdc4 |
StableBCELoss | import torch
import torch.utils.data
class StableBCELoss(torch.nn.modules.Module):
def __init__(self):
super(StableBCELoss, self).__init__()
def forward(self, input, target):
neg_abs = -input.abs()
loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log()
return ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | GOPIKA-0204/Clothing-Detection-and-Recolouring | StableBCELoss | false | 9,069 | [
"MIT"
] | 0 | b5d436a981b854228314729b41874f31948a33ba | https://github.com/GOPIKA-0204/Clothing-Detection-and-Recolouring/tree/b5d436a981b854228314729b41874f31948a33ba |
LittleAdversarialNetwork | import torch
import torch.utils.data
import torch
import torch.nn as nn
class LittleAdversarialNetwork(nn.Module):
def __init__(self, in_feature):
super(LittleAdversarialNetwork, self).__init__()
self.ad_layer1 = nn.Linear(in_feature, 1)
self.ad_layer1.weight.data.normal_(0, 0.01)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 = ... | FigaroK/pytorch-CycleGAN-and-pix2pix | LittleAdversarialNetwork | false | 9,070 | [
"BSD-3-Clause"
] | 0 | 74407363baf4626782398040e34a342e20915d41 | https://github.com/FigaroK/pytorch-CycleGAN-and-pix2pix/tree/74407363baf4626782398040e34a342e20915d41 |
DownConv | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
def conv3x3(in_channels, out_channels, stride=1, padding=1, bias=True, groups=1
):
return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=
stride, padding=padding, bias=bias, groups=groups)
class D... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Amadeus9029/Haru | DownConv | false | 9,071 | [
"MIT"
] | 0 | 60396b6cc7ad008e4ae78cb182b6f421197cd7bf | https://github.com/Amadeus9029/Haru/tree/60396b6cc7ad008e4ae78cb182b6f421197cd7bf |
AdversarialNetwork | import torch
import torch.utils.data
import torch
import torch.nn as nn
class AdversarialNetwork(nn.Module):
def __init__(self, in_feature):
super(AdversarialNetwork, self).__init__()
self.ad_layer1 = nn.Linear(in_feature, 1024)
self.ad_layer2 = nn.Linear(1024, 1024)
self.ad_layer... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 = ... | FigaroK/pytorch-CycleGAN-and-pix2pix | AdversarialNetwork | false | 9,072 | [
"BSD-3-Clause"
] | 0 | 74407363baf4626782398040e34a342e20915d41 | https://github.com/FigaroK/pytorch-CycleGAN-and-pix2pix/tree/74407363baf4626782398040e34a342e20915d41 |
ConvNet | import torch
import torch.nn as nn
class ConvNet(nn.Module):
def __init__(self, img_size):
super(ConvNet, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 3)
self.conv2 = nn.Conv2d(32, 64, 3)
self.relu = nn.ReLU()
self.padding = nn.ZeroPad2d(1)
self.fc1 = nn.Linear(4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Guojiacheng2017/wasteNet_SH | ConvNet | false | 9,073 | [
"MIT"
] | 0 | cc02e535e52513133fe87094f76a30835dbb0010 | https://github.com/Guojiacheng2017/wasteNet_SH/tree/cc02e535e52513133fe87094f76a30835dbb0010 |
IndepAnisotropicGaussianUVLoss | import math
import torch
from torch.nn import functional as F
import torch.utils.data
from torch import nn
class IndepAnisotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of independent residuals with anisotropic covariances:
$Sigma_i = sigma_i^2 I + r_i r_i^T$
The loss (negative log likelihood... | 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 math... | GOPIKA-0204/Clothing-Detection-and-Recolouring | IndepAnisotropicGaussianUVLoss | false | 9,074 | [
"MIT"
] | 0 | b5d436a981b854228314729b41874f31948a33ba | https://github.com/GOPIKA-0204/Clothing-Detection-and-Recolouring/tree/b5d436a981b854228314729b41874f31948a33ba |
EPE | import torch
import torch.nn as nn
class EPE(nn.Module):
def __init__(self):
super(EPE, self).__init__()
def forward(self, flow, gt, loss_mask):
loss_map = (flow - gt.detach()) ** 2
loss_map = (loss_map.sum(1, True) + 1e-06) ** 0.5
return loss_map * loss_mask
def get_inputs... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Entangled-Others-Studio/arXiv2020-RIFE | EPE | false | 9,075 | [
"MIT"
] | 0 | 4cd37527876b19f2eb357385eb5e9167545450af | https://github.com/Entangled-Others-Studio/arXiv2020-RIFE/tree/4cd37527876b19f2eb357385eb5e9167545450af |
Encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class Encoder(nn.Module):
def __init__(self, out_dim=64):
super(Encoder, self).__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=1, padding=1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | GuohongLi/simclr-pytorch | Encoder | false | 9,076 | [
"BSD-3-Clause"
] | 0 | 7e08b2433a623fdbc1c097402fded4cc69d1b54e | https://github.com/GuohongLi/simclr-pytorch/tree/7e08b2433a623fdbc1c097402fded4cc69d1b54e |
TransitionUp | import torch
import torch.nn
import torch.nn.functional as F
import torch.nn as nn
class TransitionUp(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
def forward(self, x, skip, concat=True):
out = F.interpolate(x, size=(skip.size(2), skip.size(3)), mode=
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | FUTUREEEEEE/FCHarDNet | TransitionUp | false | 9,077 | [
"MIT"
] | 0 | fc4b854b5cfa01a449bcfaece6bb3c32d84d9e2b | https://github.com/FUTUREEEEEE/FCHarDNet/tree/fc4b854b5cfa01a449bcfaece6bb3c32d84d9e2b |
SCRM | import torch
import torch.nn.functional as F
import torch.nn as nn
class SCRM(nn.Module):
"""
spatial & channel wise relation loss
"""
def __init__(self, gamma=0.1):
super(SCRM, self).__init__()
self.softmax = nn.Softmax(dim=-1)
self.gamma = gamma
def spatial_wise(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._inductor.runtime.... | DemoAuguste/ZAQ-code | SCRM | false | 9,078 | [
"MIT"
] | 0 | 9986a2d217ab5cb284e08c062f8726cabacb311e | https://github.com/DemoAuguste/ZAQ-code/tree/9986a2d217ab5cb284e08c062f8726cabacb311e |
Critic | import torch
import torch.nn as nn
class Critic(nn.Module):
def __init__(self, hidden_size, action, num_inputs, spp_num_outputs,
data_width=8):
super(Critic, self).__init__()
self.action = action
self.num_outputs = self.action.shape[0]
self.num_inputs = num_inputs
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | GraceYYJ/cbx-k | Critic | false | 9,079 | [
"MIT"
] | 0 | 1a955bc8d1675b8024763218482372dca982cc6c | https://github.com/GraceYYJ/cbx-k/tree/1a955bc8d1675b8024763218482372dca982cc6c |
Decoder | import math
import torch
from torch import nn
import torch.hub
def overlap_and_add(signal, frame_step):
outer_dimensions = signal.size()[:-2]
frames, frame_length = signal.size()[-2:]
subframe_length = math.gcd(frame_length, frame_step)
subframe_step = frame_step // subframe_length
subframes_per_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
import math
from torch import nn
import torch.hub
assert_size_stride = torch._C.... | FindingBen/demucs-copy | Decoder | false | 9,080 | [
"MIT"
] | 0 | b607e9c91b776eb03bf95a2aa9c4900c92fc7c3f | https://github.com/FindingBen/demucs-copy/tree/b607e9c91b776eb03bf95a2aa9c4900c92fc7c3f |
TLU | import torch
from torch import nn
from torch.nn import Parameter
from torch.nn.parameter import Parameter
class TLU(nn.Module):
def __init__(self, num_features):
"""max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau"""
super(TLU, self).__init__()
self.num_features = num_features
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from torch.nn import Parameter
from torch.nn.parameter import Parame... | DengpanFu/fast-reid-v0 | TLU | false | 9,081 | [
"Apache-2.0"
] | 0 | e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e | https://github.com/DengpanFu/fast-reid-v0/tree/e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e |
PixelUnshuffle | import torch
from torch import nn
import torch.utils.data
class PixelUnshuffle(nn.Module):
"""
Initialize: inplanes, planes, upscale_factor
OUTPUT: (planes // upscale_factor^2) * ht * wd
"""
def __init__(self, downscale_factor=2):
super(PixelUnshuffle, self).__init__()
self._r = d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | HwangToeMat/tmp | PixelUnshuffle | false | 9,082 | [
"Apache-2.0"
] | 0 | a4f48443b16b5e07a9cf95f54651ade8c7669134 | https://github.com/HwangToeMat/tmp/tree/a4f48443b16b5e07a9cf95f54651ade8c7669134 |
AnyHead | import torch
from torch import nn
class AnyHead(nn.Module):
"""AnyNet head."""
def __init__(self, w_in, nc):
super(AnyHead, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d((1, 1))
self.fc = nn.Linear(w_in, nc, bias=True)
def forward(self, x):
x = self.avg_pool(x)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | DengpanFu/fast-reid-v0 | AnyHead | false | 9,083 | [
"Apache-2.0"
] | 0 | e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e | https://github.com/DengpanFu/fast-reid-v0/tree/e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e |
BellMembFunc | import torch
def _mk_param(val):
"""Make a torch parameter from a scalar value"""
if isinstance(val, torch.Tensor):
val = val.item()
return torch.nn.Parameter(torch.tensor(val, dtype=torch.float))
class BellMembFunc(torch.nn.Module):
"""
Generalised Bell membership function; defined ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | GradyKurpasi/anfis-pytorch | BellMembFunc | false | 9,084 | [
"MIT"
] | 0 | 4cce596193a8bc65e632405ca66d116c771033d7 | https://github.com/GradyKurpasi/anfis-pytorch/tree/4cce596193a8bc65e632405ca66d116c771033d7 |
TwoLayerNet | import torch
class TwoLayerNet(torch.nn.Module):
"""
From the pytorch examples, a simjple 2-layer neural net.
https://pytorch.org/tutorials/beginner/pytorch_with_examples.html
"""
def __init__(self, d_in, hidden_size, d_out):
super(TwoLayerNet, self).__init__()
self.linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | GradyKurpasi/anfis-pytorch | TwoLayerNet | false | 9,085 | [
"MIT"
] | 0 | 4cce596193a8bc65e632405ca66d116c771033d7 | https://github.com/GradyKurpasi/anfis-pytorch/tree/4cce596193a8bc65e632405ca66d116c771033d7 |
ModelBasic | import torch
import torch.nn as nn
class ModelBasic(nn.Module):
"""parallel passing of data, categorical output with one unit per number of clusters"""
def __init__(self, n_obs, n_units=100, n_timesteps=10, max_K=10):
super(ModelBasic, self).__init__()
self.fc_input = nn.Linear(2 * n_obs, n_u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | HeikoSchuett/hard-inference | ModelBasic | false | 9,086 | [
"MIT"
] | 0 | eb850d97458dbbf8a5c434df71c802065c8e348f | https://github.com/HeikoSchuett/hard-inference/tree/eb850d97458dbbf8a5c434df71c802065c8e348f |
MNIST_CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class SqueezeLastTwo(nn.Module):
"""
A module which squeezes the last two dimensions,
ordinary squeeze can be a problem for batch size 1
"""
def __init__(self):
super(SqueezeLastTwo, self).__init__(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | FrancescoCappio/swad | MNIST_CNN | false | 9,087 | [
"MIT"
] | 0 | b1da3eacb7dc3711360e6621ca16f2d75c4f411c | https://github.com/FrancescoCappio/swad/tree/b1da3eacb7dc3711360e6621ca16f2d75c4f411c |
CharbonnierLoss | import torch
import torch.utils.data
import torch.nn as nn
class CharbonnierLoss(nn.Module):
"""Charbonnier Loss (L1)"""
def __init__(self, eps=1e-06):
super(CharbonnierLoss, self).__init__()
self.eps = eps
def forward(self, x, y):
diff = x - y
loss = torch.sum(torch.sqrt... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
impo... | AbnerVictor/HCFlow | CharbonnierLoss | false | 9,088 | [
"Apache-2.0"
] | 0 | e55938ac9f58c117898e3d161ddc73b14d15289b | https://github.com/AbnerVictor/HCFlow/tree/e55938ac9f58c117898e3d161ddc73b14d15289b |
GaussMembFunc | import torch
def _mk_param(val):
"""Make a torch parameter from a scalar value"""
if isinstance(val, torch.Tensor):
val = val.item()
return torch.nn.Parameter(torch.tensor(val, dtype=torch.float))
class GaussMembFunc(torch.nn.Module):
"""
Gaussian membership functions, defined by two... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | GradyKurpasi/anfis-pytorch | GaussMembFunc | false | 9,089 | [
"MIT"
] | 0 | 4cce596193a8bc65e632405ca66d116c771033d7 | https://github.com/GradyKurpasi/anfis-pytorch/tree/4cce596193a8bc65e632405ca66d116c771033d7 |
rSoftMax | import torch
import torch.nn.functional as F
from torch import nn
class rSoftMax(nn.Module):
def __init__(self, radix, cardinality):
super().__init__()
self.radix = radix
self.cardinality = cardinality
def forward(self, x):
batch = x.size(0)
if self.radix > 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 math as tl_math
from torch import nn
a... | DengpanFu/fast-reid-v0 | rSoftMax | false | 9,090 | [
"Apache-2.0"
] | 0 | e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e | https://github.com/DengpanFu/fast-reid-v0/tree/e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e |
ConvModule | import torch
import torch.utils.data.distributed
from torch import nn
import torch.utils.data
class ConvModule(nn.Module):
def __init__(self, input_dim, kernel_size, dropout_rate, causal=False):
super(ConvModule, self).__init__()
self.layer_norm = nn.LayerNorm(input_dim)
self.pw_conv_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.... | Five-Hundred-Years-Ago/StreamingTransformer | ConvModule | false | 9,091 | [
"Apache-2.0"
] | 0 | fdaace64ed786bbdaeea2b9f44e96f9403ef98fe | https://github.com/Five-Hundred-Years-Ago/StreamingTransformer/tree/fdaace64ed786bbdaeea2b9f44e96f9403ef98fe |
Actor | import torch
import torch.nn as nn
class Actor(nn.Module):
def __init__(self, hidden_size, action, num_inputs, num_output,
spp_num_outputs=[1, 2, 4], data_width=8):
super(Actor, self).__init__()
self.action = action
self.num_inputs = num_inputs
self.num_outputs = num_outpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | GraceYYJ/cbx-k | Actor | false | 9,092 | [
"MIT"
] | 0 | 1a955bc8d1675b8024763218482372dca982cc6c | https://github.com/GraceYYJ/cbx-k/tree/1a955bc8d1675b8024763218482372dca982cc6c |
Quantization | import torch
import torch.utils.data
import torch.nn as nn
class Quant(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
input = torch.clamp(input, 0, 1)
output = (input * 255.0).round() / 255.0
return output
@staticmethod
def backward(ctx, grad_output):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
impo... | AbnerVictor/HCFlow | Quantization | false | 9,093 | [
"Apache-2.0"
] | 0 | e55938ac9f58c117898e3d161ddc73b14d15289b | https://github.com/AbnerVictor/HCFlow/tree/e55938ac9f58c117898e3d161ddc73b14d15289b |
MultiLayeredConv1d | import torch
import torch.utils.data.distributed
import torch.utils.data
class MultiLayeredConv1d(torch.nn.Module):
"""Multi-layered conv1d for Transformer block.
This is a module of multi-leyered conv1d designed
to replace positionwise feed-forward network
in Transforner block, which is introduced 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
import torch.utils.data.distr... | Five-Hundred-Years-Ago/StreamingTransformer | MultiLayeredConv1d | false | 9,094 | [
"Apache-2.0"
] | 0 | fdaace64ed786bbdaeea2b9f44e96f9403ef98fe | https://github.com/Five-Hundred-Years-Ago/StreamingTransformer/tree/fdaace64ed786bbdaeea2b9f44e96f9403ef98fe |
SplAtConv2d | import logging
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import ReLU
from torch.nn import Conv2d
from torch.nn.modules.utils import _pair
def get_norm(norm, out_channels, num_splits=1, **kwargs):
"""
Args:
norm (str or callable):
Returns:
nn.Module or ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DengpanFu/fast-reid-v0 | SplAtConv2d | false | 9,095 | [
"Apache-2.0"
] | 0 | e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e | https://github.com/DengpanFu/fast-reid-v0/tree/e444c0187ccb6ef3b8348f8c5f0c5a0814b3683e |
TwoLayerFCBodyWithAction | import torch
import torch.optim
import torch.nn as nn
import torch.nn.functional as F
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class TwoLayerFCBodyWithAction(nn.Module):
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.optim
import tor... | DMIU-ShELL/deeprl-shell | TwoLayerFCBodyWithAction | false | 9,096 | [
"Apache-2.0"
] | 0 | a7845ab1c4967ba2af9486625086c3d0b176d293 | https://github.com/DMIU-ShELL/deeprl-shell/tree/a7845ab1c4967ba2af9486625086c3d0b176d293 |
cls_pos | import torch
import torch.nn as nn
class cls_pos(nn.Module):
def __init__(self):
super(cls_pos, self).__init__()
self.bce = nn.BCEWithLogitsLoss(reduction='none')
def forward(self, pos_pred, pos_label):
log_loss = self.bce(pos_pred[:, 0, :, :], pos_label[:, 2, :, :])
pos_pred... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | FrancesC0de/Pedestron | cls_pos | false | 9,097 | [
"Apache-2.0"
] | 0 | 9ef6a408f97f8c8af98096b7945df18c9d3656ca | https://github.com/FrancesC0de/Pedestron/tree/9ef6a408f97f8c8af98096b7945df18c9d3656ca |
Conv_Blocks | import torch
import torch.nn as nn
class Conv_Blocks(nn.Module):
def __init__(self, input_dim, output_dim, filter_size=3, batch_norm=
False, non_lin='tanh', dropout=0.0, first_block=False, last_block=
False, skip_connection=False):
super(Conv_Blocks, self).__init__()
self.skip_con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HRHLALALA/GoalGAN | Conv_Blocks | false | 9,098 | [
"MIT"
] | 0 | 01443f2a578333a0d5ab3a449bc7da69f5023190 | https://github.com/HRHLALALA/GoalGAN/tree/01443f2a578333a0d5ab3a449bc7da69f5023190 |
MySimpleNet | import torch
import torch.nn.functional as F
from torch import nn
class MySimpleNet(nn.Module):
"""
Very simple 2-layer net, slightly adapted from the docs:
https://skorch.readthedocs.io/en/stable/user/quickstart.html
"""
def __init__(self, num_in, num_feat, num_hidden=10, nonlin=F.re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | GradyKurpasi/anfis-pytorch | MySimpleNet | false | 9,099 | [
"MIT"
] | 0 | 4cce596193a8bc65e632405ca66d116c771033d7 | https://github.com/GradyKurpasi/anfis-pytorch/tree/4cce596193a8bc65e632405ca66d116c771033d7 |
offset_pos | import torch
import torch.nn as nn
class offset_pos(nn.Module):
def __init__(self):
super(offset_pos, self).__init__()
self.smoothl1 = nn.SmoothL1Loss(reduction='none')
def forward(self, offset_pred, offset_label):
l1_loss = offset_label[:, 2, :, :].unsqueeze(dim=1) * self.smoothl1(
... | 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
... | FrancesC0de/Pedestron | offset_pos | false | 9,100 | [
"Apache-2.0"
] | 0 | 9ef6a408f97f8c8af98096b7945df18c9d3656ca | https://github.com/FrancesC0de/Pedestron/tree/9ef6a408f97f8c8af98096b7945df18c9d3656ca |
reg_hw_pos | import torch
import torch.nn as nn
class reg_hw_pos(nn.Module):
def __init__(self):
super(reg_hw_pos, self).__init__()
self.smoothl1 = nn.SmoothL1Loss(reduction='none')
def forward(self, h_pred, h_label):
l1_loss = h_label[:, 2, :, :] * self.smoothl1(h_pred[:, 0, :, :] /
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | FrancesC0de/Pedestron | reg_hw_pos | false | 9,101 | [
"Apache-2.0"
] | 0 | 9ef6a408f97f8c8af98096b7945df18c9d3656ca | https://github.com/FrancesC0de/Pedestron/tree/9ef6a408f97f8c8af98096b7945df18c9d3656ca |
reg_pos | import torch
import torch.nn as nn
class reg_pos(nn.Module):
def __init__(self):
super(reg_pos, self).__init__()
self.smoothl1 = nn.SmoothL1Loss(reduction='none')
def forward(self, h_pred, h_label):
l1_loss = h_label[:, 1, :, :] * self.smoothl1(h_pred[:, 0, :, :] /
(h_lab... | 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
... | FrancesC0de/Pedestron | reg_pos | false | 9,102 | [
"Apache-2.0"
] | 0 | 9ef6a408f97f8c8af98096b7945df18c9d3656ca | https://github.com/FrancesC0de/Pedestron/tree/9ef6a408f97f8c8af98096b7945df18c9d3656ca |
UpConv_Blocks | import torch
import torch.nn as nn
class UpConv_Blocks(nn.Module):
def __init__(self, input_dim, output_dim, filter=4, padding=1,
first_block=False, last_block=False, batch_norm=False, non_lin=
'relu', dropout=0, skip_connection=False):
super(UpConv_Blocks, self).__init__()
self.B... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | HRHLALALA/GoalGAN | UpConv_Blocks | false | 9,103 | [
"MIT"
] | 0 | 01443f2a578333a0d5ab3a449bc7da69f5023190 | https://github.com/HRHLALALA/GoalGAN/tree/01443f2a578333a0d5ab3a449bc7da69f5023190 |
Conv2dZeros | import torch
import torch.utils.data
import torch.nn as nn
class _ActNorm(nn.Module):
"""
Activation Normalization
Initialize the bias and scale with a given minibatch,
so that the output per-channel have zero mean and unit variance for that.
After initialization, `bias` and `logs` will be traine... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | AbnerVictor/HCFlow | Conv2dZeros | false | 9,104 | [
"Apache-2.0"
] | 0 | e55938ac9f58c117898e3d161ddc73b14d15289b | https://github.com/AbnerVictor/HCFlow/tree/e55938ac9f58c117898e3d161ddc73b14d15289b |
SelfAttention | import torch
import torch.nn as nn
class SelfAttention(nn.Module):
def __init__(self, hidden):
super(SelfAttention, self).__init__()
self.W = nn.Linear(hidden, 1)
def forward(self, x):
hidden = self.W(x)
scores = hidden.bmm(hidden.transpose(1, 2))
alpha = nn.functiona... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IAMZn1018/ccks2021-entity-linking | SelfAttention | false | 9,105 | [
"Apache-2.0"
] | 0 | 6596b0b16d8c1fc4400c736b30ff46158d1575e4 | https://github.com/IAMZn1018/ccks2021-entity-linking/tree/6596b0b16d8c1fc4400c736b30ff46158d1575e4 |
ResidualBlock_noBN | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, nn.Conv2d):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | AbnerVictor/HCFlow | ResidualBlock_noBN | false | 9,106 | [
"Apache-2.0"
] | 0 | e55938ac9f58c117898e3d161ddc73b14d15289b | https://github.com/AbnerVictor/HCFlow/tree/e55938ac9f58c117898e3d161ddc73b14d15289b |
AverageAttention | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the size of input for the first-layer of the FFN.
d_ff (int): the hidden layer size of th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_str... | GarrettNicolai/OpenNMT-py | AverageAttention | false | 9,108 | [
"MIT"
] | 0 | 9491d900ac1b50fe39da417bacc0b9d610331888 | https://github.com/GarrettNicolai/OpenNMT-py/tree/9491d900ac1b50fe39da417bacc0b9d610331888 |
L2Norm | import torch
import torch.nn as nn
import torch.nn.functional as F
class L2Norm(nn.Module):
def __init__(self, dim=1):
super().__init__()
self.dim = dim
def forward(self, x):
return F.normalize(x, p=2, dim=self.dim)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_... | 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... | Guido27/project_vg | L2Norm | false | 9,109 | [
"MIT"
] | 0 | 3322fc355742929f43f3d97204398035645d968c | https://github.com/Guido27/project_vg/tree/3322fc355742929f43f3d97204398035645d968c |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
def __init__(self, hidden):
super(Attention, self).__init__()
self.linear = nn.Linear(hidden, 1, bias=False)
def forward(self, x, mask=None):
weights = self.linear(x)
if mask is not None:
weights = wei... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | IAMZn1018/ccks2021-entity-linking | Attention | false | 9,110 | [
"Apache-2.0"
] | 0 | 6596b0b16d8c1fc4400c736b30ff46158d1575e4 | https://github.com/IAMZn1018/ccks2021-entity-linking/tree/6596b0b16d8c1fc4400c736b30ff46158d1575e4 |
SparseConv2d | import math
import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
import scipy.sparse as sparse
from torch.nn.modules.utils import _pair
class SparseConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, k, rho_init,
rho_maxim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 numpy as np
import torch.nn as nn
import torch.utils.data
imp... | FaithfulZhening/CNN-FCF-CVPR-2019 | SparseConv2d | false | 9,111 | [
"Apache-2.0"
] | 0 | f65f6577feb4a2cdaed3fb60cb14b8840e25e19c | https://github.com/FaithfulZhening/CNN-FCF-CVPR-2019/tree/f65f6577feb4a2cdaed3fb60cb14b8840e25e19c |
BasicBlock1 | import torch
import torch.nn as nn
class BasicBlock1(nn.Module):
def __init__(self, input_dim, output_dim):
super(BasicBlock1, self).__init__()
self.ID = input_dim
self.conv = nn.Conv2d(in_channels=input_dim, out_channels=
output_dim, kernel_size=1, padding=0, 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
import torch.nn as nn
assert_... | Houseqin/PytorchToCaffe | BasicBlock1 | false | 9,112 | [
"MIT"
] | 0 | e94224ba6414e76369f191e7e3d9731c12ce2bd7 | https://github.com/Houseqin/PytorchToCaffe/tree/e94224ba6414e76369f191e7e3d9731c12ce2bd7 |
FakeReLUM | import torch
import torch.nn as nn
class FakeReLU(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
return input.clamp(min=0)
@staticmethod
def backward(ctx, grad_output):
return grad_output
class FakeReLUM(nn.Module):
def forward(self, x):
return FakeRe... | 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... | Jay-Roberts/FW-Perturbations | FakeReLUM | false | 9,113 | [
"MIT"
] | 0 | 0960f6116125307cc986f9f19b3c5ab4c15ed535 | https://github.com/Jay-Roberts/FW-Perturbations/tree/0960f6116125307cc986f9f19b3c5ab4c15ed535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.