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
SELoss
import torch from torch import Tensor from torch import nn class SELoss(nn.MSELoss): def __init__(self): super().__init__(reduction='none') def forward(self, inputs: 'Tensor', target: 'Tensor') ->Tensor: return super().forward(inputs, target).sum(1) def get_inputs(): return [torch.rand...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
kfirgedal/lightning-bolts
SELoss
false
12,661
[ "Apache-2.0" ]
0
cbb8b6c21ca1de757d0f289fb840d59a3b6a10f5
https://github.com/kfirgedal/lightning-bolts/tree/cbb8b6c21ca1de757d0f289fb840d59a3b6a10f5
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)) None self.H = nn.Parameter(torch.empty(item_size, dim)) ...
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...
kerengaiger/bpr
BPR
false
12,662
[ "MIT" ]
0
66bfa57469a9c70ba5b9158fde5210abe1bd8d7b
https://github.com/kerengaiger/bpr/tree/66bfa57469a9c70ba5b9158fde5210abe1bd8d7b
SimulatorReward
import torch import torch.nn.functional as F class SimulatorReward(torch.nn.Module): def __init__(self): super(SimulatorReward, self).__init__() self.conv1 = torch.nn.Conv2d(4, 8, kernel_size=3, padding=1) self.conv2 = torch.nn.Conv2d(8, 16, kernel_size=3, padding=1) self.conv3 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
karshtharyani/DeepReinforcementLearningInAction
SimulatorReward
false
12,663
[ "MIT" ]
0
9dc40a43b43f05daf9aecb7e3ec7592cf38720e5
https://github.com/karshtharyani/DeepReinforcementLearningInAction/tree/9dc40a43b43f05daf9aecb7e3ec7592cf38720e5
UnpoolingAsConvolution
import torch import torch.nn as nn def get_incoming_shape(incoming): size = incoming.size() return [size[0], size[1], size[2], size[3]] def interleave(tensors, axis): old_shape = get_incoming_shape(tensors[0])[1:] new_shape = [-1] + old_shape new_shape[axis] *= len(tensors) stacked = torch.s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
karoly-hars/DE_hybrid_CNN
UnpoolingAsConvolution
false
12,664
[ "BSD-3-Clause" ]
0
d74ba4291d6db335151d5262ab96e8e3806a7587
https://github.com/karoly-hars/DE_hybrid_CNN/tree/d74ba4291d6db335151d5262ab96e8e3806a7587
ActorCriticMLP
import torch from torch import Tensor from torch import nn from typing import Tuple from torch.nn import functional as F class ActorCriticMLP(nn.Module): """MLP network with heads for actor and critic.""" def __init__(self, input_shape: 'Tuple[int]', n_actions: 'int', hidden_size: 'int'=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 from torch._inductor.runtime....
kfirgedal/lightning-bolts
ActorCriticMLP
false
12,665
[ "Apache-2.0" ]
0
cbb8b6c21ca1de757d0f289fb840d59a3b6a10f5
https://github.com/kfirgedal/lightning-bolts/tree/cbb8b6c21ca1de757d0f289fb840d59a3b6a10f5
SDNE_layer
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch as torch class SDNE_layer(nn.Module): def __init__(self, num_node, hidden_size1, hidden_size2, droput, alpha, beta, nu1, nu2): super(SDNE_layer, self).__init__() self.num_node = num_nod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ckhui/cogdl
SDNE_layer
false
12,666
[ "MIT" ]
0
93bea17c2dc7084857cd0a4af8178c174965127c
https://github.com/ckhui/cogdl/tree/93bea17c2dc7084857cd0a4af8178c174965127c
LearnedPositionalEmbedding
import torch import torch.utils.data from torch import nn def create_position_ids_from_input_ids(input_ids, padding_idx): """ Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions...
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._...
kev2513/gap-text2sql
LearnedPositionalEmbedding
false
12,667
[ "Apache-2.0" ]
0
67c4d6489ac44d4785a0cc1b836c889f00226f1d
https://github.com/kev2513/gap-text2sql/tree/67c4d6489ac44d4785a0cc1b836c889f00226f1d
CrossEntropyLoss
import torch import torch.utils.cpp_extension class CrossEntropyLoss(torch.nn.Module): def __init__(self): super(CrossEntropyLoss, self).__init__() self.ce_loss = torch.nn.CrossEntropyLoss() def forward(self, cls_output, label, **_): return self.ce_loss(cls_output, label).mean() 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.cpp...
hugobloem/PyTorch-StudioGAN
CrossEntropyLoss
false
12,668
[ "MIT" ]
0
3deab27c0774adba5a94c7f452d32d4cbc3b117c
https://github.com/hugobloem/PyTorch-StudioGAN/tree/3deab27c0774adba5a94c7f452d32d4cbc3b117c
LSoftLoss
import torch import torch.nn.functional as F import torch.nn as nn class LSoftLoss(nn.Module): def __init__(self): super().__init__() def forward(self, y_pred, y_true, beta): with torch.no_grad(): y_true_updated = beta * y_true + (1 - beta) * y_pred return F.binary_cross_...
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...
khodwe56/kaggle-birdsong-recognition
LSoftLoss
false
12,669
[ "MIT" ]
0
95a902c37355619cf02558968f000038e487db47
https://github.com/khodwe56/kaggle-birdsong-recognition/tree/95a902c37355619cf02558968f000038e487db47
RNN
import torch import torch.nn as nn class RNN(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(RNN, self).__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(input_size + hidden_size, hidden_size) self.i2o = nn.Linear(input_size + hidden_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
khalilbalaree/Key-Smasher
RNN
false
12,670
[ "Apache-2.0" ]
0
981bb1fd9b91e9a693dba8b1cd4ee7ea82409d14
https://github.com/khalilbalaree/Key-Smasher/tree/981bb1fd9b91e9a693dba8b1cd4ee7ea82409d14
CDEFunc
import torch class CDEFunc(torch.nn.Module): def __init__(self, input_channels, hidden_channels): super(CDEFunc, self).__init__() self.input_channels = input_channels self.hidden_channels = hidden_channels self.linear1 = torch.nn.Linear(hidden_channels, 128) self.linear2 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
khaledsaab/NeuralCDE
CDEFunc
false
12,671
[ "Apache-2.0" ]
0
559d9d6fdb137afd14965725ea4845cf31e9235c
https://github.com/khaledsaab/NeuralCDE/tree/559d9d6fdb137afd14965725ea4845cf31e9235c
NegativeSampling
import torch import torch.nn as nn class NegativeSampling(nn.Module): """Negative sampling loss as proposed by T. Mikolov et al. in Distributed Representations of Words and Phrases and their Compositionality. """ def __init__(self): super(NegativeSampling, self).__init__() self._log_s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
kimoyerr/my-dataloader
NegativeSampling
false
12,672
[ "MIT" ]
0
a235e2f02d936df3f835b423dd015afa52e54066
https://github.com/kimoyerr/my-dataloader/tree/a235e2f02d936df3f835b423dd015afa52e54066
SpatialAttention2d
import torch import torch.nn as nn class SpatialAttention2d(nn.Module): def __init__(self, channel): super(SpatialAttention2d, self).__init__() self.squeeze = nn.Conv2d(channel, 1, kernel_size=1, bias=False) self.sigmoid = nn.Sigmoid() def forward(self, x): z = self.squeeze(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...
khodwe56/kaggle-birdsong-recognition
SpatialAttention2d
false
12,673
[ "MIT" ]
0
95a902c37355619cf02558968f000038e487db47
https://github.com/khodwe56/kaggle-birdsong-recognition/tree/95a902c37355619cf02558968f000038e487db47
AnswerModule
import torch import torch.nn as nn import torch.nn.init as init class AnswerModule(nn.Module): def __init__(self, vocab_size, hidden_size): super(AnswerModule, self).__init__() self.z = nn.Linear(2 * hidden_size, vocab_size) init.xavier_normal_(self.z.state_dict()['weight']) self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.init as init assert_size_stride = torch._C...
kirubarajan/Dynamic-Memory-Network-Plus
AnswerModule
false
12,674
[ "Apache-2.0" ]
0
0613287ef5a959c7b260afcea2c31afcfb0ea189
https://github.com/kirubarajan/Dynamic-Memory-Network-Plus/tree/0613287ef5a959c7b260afcea2c31afcfb0ea189
BinaryClassifier
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class BinaryClassifier(nn.Module): """ Define a neural network that performs binary classification. The network should accept your number of features as input, and produce a single sigmoid value, that can be ro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
khadija267/Plagiarism-Detection
BinaryClassifier
false
12,675
[ "MIT" ]
0
90334167a8e6406e3f1ee178e616d6aa0094b1b5
https://github.com/khadija267/Plagiarism-Detection/tree/90334167a8e6406e3f1ee178e616d6aa0094b1b5
SCse
import torch import torch.nn as nn class SpatialAttention2d(nn.Module): def __init__(self, channel): super(SpatialAttention2d, self).__init__() self.squeeze = nn.Conv2d(channel, 1, kernel_size=1, bias=False) self.sigmoid = nn.Sigmoid() def forward(self, x): z = self.squeeze(x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
khodwe56/kaggle-birdsong-recognition
SCse
false
12,676
[ "MIT" ]
0
95a902c37355619cf02558968f000038e487db47
https://github.com/khodwe56/kaggle-birdsong-recognition/tree/95a902c37355619cf02558968f000038e487db47
NN
import torch import torch.nn as nn class NN(nn.Module): def __init__(self, input_size, h1, h2, h3, num_output): super(NN, self).__init__() self.fc1 = nn.Linear(input_size, h1) self.fc2 = nn.Linear(h1, h2) self.fc3 = nn.Linear(h2, h3) self.fc4 = nn.Linear(h3, num_output) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
kgarg8/hypertune
NN
false
12,677
[ "MIT" ]
0
fbc4b87c9aefcd8449f6068232d7105975ff9dc9
https://github.com/kgarg8/hypertune/tree/fbc4b87c9aefcd8449f6068232d7105975ff9dc9
Clamp
import torch from torch import nn class Clamp(nn.Module): """Clamp energy output""" def forward(self, x): x = torch.clamp(x, min=0, max=30) return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
kmiec96/mlhep-2021-baseline-track_1
Clamp
false
12,678
[ "Apache-2.0" ]
0
6fd2aa1529734204c522c49dba40fdc4b2bce353
https://github.com/kmiec96/mlhep-2021-baseline-track_1/tree/6fd2aa1529734204c522c49dba40fdc4b2bce353
NeuralNetwork
import torch import torch.nn as nn class NeuralNetwork(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim, action_bound): super(NeuralNetwork, self).__init__() self.input_layer = nn.Linear(input_dim, hidden_dim) self.hidden_layer = nn.Linear(hidden_dim, hidden_dim) 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....
keyshor/homework
NeuralNetwork
false
12,679
[ "MIT" ]
0
687f9edf73bbac8fc492dfd82d634c19a38f5aab
https://github.com/keyshor/homework/tree/687f9edf73bbac8fc492dfd82d634c19a38f5aab
UpSample
import torch import torch.nn.functional as F import torch.nn as nn class UpSample(nn.Sequential): def __init__(self, skip_input, output_features): super(UpSample, self).__init__() self.convA = nn.Conv2d(skip_input, output_features, kernel_size=3, stride=1, padding=1) self.leak...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
kimtaehyeong/msnnff
UpSample
false
12,680
[ "MIT" ]
0
75586be601bbdbfafcdf4038bc08f239e119b417
https://github.com/kimtaehyeong/msnnff/tree/75586be601bbdbfafcdf4038bc08f239e119b417
nn_model
import torch import torch.nn as nn import torch.nn.functional as F class nn_model(nn.Module): def __init__(self, feature_dim, num_classes): super(nn_model, self).__init__() self.l1 = nn.Linear(feature_dim, 1024) self.l2 = nn.Linear(1024, 1024) self.l3 = nn.Linear(1024, num_classes...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
kiankd/quicksand
nn_model
false
12,681
[ "MIT" ]
0
20f9505c843eec00e423a0e1589ebd1e6264e174
https://github.com/kiankd/quicksand/tree/20f9505c843eec00e423a0e1589ebd1e6264e174
ConvMeanPool
import torch from torch import nn class MyConvo2d(nn.Module): def __init__(self, input_dim, output_dim, kernel_size, he_init=True, stride=1, bias=True): super(MyConvo2d, self).__init__() self.he_init = he_init self.padding = int((kernel_size - 1) / 2) self.conv = 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
kolchinski/humanception-score
ConvMeanPool
false
12,682
[ "MIT" ]
0
da8880eec3be39574718409cfe8ca303f41c64e6
https://github.com/kolchinski/humanception-score/tree/da8880eec3be39574718409cfe8ca303f41c64e6
Generator
import torch import torch.nn as nn class Generator(nn.Module): def __init__(self, hidden_size, output_size): super(Generator, self).__init__() self.hidden_size = hidden_size self.output_size = output_size self.out = nn.Linear(hidden_size, output_size) self.sm = nn.LogSoftm...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
kompotiks/Boris
Generator
false
12,683
[ "Apache-2.0" ]
0
2cf9487e4bc8d81206f819c0fe5c1d793d554062
https://github.com/kompotiks/Boris/tree/2cf9487e4bc8d81206f819c0fe5c1d793d554062
AttentionGRUCell
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init class AttentionGRUCell(nn.Module): def __init__(self, input_size, hidden_size): super(AttentionGRUCell, self).__init__() self.hidden_size = hidden_size self.Wr = nn.Linear(input_size, hidden_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.triton_helpers import libdevice import torch.nn as ...
kirubarajan/Dynamic-Memory-Network-Plus
AttentionGRUCell
false
12,684
[ "Apache-2.0" ]
0
0613287ef5a959c7b260afcea2c31afcfb0ea189
https://github.com/kirubarajan/Dynamic-Memory-Network-Plus/tree/0613287ef5a959c7b260afcea2c31afcfb0ea189
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed import torch.multiprocessing class FocalLoss(nn.Module): """Focal Loss - https://arxiv.org/abs/1708.02002""" def __init__(self, alpha=0.25, gamma=2): super().__init__() self.alpha = a...
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...
krisk84/retinanet-examples
FocalLoss
false
12,685
[ "BSD-3-Clause" ]
0
174d95f3aabe1746d105c66f87aa445607f4eab8
https://github.com/krisk84/retinanet-examples/tree/174d95f3aabe1746d105c66f87aa445607f4eab8
GlobalAveragePooling
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.nn.functional as F class GlobalAveragePooling(nn.Module): def __init__(self): super(GlobalAveragePooling, self).__init__() def forward(self, feat): num_channels = feat.size(1) return F.avg_poo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_stri...
kristinakupf/FeatureLearningRotNet
GlobalAveragePooling
false
12,686
[ "MIT" ]
0
d495bcfaed3e7a3ca92b7434f8ad6d7584ab173d
https://github.com/kristinakupf/FeatureLearningRotNet/tree/d495bcfaed3e7a3ca92b7434f8ad6d7584ab173d
KLDLoss
import torch import torch.nn as nn import torch.utils.data class KLDLoss(nn.Module): def forward(self, mu, logvar): return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp()) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
kudoNCT/michigan_copy
KLDLoss
false
12,687
[ "MIT" ]
0
e857b96a65b270ef2506cb9866b7e01f117c4396
https://github.com/kudoNCT/michigan_copy/tree/e857b96a65b270ef2506cb9866b7e01f117c4396
GatedMaskedConv2d
import torch import torch.utils.data from torch import nn import torch.nn.functional as F class GatedMaskedConv2d(nn.Module): def __init__(self, in_dim, out_dim=None, kernel_size=3, mask='B'): super(GatedMaskedConv2d, self).__init__() if out_dim is None: out_dim = in_dim self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils....
kj141/vae-lagging-encoder
GatedMaskedConv2d
false
12,688
[ "MIT" ]
0
79dda8baed0129bc8234b7602332a54210164fbc
https://github.com/kj141/vae-lagging-encoder/tree/79dda8baed0129bc8234b7602332a54210164fbc
DuelingDQN
import torch import torch.nn.functional as F import torch.nn as nn class DuelingDQN(nn.Module): def __init__(self, state_size, action_size, seed): super(DuelingDQN, self).__init__() torch.manual_seed(seed) self.state_size = state_size self.action_size = action_size self.fc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
kscharpf/drlnd_p1_navigation
DuelingDQN
false
12,689
[ "MIT" ]
0
7f5e2aebcabb9d94c45a2fa7e9e8baec5c4b7a00
https://github.com/kscharpf/drlnd_p1_navigation/tree/7f5e2aebcabb9d94c45a2fa7e9e8baec5c4b7a00
SmoothL1Loss
import torch import torch.nn as nn import torch.cuda import torch.distributed import torch.multiprocessing class SmoothL1Loss(nn.Module): """Smooth L1 Loss""" def __init__(self, beta=0.11): super().__init__() self.beta = beta def forward(self, pred, target): x = (pred - target).a...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda import torch.distributed import t...
krisk84/retinanet-examples
SmoothL1Loss
false
12,690
[ "BSD-3-Clause" ]
0
174d95f3aabe1746d105c66f87aa445607f4eab8
https://github.com/krisk84/retinanet-examples/tree/174d95f3aabe1746d105c66f87aa445607f4eab8
GELU
import torch import torch.nn as nn from torch.nn import functional as F class GELU(nn.Module): def forward(self, input): return F.gelu(input) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
kwonyos/decision-transformer
GELU
false
12,691
[ "MIT" ]
0
c3ad7df28a897a016dd24c5337cb871d1f33f456
https://github.com/kwonyos/decision-transformer/tree/c3ad7df28a897a016dd24c5337cb871d1f33f456
WeightedFeatureFusion
import torch import torch.nn as nn import torch.utils.data class WeightedFeatureFusion(nn.Module): def __init__(self, layers, weight=False): super(WeightedFeatureFusion, self).__init__() self.layers = layers self.weight = weight self.n = len(layers) + 1 if weight: ...
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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
ks1320/Traffic-Surveillance-System
WeightedFeatureFusion
false
12,692
[ "MIT" ]
0
fa1eb2a3a3d494c798fa2eeb0528ef48b1978332
https://github.com/ks1320/Traffic-Surveillance-System/tree/fa1eb2a3a3d494c798fa2eeb0528ef48b1978332
Reorg
import torch import torch.nn as nn import torch.utils.data class Reorg(nn.Module): def forward(self, x): return torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]], 1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): re...
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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
ks1320/Traffic-Surveillance-System
Reorg
false
12,693
[ "MIT" ]
0
fa1eb2a3a3d494c798fa2eeb0528ef48b1978332
https://github.com/ks1320/Traffic-Surveillance-System/tree/fa1eb2a3a3d494c798fa2eeb0528ef48b1978332
GCN
import torch import torch.nn as nn import torch.nn.functional as F class GCN(nn.Module): def __init__(self, dim_nd, dim_ft, dim_hd, dim_ot, drop_rate=0.5): super(GCN, self).__init__() self.lin1 = nn.Linear(dim_ft, dim_hd) self.lin2 = nn.Linear(dim_hd, dim_ot) self.act1 = F.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 import ...
lanseyege/Graph
GCN
false
12,694
[ "MIT" ]
0
ec94502ea59d2b68de095d8160f37aa22d26f8cb
https://github.com/lanseyege/Graph/tree/ec94502ea59d2b68de095d8160f37aa22d26f8cb
DQN
import torch import torch.nn.functional as F import torch.nn as nn class DQN(nn.Module): """Initialize a deep Q-learning network Hints: ----- Original paper for DQN https://storage.googleapis.com/deepmind-data/assets/papers/DeepMindNature14236Paper.pdf This is just a hint. You can build ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
khaiyichin/DS595-RL-Projects
DQN
false
12,695
[ "MIT" ]
0
4add6b2adc2cb9f7cdb783d50b005ecd1b4aada3
https://github.com/khaiyichin/DS595-RL-Projects/tree/4add6b2adc2cb9f7cdb783d50b005ecd1b4aada3
BasicBlock
import torch import torch.nn as nn import torch.utils.data def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
kudoNCT/michigan_copy
BasicBlock
false
12,696
[ "MIT" ]
0
e857b96a65b270ef2506cb9866b7e01f117c4396
https://github.com/kudoNCT/michigan_copy/tree/e857b96a65b270ef2506cb9866b7e01f117c4396
FeaturePyramidNetwork
import torch import torch.nn as nn class FeaturePyramidNetwork(nn.Module): def __init__(self, C3_feature, C4_feature, C5_feature, feature_size=256): super(FeaturePyramidNetwork, self).__init__() self.P5_1 = nn.Conv2d(C5_feature, feature_size, kernel_size=1, stride=1, padding=0) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
kiyohiro8/SemanticReasoningNetworks
FeaturePyramidNetwork
false
12,697
[ "MIT" ]
0
9dc20706a2234511789a7a2fa07cc3b77c64bf81
https://github.com/kiyohiro8/SemanticReasoningNetworks/tree/9dc20706a2234511789a7a2fa07cc3b77c64bf81
_Hswish
import torch import torch.nn as nn class _Hswish(nn.Module): def __init__(self, inplace=True): super(_Hswish, self).__init__() self.relu6 = nn.ReLU6(inplace) def forward(self, x): return x * self.relu6(x + 3.0) / 6.0 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
hzwangjl/Lightweight-Segmentation
_Hswish
false
12,698
[ "Apache-2.0" ]
0
3a476719bdfee653ac1e1617c22714b7ee932cef
https://github.com/hzwangjl/Lightweight-Segmentation/tree/3a476719bdfee653ac1e1617c22714b7ee932cef
AR
import torch import torch.utils.data import torch.nn as nn from typing import * class AR(nn.Module): def __init__(self, window): super(AR, self).__init__() self.linear = nn.Linear(window, 1) def forward(self, x): x = torch.transpose(x, 1, 2) x = self.linear(x) x = 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.utils.data import torch.nn as nn from typing import * assert_size_s...
kuleshov/multivariate-deep-learning
AR
false
12,699
[ "MIT" ]
0
c87bf321a13fdb44c22decf6f685296b8f637a67
https://github.com/kuleshov/multivariate-deep-learning/tree/c87bf321a13fdb44c22decf6f685296b8f637a67
SoftNLL
import torch import torch.nn as nn class SoftNLL(nn.Module): def __init__(self): """The `soft' version of negative_log_likelihood, where y is a distribution over classes rather than a one-hot coding """ super(SoftNLL, self).__init__() def forward(self, input, targ...
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...
lehgtrung/gcn-over-pruned-trees
SoftNLL
false
12,700
[ "Apache-2.0" ]
0
ebf0de0948883009a9bebb8ff336e8d6fe50a26f
https://github.com/lehgtrung/gcn-over-pruned-trees/tree/ebf0de0948883009a9bebb8ff336e8d6fe50a26f
GlobalMaxPool1d
import torch from torch import nn class GlobalMaxPool1d(nn.Module): """Performs global max pooling over the entire length of a batched 1D tensor # Arguments input: Input tensor """ def forward(self, input): return nn.functional.max_pool1d(input, kernel_size=input.size()[2:] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
liaoweiduo/few-shot
GlobalMaxPool1d
false
12,701
[ "MIT" ]
0
24d54fa3b472194b8cdab0ec6017bc5f649380a0
https://github.com/liaoweiduo/few-shot/tree/24d54fa3b472194b8cdab0ec6017bc5f649380a0
LearnedPositionalEmbedding
import torch import torch.nn as nn import torch.nn.functional as F class LearnedPositionalEmbedding(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting based on padding_idx or by setting padding_idx to None and ensuring 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
leeharry92/esm
LearnedPositionalEmbedding
false
12,702
[ "MIT" ]
0
7d0feccf03ebbdeba4e7ba0f21d934099a0223ce
https://github.com/leeharry92/esm/tree/7d0feccf03ebbdeba4e7ba0f21d934099a0223ce
MSELoss2d
import torch import torch.nn as nn class MSELoss2d(nn.Module): def __init__(self, size_average=None, reduce=None, reduction='mean', ignore_index=255): super(MSELoss2d, self).__init__() self.MSE = nn.MSELoss(size_average=size_average, reduce=reduce, reduction=reduction) 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
leo-hao/DACS
MSELoss2d
false
12,703
[ "MIT" ]
0
9fe9bc077a9a0e0fd2b118bfc2d522c2b6fb624e
https://github.com/leo-hao/DACS/tree/9fe9bc077a9a0e0fd2b118bfc2d522c2b6fb624e
ShiftedConv
import math import torch import torch.nn as nn from numpy import prod def getLayerNormalizationFactor(x): """ Get He's constant for the given layer https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf """ size = x.weight.size() fan_in = pro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn from numpy import prod assert_size_stride = to...
leo19941227/CPC_audio
ShiftedConv
false
12,704
[ "MIT" ]
0
2d0051915f4b4a5f773e4510cd5535e1fcb433d8
https://github.com/leo19941227/CPC_audio/tree/2d0051915f4b4a5f773e4510cd5535e1fcb433d8
_Hsigmoid
import torch import torch.nn as nn class _Hsigmoid(nn.Module): def __init__(self, inplace=True): super(_Hsigmoid, self).__init__() self.relu6 = nn.ReLU6(inplace) def forward(self, x): return self.relu6(x + 3.0) / 6.0 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
hzwangjl/Lightweight-Segmentation
_Hsigmoid
false
12,705
[ "Apache-2.0" ]
0
3a476719bdfee653ac1e1617c22714b7ee932cef
https://github.com/hzwangjl/Lightweight-Segmentation/tree/3a476719bdfee653ac1e1617c22714b7ee932cef
TransposedConvModel
import torch import torch.nn import torch.utils.data import torch.utils.tensorboard._pytorch_graph import torch.onnx.symbolic_caffe2 class TransposedConvModel(torch.nn.Module): def __init__(self): super(TransposedConvModel, self).__init__() self.conv1 = torch.nn.ConvTranspose2d(10, 10, 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 import torch....
arjunsuresh/aimet
TransposedConvModel
false
12,706
[ "BSD-3-Clause" ]
0
f6e09cb07a91eed3a5e6b8e19e6b065303af5a39
https://github.com/arjunsuresh/aimet/tree/f6e09cb07a91eed3a5e6b8e19e6b065303af5a39
ln_mod
import torch import torch.nn as nn from torch.nn.parameter import Parameter class ln_mod(nn.Module): def __init__(self, nx, eps=1e-05): super().__init__() self.eps = eps self.weight = Parameter(torch.Tensor(nx)) def forward(self, x): return x / torch.sqrt(torch.std(x, axis=-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.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
lienghongky/image-gpt2
ln_mod
false
12,707
[ "MIT" ]
0
ef9f3c61d4a09cbb75114dd067d0014948e82d7b
https://github.com/lienghongky/image-gpt2/tree/ef9f3c61d4a09cbb75114dd067d0014948e82d7b
TemperatureHolder
import torch from torch import nn class TemperatureHolder(nn.Module): """Module that holds a temperature as a learnable value. Args: initial_log_temperature (float): Initial value of log(temperature). """ def __init__(self, initial_log_temperature=0): super().__init__() self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
lin826/pfrl
TemperatureHolder
false
12,708
[ "MIT" ]
0
62d7f13b854f1879211a386fd870a7db982cc8ec
https://github.com/lin826/pfrl/tree/62d7f13b854f1879211a386fd870a7db982cc8ec
InnerProductNetwork
import torch import torch.utils.data class InnerProductNetwork(torch.nn.Module): def forward(self, x): """ :param x: Float tensor of size ``(batch_size, num_fields, embed_dim)`` """ num_fields = x.shape[1] row, col = list(), list() for i in range(num_fields - 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
lipmedusea/pytorch
InnerProductNetwork
false
12,709
[ "MIT" ]
0
5d94694b9e1193a93dd7f75ea2042b5a1cf178bc
https://github.com/lipmedusea/pytorch/tree/5d94694b9e1193a93dd7f75ea2042b5a1cf178bc
FCLateActionSAQFunction
import torch import numpy as np from torch import nn from abc import ABCMeta from abc import abstractmethod import torch.nn.functional as F def init_lecun_normal(tensor, scale=1.0): """Initializes the tensor with LeCunNormal.""" fan_in = torch.nn.init._calculate_correct_fan(tensor, 'fan_in') std = scale *...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np from torch...
lin826/pfrl
FCLateActionSAQFunction
false
12,710
[ "MIT" ]
0
62d7f13b854f1879211a386fd870a7db982cc8ec
https://github.com/lin826/pfrl/tree/62d7f13b854f1879211a386fd870a7db982cc8ec
TimeEncode
import torch import numpy as np class TimeEncode(torch.nn.Module): def __init__(self, dimension): super(TimeEncode, self).__init__() self.dimension = dimension self.w = torch.nn.Linear(1, dimension) self.w.weight = torch.nn.Parameter(torch.from_numpy(1 / 10 ** np. lins...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
linhthi/tgn
TimeEncode
false
12,711
[ "Apache-2.0" ]
0
bb83f82d89aba07d07da3b173803fb0df32ebbbc
https://github.com/linhthi/tgn/tree/bb83f82d89aba07d07da3b173803fb0df32ebbbc
MergeLayer
import torch class MergeLayer(torch.nn.Module): def __init__(self, dim1, dim2, dim3, dim4): super().__init__() self.fc1 = torch.nn.Linear(dim1 + dim2, dim3) self.fc2 = torch.nn.Linear(dim3, dim4) self.act = torch.nn.ReLU() torch.nn.init.xavier_normal_(self.fc1.weight) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
linhthi/tgn
MergeLayer
false
12,712
[ "Apache-2.0" ]
0
bb83f82d89aba07d07da3b173803fb0df32ebbbc
https://github.com/linhthi/tgn/tree/bb83f82d89aba07d07da3b173803fb0df32ebbbc
MLP
import torch class MLP(torch.nn.Module): def __init__(self, dim, drop=0.3): super().__init__() self.fc_1 = torch.nn.Linear(dim, 80) self.fc_2 = torch.nn.Linear(80, 10) self.fc_3 = torch.nn.Linear(10, 1) self.act = torch.nn.ReLU() self.dropout = torch.nn.Dropout(p=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 assert_size_stride = torch._C...
linhthi/tgn
MLP
false
12,713
[ "Apache-2.0" ]
0
bb83f82d89aba07d07da3b173803fb0df32ebbbc
https://github.com/linhthi/tgn/tree/bb83f82d89aba07d07da3b173803fb0df32ebbbc
ModuleForDdpCommHook
import torch import torch.nn import torch.utils.data.distributed import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.cuda import torch.cuda.nccl import torch.backends.cudnn import torch.backends.mkl class Task(nn.Module): def __init__(self): super().__in...
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 import torch.utils.data.distributed import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.dat...
lipovsek/bagua
ModuleForDdpCommHook
false
12,714
[ "MIT" ]
0
d8b03333ab6cf3745279311b9da76e99d5c2c00a
https://github.com/lipovsek/bagua/tree/d8b03333ab6cf3745279311b9da76e99d5c2c00a
RMSEFeaturesLoss
import torch import torch.nn as nn import torch.utils.data def rmseOnFeatures(feature_difference): gt = torch.zeros_like(feature_difference) return torch.nn.functional.mse_loss(feature_difference, gt, size_average=False) class RMSEFeaturesLoss(nn.Module): def __init__(self): super(RMSEF...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
liruihui/learning3d
RMSEFeaturesLoss
false
12,715
[ "MIT" ]
0
d513fb0956926f92c185594d4e236d26ecc7e81e
https://github.com/liruihui/learning3d/tree/d513fb0956926f92c185594d4e236d26ecc7e81e
LNN
import math import torch import torch.utils.data import torch.nn.functional as F class LNN(torch.nn.Module): """ A pytorch implementation of LNN layer Input shape - A 3D tensor with shape: ``(batch_size,field_size,embedding_size)``. Output shape - 2D tensor with shape:``(batch_size,LNN...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lipmedusea/pytorch
LNN
false
12,716
[ "MIT" ]
0
5d94694b9e1193a93dd7f75ea2042b5a1cf178bc
https://github.com/lipmedusea/pytorch/tree/5d94694b9e1193a93dd7f75ea2042b5a1cf178bc
ConvNet
import torch import torch.nn import torch.utils.data.distributed import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.cuda import torch.cuda.nccl import torch.backends.cudnn import torch.backends.mkl class ConvNet(nn.Module): def __init__(self, gpus, layouts, dty...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.utils.data.distributed import torch.nn as nn import...
lipovsek/bagua
ConvNet
false
12,717
[ "MIT" ]
0
d8b03333ab6cf3745279311b9da76e99d5c2c00a
https://github.com/lipovsek/bagua/tree/d8b03333ab6cf3745279311b9da76e99d5c2c00a
Task
import torch import torch.nn import torch.utils.data.distributed import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.cuda import torch.cuda.nccl import torch.backends.cudnn import torch.backends.mkl class Task(nn.Module): def __init__(self): super().__in...
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 import torch.utils.data.distributed import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.dat...
lipovsek/bagua
Task
false
12,718
[ "MIT" ]
0
d8b03333ab6cf3745279311b9da76e99d5c2c00a
https://github.com/lipovsek/bagua/tree/d8b03333ab6cf3745279311b9da76e99d5c2c00a
EncoderLayer
import math import torch import torch.nn as nn from typing import Optional from typing import List class FeedForward(nn.Module): """ ## FFN module """ def __init__(self, d_model: 'int', d_ff: 'int', dropout: 'float'=0.1, activation=nn.ReLU(), is_gated: 'bool'=False, bias: 'bool'=True, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jamesYu365/Transfomer-example
EncoderLayer
false
12,720
[ "MIT" ]
0
a867f72f539de9746668da411f524dab45ddf12f
https://github.com/jamesYu365/Transfomer-example/tree/a867f72f539de9746668da411f524dab45ddf12f
AGRUCell
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class AGRUCell(nn.Module): """ Attention based GRU (AGRU) Reference: - Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018. """ def __...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
liyunrui/DeepCTR-Torch
AGRUCell
false
12,721
[ "Apache-2.0" ]
0
392fd6d39d9ca0ac854022136cdb4d5c68e3a592
https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592
CosineBasisLinear
import torch import numpy as np from torch import nn def cosine_basis_functions(x, n_basis_functions=64): """Cosine basis functions used to embed quantile thresholds. Args: x (torch.Tensor): Input. n_basis_functions (int): Number of cosine basis functions. Returns: ndarray: Embed...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
lin826/pfrl
CosineBasisLinear
false
12,722
[ "MIT" ]
0
62d7f13b854f1879211a386fd870a7db982cc8ec
https://github.com/lin826/pfrl/tree/62d7f13b854f1879211a386fd870a7db982cc8ec
FM
import torch import torch.nn as nn from sklearn.metrics import * class FM(nn.Module): """Factorization Machine models pairwise (order-2) feature interactions without linear term and bias. Input shape - 3D tensor with shape: ``(batch_size,field_size,embedding_size)``. Output shape ...
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 from sklearn.metrics import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
liyunrui/DeepCTR-Torch
FM
false
12,723
[ "Apache-2.0" ]
0
392fd6d39d9ca0ac854022136cdb4d5c68e3a592
https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592
CrossEntropyLossLabelSmoothing
import torch import torch.utils.data from torch import nn import torch.nn.functional as F def _is_long(x): if hasattr(x, 'data'): x = x.data return isinstance(x, torch.LongTensor) or isinstance(x, torch.LongTensor) def onehot(indexes, N=None, ignore_index=None): """ Creates a one-representat...
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...
litvinich/detectron2
CrossEntropyLossLabelSmoothing
false
12,724
[ "Apache-2.0" ]
0
ac622e22eb0f13c9b5838a1e45b046212f22f814
https://github.com/litvinich/detectron2/tree/ac622e22eb0f13c9b5838a1e45b046212f22f814
PointLoss
import torch import torch.nn.parallel import torch.utils.data import torch.nn as nn def array2samples_distance(array1, array2): """ arguments: array1: the array, size: (num_point, num_feature) array2: the samples, size: (num_point, num_feature) returns: distances: each entry is th...
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.parallel import torch.utils.data import torch.nn as nn assert_size_stride...
liuyuex97/PF-Net-Point-Fractal-Network
PointLoss
false
12,725
[ "MIT" ]
0
97f248a03bcd33828e8e2175ec79bbe8c791952d
https://github.com/liuyuex97/PF-Net-Point-Fractal-Network/tree/97f248a03bcd33828e8e2175ec79bbe8c791952d
InteractingLayer
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class InteractingLayer(nn.Module): """A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism. Input shape - A 3D tensor with 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
liyunrui/DeepCTR-Torch
InteractingLayer
false
12,726
[ "Apache-2.0" ]
0
392fd6d39d9ca0ac854022136cdb4d5c68e3a592
https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592
DownConv
import torch import torch.nn as nn 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 DownConv(nn.Module): "...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
loftiskg/unet-pytorch
DownConv
false
12,727
[ "MIT" ]
0
38ddc3ddc3b00bfd575212484e05df1745504e5c
https://github.com/loftiskg/unet-pytorch/tree/38ddc3ddc3b00bfd575212484e05df1745504e5c
TransformerLayer
import math import torch import uuid from torch import Tensor import torch.nn as nn from typing import Tuple import torch.nn.functional as F from typing import Optional from typing import Dict from torch.nn import Parameter def gelu(x): """Implementation of the gelu activation function. For information: Open...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
leeharry92/esm
TransformerLayer
false
12,728
[ "MIT" ]
0
7d0feccf03ebbdeba4e7ba0f21d934099a0223ce
https://github.com/leeharry92/esm/tree/7d0feccf03ebbdeba4e7ba0f21d934099a0223ce
CrossNet
import torch import torch.nn as nn from sklearn.metrics import * class CrossNet(nn.Module): """The Cross Network part of Deep&Cross Network model, which leans both low and high degree cross feature. Input shape - 2D tensor with shape: ``(batch_size, units)``. Output shape - 2D tens...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from sklearn.metrics import * assert_size_stride = torch._...
liyunrui/DeepCTR-Torch
CrossNet
false
12,729
[ "Apache-2.0" ]
0
392fd6d39d9ca0ac854022136cdb4d5c68e3a592
https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592
piNetwork
import torch import torch.nn as nn class piNetwork(nn.Module): def __init__(self, input_size, hidden_size1, hidden_size2, action_size): super(piNetwork, self).__init__() self.l1 = nn.Linear(input_size, hidden_size1) self.l2 = nn.Linear(hidden_size1, hidden_size2) self.l3 = nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
lolcharles2/TetrisReinforcementLearning
piNetwork
false
12,730
[ "MIT" ]
0
5e3d5035732a19681aca57f025d8378a8fc119e8
https://github.com/lolcharles2/TetrisReinforcementLearning/tree/5e3d5035732a19681aca57f025d8378a8fc119e8
KLDivLossWithLogits
import torch import torch.utils.data import torch from torchvision.transforms import functional as F from torch import nn from torch.nn import functional as F class AbstractConsistencyLoss(nn.Module): def __init__(self, reduction='mean'): super().__init__() self.reduction = reduction def for...
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...
lizhenbang56/END-TO-END-TEMPORAL-FEATURE-AGGREGATION-FOR-SIAMESE-TRACKERS
KLDivLossWithLogits
false
12,731
[ "MIT" ]
0
132b2e28b7f66c6ba0719774e9abd9b6515dd7e2
https://github.com/lizhenbang56/END-TO-END-TEMPORAL-FEATURE-AGGREGATION-FOR-SIAMESE-TRACKERS/tree/132b2e28b7f66c6ba0719774e9abd9b6515dd7e2
PreNet
import torch from torch import nn import torch.nn.functional as F class PreNet(nn.Module): def __init__(self, in_dims, fc1_dims=256, fc2_dims=128, dropout=0.5): super().__init__() self.fc1 = nn.Linear(in_dims, fc1_dims) self.fc2 = nn.Linear(fc1_dims, fc2_dims) self.p = dropout ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
lsh950919/sv2tts
PreNet
false
12,733
[ "MIT" ]
0
a6ff637ac478b8b3ce4dcc5a776442cab9cbdd67
https://github.com/lsh950919/sv2tts/tree/a6ff637ac478b8b3ce4dcc5a776442cab9cbdd67
AxialPositionalEmbedding
import torch from torch import nn class AxialPositionalEmbedding(nn.Module): def __init__(self, dim, shape, emb_dim_index=1): super().__init__() total_dimensions = len(shape) + 2 ax_dim_indexes = [i for i in range(1, total_dimensions) if i != emb_dim_index] self.num_ax...
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...
lukeleeai/metnet
AxialPositionalEmbedding
false
12,734
[ "MIT" ]
0
1dc0bf11780f413f3d55207866e0fa921b8aa60d
https://github.com/lukeleeai/metnet/tree/1dc0bf11780f413f3d55207866e0fa921b8aa60d
AUGRUCell
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class AUGRUCell(nn.Module): """ Effect of GRU with attentional update gate (AUGRU) Reference: - Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
liyunrui/DeepCTR-Torch
AUGRUCell
false
12,735
[ "Apache-2.0" ]
0
392fd6d39d9ca0ac854022136cdb4d5c68e3a592
https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592
SmallMnist
import torch import torch.nn as nn import torch.nn import torch.utils.data import torch.utils.tensorboard._pytorch_graph import torch.onnx.symbolic_caffe2 class SmallMnist(nn.Module): def __init__(self): super(SmallMnist, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) 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....
arjunsuresh/aimet
SmallMnist
false
12,736
[ "BSD-3-Clause" ]
0
f6e09cb07a91eed3a5e6b8e19e6b065303af5a39
https://github.com/arjunsuresh/aimet/tree/f6e09cb07a91eed3a5e6b8e19e6b065303af5a39
AFMLayer
import itertools import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class AFMLayer(nn.Module): """Attentonal Factorization Machine models pairwise (order-2) feature interactions without linear term and bias. Input shape - A list of 3D tensor with sha...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
liyunrui/DeepCTR-Torch
AFMLayer
false
12,737
[ "Apache-2.0" ]
0
392fd6d39d9ca0ac854022136cdb4d5c68e3a592
https://github.com/liyunrui/DeepCTR-Torch/tree/392fd6d39d9ca0ac854022136cdb4d5c68e3a592
Classifier
import torch import torch.nn.functional as F from torch import nn class Classifier(nn.Module): """ Inherits Class information from the nn.Module and creates a Classifier Class: - Class has these attributes: o fully connected layer with specified number of in_features and out_features ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lukeahwilson/udacity-final-project
Classifier
false
12,738
[ "MIT" ]
0
c5df25e2135b1dfdb3458d82c562979432480f5d
https://github.com/lukeahwilson/udacity-final-project/tree/c5df25e2135b1dfdb3458d82c562979432480f5d
SeparableConv1D
import torch from torch import nn class SeparableConv1D(nn.Module): """Depthwise separable 1D convolution. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. kernel_size (int): Size of the convolving kernel. stride (int): Stride o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
johnjosephmorgan/snowfall
SeparableConv1D
false
12,739
[ "Apache-2.0" ]
0
604d789c0aed035626d6745e6d7a427168063cae
https://github.com/johnjosephmorgan/snowfall/tree/604d789c0aed035626d6745e6d7a427168063cae
Homography
import torch import torch.nn as nn class Homography(nn.Module): """Homography geometric model to be used together with ImageRegistrator module for the optimization-based image registration.""" def __init__(self) ->None: super().__init__() self.model = nn.Parameter(torch.eye(3)) ...
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...
lyhyl/kornia
Homography
false
12,740
[ "ECL-2.0", "Apache-2.0" ]
0
5bd3aeb0d54dedac01e6eaf8bac37779bab0bec5
https://github.com/lyhyl/kornia/tree/5bd3aeb0d54dedac01e6eaf8bac37779bab0bec5
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...
lbasora/DCC
DCCWeightedELoss
false
12,741
[ "MIT" ]
0
c9abcd7d697cc9e50e874286f1edfb3be93ce6d9
https://github.com/lbasora/DCC/tree/c9abcd7d697cc9e50e874286f1edfb3be93ce6d9
Hflip
import torch import torch.nn as nn def hflip(input: 'torch.Tensor') ->torch.Tensor: """Horizontally flip a tensor image or a batch of tensor images. .. image:: _static/img/hflip.png Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: input: input tens...
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...
lyhyl/kornia
Hflip
false
12,742
[ "ECL-2.0", "Apache-2.0" ]
0
5bd3aeb0d54dedac01e6eaf8bac37779bab0bec5
https://github.com/lyhyl/kornia/tree/5bd3aeb0d54dedac01e6eaf8bac37779bab0bec5
ConditionTime
import torch from torch import nn def condition_time(x, i=0, size=(12, 16), seq_len=15): """create one hot encoded time image-layers, i in [1, seq_len]""" assert i < seq_len times = torch.eye(seq_len, dtype=x.dtype, device=x.device)[i].unsqueeze(-1 ).unsqueeze(-1) ones = torch.ones(1, *size, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
lukeleeai/metnet
ConditionTime
false
12,743
[ "MIT" ]
0
1dc0bf11780f413f3d55207866e0fa921b8aa60d
https://github.com/lukeleeai/metnet/tree/1dc0bf11780f413f3d55207866e0fa921b8aa60d
DotProductAttention
import math import torch from torch import nn def masked_softmax(X, valid_lens): """Perform softmax operation by masking elements on the last axis.""" if valid_lens is None: return nn.functional.softmax(X, dim=-1) else: shape = X.shape if valid_lens.dim() == 1: valid_le...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lucmertins/CapDeepLearningBook
DotProductAttention
false
12,744
[ "MIT" ]
0
e5959b552c8716e7fc65a21ae9c13c58509544c1
https://github.com/lucmertins/CapDeepLearningBook/tree/e5959b552c8716e7fc65a21ae9c13c58509544c1
PDController
import torch class PDController(torch.nn.Module): def __init__(self): super(PDController, self).__init__() def forward(self, kp, kd, position, velocity, des_position, des_velocity): return kp * (des_position - position) + kd * (des_velocity - velocity) def get_inputs(): return [torch.r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
machines-in-motion/dg_pytorch
PDController
false
12,745
[ "BSD-3-Clause" ]
0
c8c9bd1ee50b817017a075a60762a5d9678c5c07
https://github.com/machines-in-motion/dg_pytorch/tree/c8c9bd1ee50b817017a075a60762a5d9678c5c07
ConvGRUCell
import torch from torch import nn import torch.nn.functional as F def one_param(m): """First parameter in `m`""" return next(m.parameters()) class ConvGRUCell(nn.Module): def __init__(self, input_dim, hidden_dim, kernel_size=(3, 3), bias=True, activation=F.tanh, batchnorm=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.triton_helpers import libdevice from torch import n...
lukeleeai/metnet
ConvGRUCell
false
12,746
[ "MIT" ]
0
1dc0bf11780f413f3d55207866e0fa921b8aa60d
https://github.com/lukeleeai/metnet/tree/1dc0bf11780f413f3d55207866e0fa921b8aa60d
AttentionPool2d
import math import torch import numpy as np import torch.nn import torch as th import torch.nn as nn def count_flops_attn(model, _x, y): """ A counter for the `thop` package to count the operations in an attention operation. Meant to be used like: macs, params = thop.profile( model...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lukaszbinden/Diffusion-based-Segmentation
AttentionPool2d
false
12,747
[ "Apache-2.0" ]
0
43a475e53320adac82838f87ff7fd71f78d8d004
https://github.com/lukaszbinden/Diffusion-based-Segmentation/tree/43a475e53320adac82838f87ff7fd71f78d8d004
DiscrepancyLossWithLogits
import torch import torch.utils.data import torch from torchvision.transforms import functional as F from torch import nn from torch.nn import functional as F class AbstractConsistencyLoss(nn.Module): def __init__(self, reduction='mean'): super().__init__() self.reduction = reduction def for...
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...
lizhenbang56/END-TO-END-TEMPORAL-FEATURE-AGGREGATION-FOR-SIAMESE-TRACKERS
DiscrepancyLossWithLogits
false
12,748
[ "MIT" ]
0
132b2e28b7f66c6ba0719774e9abd9b6515dd7e2
https://github.com/lizhenbang56/END-TO-END-TEMPORAL-FEATURE-AGGREGATION-FOR-SIAMESE-TRACKERS/tree/132b2e28b7f66c6ba0719774e9abd9b6515dd7e2
D2Remap
import torch class D2Remap(torch.nn.Module): def __init__(self): super(D2Remap, self).__init__() self.l1 = torch.nn.Conv2d(4, 16, kernel_size=3, padding=1) self.l2 = torch.nn.Conv2d(16, 3, kernel_size=3, padding=1) def forward(self, x, depth): stack = torch.cat((x, depth.unsq...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
m4nh/pytorch-retinanet
D2Remap
false
12,749
[ "Apache-2.0" ]
0
2da8db70b754f773aa7c500133cd690c0b4b1839
https://github.com/m4nh/pytorch-retinanet/tree/2da8db70b754f773aa7c500133cd690c0b4b1839
StdConv2d
import torch from torch import nn import torch.nn.functional as F class StdConv2d(nn.Conv2d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False) w = (w - m) / torch.sqrt(v + 1e-10) return F.conv2d(x, w, self.bias, self.strid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
marekb-sci/kaggle_cassava
StdConv2d
false
12,750
[ "Apache-2.0" ]
0
158d1e398e713381c889e071329b96b9c0ba98d2
https://github.com/marekb-sci/kaggle_cassava/tree/158d1e398e713381c889e071329b96b9c0ba98d2
HamidaEtAl
import torch import torch.utils import torch.utils.data import torch.nn as nn import torch.nn.functional as F from torch.nn import init class HamidaEtAl(nn.Module): """ 3-D Deep Learning Approach for Remote Sensing Image Classification Amina Ben Hamida, Alexandre Benoit, Patrick Lambert, Chokri Ben Amar ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 import tor...
giorgosouz/HSI-classification-using-state-of-the-art-models
HamidaEtAl
false
12,751
[ "MIT" ]
0
a925972ffe02c2cd1e5dde2b163e1faa854a4966
https://github.com/giorgosouz/HSI-classification-using-state-of-the-art-models/tree/a925972ffe02c2cd1e5dde2b163e1faa854a4966
CRF_S
import torch import torch.nn as nn import torch.nn.init class CRF_S(nn.Module): """Conditional Random Field (CRF) layer. This version is used in Lample et al. 2016, has less parameters than CRF_L. args: hidden_dim: input dim size tagset_size: target_set_size if_biase: whether allow bi...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.init assert_size_stride = torch._C._dynamo...
markWJJ/LM-LSTM-CRF
CRF_S
false
12,752
[ "Apache-2.0" ]
0
e468974ce2193a5579417f9e253eb6c997932636
https://github.com/markWJJ/LM-LSTM-CRF/tree/e468974ce2193a5579417f9e253eb6c997932636
Policy
import torch import numpy as np from torch import Tensor import torch.nn.functional as F from torch import nn from torch.nn import Linear from torch.autograd import Variable from torch.distributions import Categorical class Policy(nn.Module): def __init__(self, in_sz, hidden_sz, out_sz): super(Policy, 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....
mabirck/CS294-DeepRL
Policy
false
12,753
[ "MIT" ]
0
0445808fa62ae8a22b13c598c998e3aea7632e79
https://github.com/mabirck/CS294-DeepRL/tree/0445808fa62ae8a22b13c598c998e3aea7632e79
Critic
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
makarand-mac/continuous-control
Critic
false
12,754
[ "MIT" ]
0
6563d652770551ad2773e76daa9d536e617df01a
https://github.com/makarand-mac/continuous-control/tree/6563d652770551ad2773e76daa9d536e617df01a
FairDiscriminator
import torch import torch.nn as nn import torch.nn.functional as F class FairDiscriminator(nn.Module): def __init__(self, nfeat, nhid, nclass): """Just a simple MLP""" super(FairDiscriminator, self).__init__() self.hidden_layer = nn.Linear(nfeat, nhid) self.output_layer = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
markheimann/fgc
FairDiscriminator
false
12,755
[ "MIT" ]
0
909d4f0a84c9b61a8030f9f3f50b17f143576007
https://github.com/markheimann/fgc/tree/909d4f0a84c9b61a8030f9f3f50b17f143576007
TransformerDecoderLayer
import torch from torch import Tensor from typing import Optional from torch import nn def _get_activation_fn(activation: 'str'): if activation == 'relu': return nn.functional.relu elif activation == 'gelu': return nn.functional.gelu raise RuntimeError('activation should be relu/gelu, not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
johnjosephmorgan/snowfall
TransformerDecoderLayer
false
12,756
[ "Apache-2.0" ]
0
604d789c0aed035626d6745e6d7a427168063cae
https://github.com/johnjosephmorgan/snowfall/tree/604d789c0aed035626d6745e6d7a427168063cae
CRF
import torch from torch import nn class CRF(nn.Module): def __init__(self, num_nodes, iteration=10): """Initialize the CRF module Args: num_nodes: int, number of nodes/patches within the fully CRF iteration: int, number of mean field iterations, e.g. 10 """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
lzx325/NCRF
CRF
false
12,757
[ "Apache-2.0" ]
0
2fc081184e3bc45b043e4c8c0a94644a0149e54c
https://github.com/lzx325/NCRF/tree/2fc081184e3bc45b043e4c8c0a94644a0149e54c
Attn
import math import torch import torch.nn.functional as F import torch.nn as nn class Attn(nn.Module): def __init__(self, method, hidden_size): super(Attn, self).__init__() self.method = method self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
marvinzh/ConvLab
Attn
false
12,758
[ "MIT" ]
0
45ac46b805e064f783b3a1a409b0902ac81da661
https://github.com/marvinzh/ConvLab/tree/45ac46b805e064f783b3a1a409b0902ac81da661
DilatedResidualLayer
import torch import torch.nn as nn import torch.nn.functional as F class DilatedResidualLayer(nn.Module): def __init__(self, dilation, in_channels, out_channels): super(DilatedResidualLayer, self).__init__() self.conv_dilated = nn.Conv1d(in_channels, out_channels, 3, padding =dilation...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
manthan-kodar/Action-seg-experiments
DilatedResidualLayer
false
12,759
[ "MIT" ]
0
3515ee64082ab567838782f5600e186bf86473a0
https://github.com/manthan-kodar/Action-seg-experiments/tree/3515ee64082ab567838782f5600e186bf86473a0
AddNorm
import torch from torch import nn class AddNorm(nn.Module): def __init__(self, normalized_shape, dropout, **kwargs): super(AddNorm, self).__init__(**kwargs) self.dropout = nn.Dropout(dropout) self.ln = nn.LayerNorm(normalized_shape) def forward(self, X, Y): return self.ln(sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
lucmertins/CapDeepLearningBook
AddNorm
false
12,760
[ "MIT" ]
0
e5959b552c8716e7fc65a21ae9c13c58509544c1
https://github.com/lucmertins/CapDeepLearningBook/tree/e5959b552c8716e7fc65a21ae9c13c58509544c1
TransformerEncoderLayer
import torch from torch import Tensor from typing import Optional from torch import nn def _get_activation_fn(activation: 'str'): if activation == 'relu': return nn.functional.relu elif activation == 'gelu': return nn.functional.gelu raise RuntimeError('activation should be relu/gelu, not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
johnjosephmorgan/snowfall
TransformerEncoderLayer
false
12,761
[ "Apache-2.0" ]
0
604d789c0aed035626d6745e6d7a427168063cae
https://github.com/johnjosephmorgan/snowfall/tree/604d789c0aed035626d6745e6d7a427168063cae
EncoderLayer
import math import torch import torch.nn.functional as F import torch.nn as nn def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) scores = scores.masked_fill(mask == 0, -1000000000.0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
macg0406/Transformer
EncoderLayer
false
12,762
[ "Apache-2.0" ]
0
8c747a6e9f108c63ecc600bf14cde6827b438172
https://github.com/macg0406/Transformer/tree/8c747a6e9f108c63ecc600bf14cde6827b438172