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
DiceLoss
import torch import torch.nn as nn def IoU(logit, truth, smooth=1): prob = torch.sigmoid(logit) intersection = torch.sum(prob * truth) union = torch.sum(prob + truth) iou = (2 * intersection + smooth) / (union + smooth) return iou class DiceLoss(nn.Module): def __init__(self, smooth=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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
evilidol/kaggle-Steel-Defect-Detection
DiceLoss
false
6,666
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
HorizontalMaxPool2d
import torch import torch.nn as nn class HorizontalMaxPool2d(nn.Module): def __init__(self): super(HorizontalMaxPool2d, self).__init__() def forward(self, x): inp_size = x.size() return nn.functional.max_pool2d(input=x, kernel_size=(1, inp_size[3])) def get_inputs(): return [to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
existentmember7/TEMP_monitor
HorizontalMaxPool2d
false
6,667
[ "MIT" ]
1
b8116f4c134793c4caa22eda78f90dd24d0cad30
https://github.com/existentmember7/TEMP_monitor/tree/b8116f4c134793c4caa22eda78f90dd24d0cad30
SpatialGate2d
import torch import torch.nn as nn class SpatialGate2d(nn.Module): def __init__(self, in_channels): super(SpatialGate2d, self).__init__() self.conv1 = nn.Conv2d(in_channels, 1, kernel_size=1, stride=1) self.sigmoid = nn.Sigmoid() def forward(self, x): cal = self.conv1(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...
evilidol/kaggle-Steel-Defect-Detection
SpatialGate2d
false
6,668
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
DiceCELoss
import torch import warnings from typing import Callable from typing import Union from typing import Optional from enum import Enum import torch.nn as nn from torch.nn.modules.loss import _Loss import torch.multiprocessing class LossReduction(Enum): """ See also: - :py:class:`monai.losses.dice.DiceLos...
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 warnings from t...
elitap/classimbalance
DiceCELoss
false
6,669
[ "Apache-2.0" ]
1
ae807ec533da5eef18f4180b29383399bc57696a
https://github.com/elitap/classimbalance/tree/ae807ec533da5eef18f4180b29383399bc57696a
BiasConvFc2Net
import torch import torch.nn as nn class BiasConvFc2Net(nn.Module): def __init__(self, in_channels, groups, n_segment, kernel_size=3, padding=1 ): super(BiasConvFc2Net, self).__init__() self.conv = nn.Conv1d(in_channels, 1, kernel_size, padding=padding) self.fc = nn.Linear(n_segme...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
eynaij/X-Temporal_catdim
BiasConvFc2Net
false
6,670
[ "MIT" ]
1
6a2efba407c09c83ca061c8467c1373b6ed0c7eb
https://github.com/eynaij/X-Temporal_catdim/tree/6a2efba407c09c83ca061c8467c1373b6ed0c7eb
SCse
import torch import torch.nn as nn class GAB(nn.Module): def __init__(self, input_dim, reduction=4): super(GAB, self).__init__() self.global_avgpool = nn.AdaptiveAvgPool2d(1) self.conv1 = nn.Conv2d(input_dim, input_dim // reduction, kernel_size=1, stride=1) self.conv2 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
evilidol/kaggle-Steel-Defect-Detection
SCse
false
6,671
[ "MIT" ]
1
41e3e360f49d706c8c79bcd442342c529648a736
https://github.com/evilidol/kaggle-Steel-Defect-Detection/tree/41e3e360f49d706c8c79bcd442342c529648a736
BertAttention
from _paritybench_helpers import _mock_config import math import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, config, variance_epsilon=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, self)....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
BLimmie/pytorch-pretrained-BERT
BertAttention
false
6,672
[ "Apache-2.0" ]
1
2ac4b29641e569020ed2acc28016f481f617052b
https://github.com/BLimmie/pytorch-pretrained-BERT/tree/2ac4b29641e569020ed2acc28016f481f617052b
WeightConvNet
import torch import torch.nn as nn class WeightConvNet(nn.Module): def __init__(self, in_channels, groups, n_segment): super(WeightConvNet, self).__init__() self.lastlayer = nn.Conv1d(in_channels, groups, 3, padding=1) self.groups = groups def forward(self, x): N, _C, T = x.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...
eynaij/X-Temporal_catdim
WeightConvNet
false
6,673
[ "MIT" ]
1
6a2efba407c09c83ca061c8467c1373b6ed0c7eb
https://github.com/eynaij/X-Temporal_catdim/tree/6a2efba407c09c83ca061c8467c1373b6ed0c7eb
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1e-06): super(DiceLoss, self).__init__() self.smooth = smooth def forward(self, y_pred, y_true): assert y_pred.size() == y_true.size() y_pred = y_pred.contiguous().view(y_pred.shape[0], -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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
fadamsyah/pytorch-brain-mri-segmentation
DiceLoss
false
6,674
[ "MIT" ]
1
bdb310ecacbddfce2cef20d50cf0b638dd1bc7b1
https://github.com/fadamsyah/pytorch-brain-mri-segmentation/tree/bdb310ecacbddfce2cef20d50cf0b638dd1bc7b1
CircleLoss
import torch from torch import Tensor from torch import nn class CircleLoss(nn.Module): def __init__(self, m: 'float', gamma: 'float') ->None: super(CircleLoss, self).__init__() self.m = m self.gamma = gamma self.soft_plus = nn.Softplus() def forward(self, sp: 'Tensor', sn: '...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
fabiozappo/Person_reID_tensorrt
CircleLoss
false
6,675
[ "Apache-2.0" ]
1
164441f35777698274e7664a9aefcc8d54467dc3
https://github.com/fabiozappo/Person_reID_tensorrt/tree/164441f35777698274e7664a9aefcc8d54467dc3
Aggregation
import torch from torch import nn from torch.nn import * class Aggregation(nn.Module): """ Aggregation layer for the Dueling architecture. https://arxiv.org/abs/1511.06581 This layer computes a Q function by combining an estimate of V with an estimate of the advantage. The advantage is normal...
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 from torch.nn import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._d...
ezelikman/autonomous-learning-library
Aggregation
false
6,676
[ "MIT" ]
1
b32d059ca8b191afe0b310102d0754796f391aff
https://github.com/ezelikman/autonomous-learning-library/tree/b32d059ca8b191afe0b310102d0754796f391aff
Entropy
import torch from torch import nn class Entropy(nn.Module): def __init__(self): super(Entropy, self).__init__() def forward(self, x): plogp = x * torch.log(x) plogp[plogp != plogp] = 0 return -torch.sum(plogp, dim=-1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
fallcat/synst
Entropy
false
6,677
[ "BSD-3-Clause" ]
1
0fa4adffa825af4a62b6e739b59c4125a7b6698e
https://github.com/fallcat/synst/tree/0fa4adffa825af4a62b6e739b59c4125a7b6698e
QuaternionLinear
from torch.nn import Module import torch import numpy as np from numpy.random import RandomState from torch.autograd import Variable from torch.nn.parameter import Parameter from scipy.stats import chi import torch.fx def quaternion_init(in_features, out_features, rng, kernel_size=None, criterion='glorot'): 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.nn import Module import numpy as np from numpy.random import RandomSt...
eleGAN23/HI2I
QuaternionLinear
false
6,678
[ "MIT" ]
1
7730ee0963614290099b011c113048ef6d1b149c
https://github.com/eleGAN23/HI2I/tree/7730ee0963614290099b011c113048ef6d1b149c
MultiHeadedAttention
import torch from torch import nn from torch.nn import functional as F def same_tensor(tensor, *args): """ Do the input tensors all point to the same underlying data """ for other in args: if not torch.is_tensor(other): return False if tensor.device != other.device: ret...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
fallcat/synst
MultiHeadedAttention
false
6,679
[ "BSD-3-Clause" ]
1
0fa4adffa825af4a62b6e739b59c4125a7b6698e
https://github.com/fallcat/synst/tree/0fa4adffa825af4a62b6e739b59c4125a7b6698e
MultiLayeredConv1d
import torch import torch.nn 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 in `FastSpeech: Fast, Robust and Controllable Tex...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 assert_size_s...
fancyliumeng/asv-subtools
MultiLayeredConv1d
false
6,680
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
LDEPooling
import torch import torch.nn class LDEPooling(torch.nn.Module): """A novel learnable dictionary encoding layer according to [Weicheng Cai, etc., "A NOVEL LEARNABLE DICTIONARY ENCODING LAYER FOR END-TO-END LANGUAGE IDENTIFICATION", icassp, 2018]""" def __init__(self, input_dim, c_num=64): super(L...
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 assert...
fancyliumeng/asv-subtools
LDEPooling
false
6,681
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
Conv1dLinear
import torch import torch.nn class Conv1dLinear(torch.nn.Module): """Conv1D + Linear for Transformer block. A variant of MultiLayeredConv1d, which replaces second conv-layer to linear. """ def __init__(self, in_chans, hidden_chans, kernel_size, dropout_rate): """Initialize Conv1dLinear modu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 assert_size_s...
fancyliumeng/asv-subtools
Conv1dLinear
false
6,682
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
TdnnAffine
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
fancyliumeng/asv-subtools
TdnnAffine
false
6,683
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
UpBlok
import torch import torch.nn as nn import torch.nn.functional as F class UpBlok(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv1x1 = nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0) self.conv3x3 = nn.Conv2d(in_chan...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
fendaq/TextRSN
UpBlok
false
6,684
[ "MIT" ]
1
02a6bc06cd64b581414ed5065a8c93e0c68a807a
https://github.com/fendaq/TextRSN/tree/02a6bc06cd64b581414ed5065a8c93e0c68a807a
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_dim): super(Critic, self).__init__() self.fc1 = nn.Linear(state_dim, 256) self.fc2 = nn.Linear(256, 256) self.fc3 = nn.Linear(256, 1) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
fengzhengyong-github/Deep-reinforcement-learning-with-pytorch
Critic
false
6,685
[ "MIT" ]
1
3c56b601d14b0b0c8cde4b6bc6df5c1e8f298c7b
https://github.com/fengzhengyong-github/Deep-reinforcement-learning-with-pytorch/tree/3c56b601d14b0b0c8cde4b6bc6df5c1e8f298c7b
ScaledDotProductAttention
import torch import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout: 'float'=0.0) ->None: super(ScaledDotProductAttention, self).__init__() self._dropout = nn.Dropout(dropout) self._softmax = nn.Softmax(dim=2) def forward(self, query: 'torch.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
fengtaoo/opmft
ScaledDotProductAttention
false
6,686
[ "MIT" ]
1
64f2a12c724295cd913eda02502f2e2a20f2dd55
https://github.com/fengtaoo/opmft/tree/64f2a12c724295cd913eda02502f2e2a20f2dd55
L_TV
import torch import torch.nn as nn import torch.optim class L_TV(nn.Module): def __init__(self, TVLoss_weight=1): super(L_TV, self).__init__() self.TVLoss_weight = TVLoss_weight def forward(self, x): batch_size = x.size()[0] h_x = x.size()[2] w_x = x.size()[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 import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
farhantandia/Applied-CV-Zero-DCE-master
L_TV
false
6,687
[ "MIT" ]
1
56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
https://github.com/farhantandia/Applied-CV-Zero-DCE-master/tree/56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
PixelNormLayer
import torch import torch.nn as nn class PixelNormLayer(nn.Module): """ Pixelwise feature vector normalization. """ def __init__(self, eps=1e-08): super(PixelNormLayer, self).__init__() self.eps = eps def forward(self, x): return x / torch.sqrt(torch.mean(x ** 2, dim=1, k...
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_...
ferngonzalezp/turbulence-GAN
PixelNormLayer
false
6,688
[ "MIT" ]
1
a215a3c5af2dc9a723f95c344e295ecc08954f26
https://github.com/ferngonzalezp/turbulence-GAN/tree/a215a3c5af2dc9a723f95c344e295ecc08954f26
CNN
import torch from torch.nn import functional as F from torch import nn class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(3, 8, 6, 1) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(8, 16, 6, 1) self.conv3 = nn.Conv2d(16, 24,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
eosay/robotCNN
CNN
false
6,689
[ "MIT" ]
1
9eaefcc223e868c01f6d1a49a28d2a9f392857e5
https://github.com/eosay/robotCNN/tree/9eaefcc223e868c01f6d1a49a28d2a9f392857e5
SequenceBias
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from torch.nn.parameter import Parameter class SequenceBias(nn.Module): """ Adds one bias element to the end of the sequence. so if the input has a shape ``(L, N, E)``, where ``L`` i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from torch.nn.parameter import Pa...
ffuuugor/opacus
SequenceBias
false
6,690
[ "Apache-2.0" ]
1
2048a6e92902685c2a735e9fb7c0d48b4846b494
https://github.com/ffuuugor/opacus/tree/2048a6e92902685c2a735e9fb7c0d48b4846b494
SoftmaxAffineLayer
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
fancyliumeng/asv-subtools
SoftmaxAffineLayer
false
6,691
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
MLPLayer
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class MLPLayer(nn.Module): """ Head for getting sentence representations over RoBERTa/BERT's CLS representation. """ def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
BDBC-KG-NLP/MixCSE_AAAI2022
MLPLayer
false
6,692
[ "MIT" ]
1
884145e24a5258c044fedb658df9999f012df875
https://github.com/BDBC-KG-NLP/MixCSE_AAAI2022/tree/884145e24a5258c044fedb658df9999f012df875
SEBlock
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.functional as...
fancyliumeng/asv-subtools
SEBlock
false
6,693
[ "Apache-2.0" ]
1
56a13484472e7ae6eb00d762c00d57e581e78eb4
https://github.com/fancyliumeng/asv-subtools/tree/56a13484472e7ae6eb00d762c00d57e581e78eb4
MultiheadAttention
import torch import torch.nn.functional as F import torch.utils.data import torch.distributed import torch.nn as nn from torch.nn import Parameter import torch.optim import torch.optim.lr_scheduler class MultiheadAttention(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for more detail...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
farhanazareen/Fairseq
MultiheadAttention
false
6,694
[ "BSD-3-Clause" ]
1
39c7b6804b4a3426ef23b30f3ca8a3c0a9948079
https://github.com/farhanazareen/Fairseq/tree/39c7b6804b4a3426ef23b30f3ca8a3c0a9948079
DPLSTMCell
import math import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Optional from typing import Tuple class LSTMLinear(nn.Linear): """ This function is the same as a nn.Linear layer, except that in the backward pass the gra...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
ffuuugor/opacus
DPLSTMCell
false
6,695
[ "Apache-2.0" ]
1
2048a6e92902685c2a735e9fb7c0d48b4846b494
https://github.com/ffuuugor/opacus/tree/2048a6e92902685c2a735e9fb7c0d48b4846b494
ResidualBlock
import torch import torch.nn as nn def conv3x3(in_ch, out_ch, stride=1): """3x3 convolution with padding.""" return nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=stride, padding=1) class ResidualBlock(nn.Module): """Simple residual block with two 3x3 convolutions. Args: in_ch (int): number...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
fqhank/HESIC
ResidualBlock
false
6,696
[ "Apache-2.0" ]
1
f15cb8e6822af45f0022ea4887fce915e250ed75
https://github.com/fqhank/HESIC/tree/f15cb8e6822af45f0022ea4887fce915e250ed75
AdaIN
import torch import torch.nn as nn class AdaIN(nn.Module): def __init__(self, style_dim, num_features): super().__init__() self.norm = nn.InstanceNorm2d(num_features, affine=False) self.fc = nn.Linear(style_dim, num_features * 2) def forward(self, x, s): h = self.fc(s) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
fpaupier/stargan-v2
AdaIN
false
6,697
[ "MIT" ]
1
18d2e04ed6e6df963b84345e798d94383757aaa2
https://github.com/fpaupier/stargan-v2/tree/18d2e04ed6e6df963b84345e798d94383757aaa2
SelfAttention
import math import torch import torch.nn as nn from torch.nn import init def weights_init(init_type='gaussian'): def init_fun(m): classname = m.__class__.__name__ if (classname.find('Conv') == 0 or classname.find('Linear') == 0 ) and hasattr(m, 'weight'): if init_type == '...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
fanyix/flownet2
SelfAttention
false
6,698
[ "Apache-2.0" ]
1
0643beef59eeaf4cf4907d0d51f486ffd713363f
https://github.com/fanyix/flownet2/tree/0643beef59eeaf4cf4907d0d51f486ffd713363f
dense_warp
import torch import torch.nn as nn class dense_warp(nn.Module): def __init__(self): super().__init__() def forward(self, h1, cost): g2 = torch.zeros_like(h1) clone_h1 = h1.detach() if h1.device.type == 'cuda': g2 = g2 clone_h1 = clone_h1 for 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
fqhank/HESIC
dense_warp
false
6,699
[ "Apache-2.0" ]
1
f15cb8e6822af45f0022ea4887fce915e250ed75
https://github.com/fqhank/HESIC/tree/f15cb8e6822af45f0022ea4887fce915e250ed75
KernelMatcher
import torch from typing import Dict import torch.nn as nn import torch.nn.functional as F class KernelMatcher(nn.Module): def __init__(self, embed_dim: 'int', kernel_num: 'int'=21) ->None: super(KernelMatcher, self).__init__() self._embed_dim = embed_dim self._kernel_num = kernel_num ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
fengtaoo/opmft
KernelMatcher
false
6,700
[ "MIT" ]
1
64f2a12c724295cd913eda02502f2e2a20f2dd55
https://github.com/fengtaoo/opmft/tree/64f2a12c724295cd913eda02502f2e2a20f2dd55
ResBlk
import math import torch import torch.nn as nn import torch.nn.functional as F def normalize(x, eps=1e-06): """Apply min-max normalization.""" x = x.contiguous() N, C, H, W = x.size() x_ = x.view(N * C, -1) max_val = torch.max(x_, dim=1, keepdim=True)[0] min_val = torch.min(x_, dim=1, keepdim=...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
fpaupier/stargan-v2
ResBlk
false
6,701
[ "MIT" ]
1
18d2e04ed6e6df963b84345e798d94383757aaa2
https://github.com/fpaupier/stargan-v2/tree/18d2e04ed6e6df963b84345e798d94383757aaa2
Enhancement_Block
import torch import torch.nn as nn def conv3x3(in_ch, out_ch, stride=1): """3x3 convolution with padding.""" return nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=stride, padding=1) class ResidualBlock(nn.Module): """Simple residual block with two 3x3 convolutions. Args: in_ch (int): number...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
fqhank/HESIC
Enhancement_Block
false
6,702
[ "Apache-2.0" ]
1
f15cb8e6822af45f0022ea4887fce915e250ed75
https://github.com/fqhank/HESIC/tree/f15cb8e6822af45f0022ea4887fce915e250ed75
PolicyNetwork
import torch import torch.nn as nn import torch.nn.functional as F class PolicyNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, init_w=3e-05): super(PolicyNetwork, self).__init__() self.linear1 = nn.Linear(num_inputs, hidden_size) self.linear2 = nn.Linear(hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
frknayk/Reinforcement-Learning-In-Control
PolicyNetwork
false
6,703
[ "MIT" ]
1
24c7eb6fa6b6390ee2dd04f25036c37896ecd944
https://github.com/frknayk/Reinforcement-Learning-In-Control/tree/24c7eb6fa6b6390ee2dd04f25036c37896ecd944
enhance_net_nopool
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class enhance_net_nopool(nn.Module): def __init__(self): super(enhance_net_nopool, self).__init__() self.relu = nn.ReLU(inplace=True) number_f = 32 self.e_conv1 = nn.Conv2d(3, number_f, 3, 1, 1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
farhantandia/Applied-CV-Zero-DCE-master
enhance_net_nopool
false
6,704
[ "MIT" ]
1
56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
https://github.com/farhantandia/Applied-CV-Zero-DCE-master/tree/56a0f8aec799eb5d125f5d9f44f692b9a9a3c990
ActorCriticContinuous
import torch from torch import nn import torch.nn.functional as F class ActorCriticContinuous(nn.Module): """ Actor-Critic for continuous action spaces. The network returns a state_value (critic) and action mean and action standarddeviation (actor). The action is the sampled from a normal distribution...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
fschur/Advantage-Actor-Critic-for-OpenAi-gym
ActorCriticContinuous
false
6,705
[ "MIT" ]
1
c130038789425301684825e09e77f17e89d21859
https://github.com/fschur/Advantage-Actor-Critic-for-OpenAi-gym/tree/c130038789425301684825e09e77f17e89d21859
Policy
import torch import torch.nn.functional as F from torch import nn class Policy(nn.Module): def __init__(self): super(Policy, self).__init__() self.conv1 = nn.Conv2d(2, 4, kernel_size=6, stride=2, bias=False) self.conv2 = nn.Conv2d(4, 16, kernel_size=6, stride=4) self.size = 9 * 9 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
francescotorregrossa/deep-reinforcement-learning-nanodegree
Policy
false
6,706
[ "MIT" ]
1
396648570aa53c9e727a8de69175e4a139d4ded5
https://github.com/francescotorregrossa/deep-reinforcement-learning-nanodegree/tree/396648570aa53c9e727a8de69175e4a139d4ded5
EqualConv2d
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
g33sean/RTIL
EqualConv2d
false
6,707
[ "BSD-2-Clause", "MIT" ]
1
5325f6d5e3ddf7579b6bd8199898e00eff3da631
https://github.com/g33sean/RTIL/tree/5325f6d5e3ddf7579b6bd8199898e00eff3da631
Feedforward
import torch class Feedforward(torch.nn.Module): def __init__(self, input_size, output_size, hidden_size): super(Feedforward, self).__init__() self.input_size = input_size self.output_size = output_size self.hidden_size = hidden_size self.fc1 = torch.nn.Linear(self.input_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
fywu85/eecs206a_project
Feedforward
false
6,708
[ "MIT" ]
1
73ea518779da4d187df8bbe4cbe46bca6d1a0714
https://github.com/fywu85/eecs206a_project/tree/73ea518779da4d187df8bbe4cbe46bca6d1a0714
ActorCriticDiscrete
import torch from torch import nn import torch.nn.functional as F class ActorCriticDiscrete(nn.Module): """ Actor-Critic for discrete action spaces. The network returns a state_value (critic)and action probabilities (actor). """ def __init__(self, action_dim, state_dim, hidden_dim): super(Act...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
fschur/Advantage-Actor-Critic-for-OpenAi-gym
ActorCriticDiscrete
false
6,709
[ "MIT" ]
1
c130038789425301684825e09e77f17e89d21859
https://github.com/fschur/Advantage-Actor-Critic-for-OpenAi-gym/tree/c130038789425301684825e09e77f17e89d21859
EqualLinear
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
g33sean/RTIL
EqualLinear
false
6,710
[ "BSD-2-Clause", "MIT" ]
1
5325f6d5e3ddf7579b6bd8199898e00eff3da631
https://github.com/g33sean/RTIL/tree/5325f6d5e3ddf7579b6bd8199898e00eff3da631
UNet
import torch from torch.functional import F import torch.nn as nn import torch.nn.functional as F class down(nn.Module): def __init__(self, inChannels, outChannels, filterSize): """ Parameters ---------- inChannels : int number of input channels for the first c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.functional import ...
delldu/VideoSlow
UNet
false
6,711
[ "MIT" ]
1
2badbbfa2187ea15ea37ef35e70a103ef98c1e33
https://github.com/delldu/VideoSlow/tree/2badbbfa2187ea15ea37ef35e70a103ef98c1e33
ConstantODE
import torch class ConstantODE(torch.nn.Module): def __init__(self): super(ConstantODE, self).__init__() self.a = torch.nn.Parameter(torch.tensor(0.2)) self.b = torch.nn.Parameter(torch.tensor(3.0)) def forward(self, t, y): return self.a + (y - (self.a * t + self.b)) ** 5 ...
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...
gaozhihan/torchdiffeq
ConstantODE
false
6,712
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
SineODE
import math import torch class SineODE(torch.nn.Module): def forward(self, t, y): return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3 def y_exact(self, t): return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * t ** 3 * torch.sin( 2 * t) + 0.25 * t ** 2 * torch.cos(2 * t)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
gaozhihan/torchdiffeq
SineODE
false
6,713
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
ResidualBlock
import torch from torch import nn class ResidualBlock(nn.Module): def __init__(self, filter_size, dilation, residual_channels, dilated_channels, skip_channels): super().__init__() self.conv = nn.Conv1d(residual_channels, dilated_channels, kernel_size=filter_size, padding=dilat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
fukuroder/pytorch_lightning_wavenet
ResidualBlock
false
6,714
[ "MIT" ]
1
440ef4092397998edf0df4625f1f10157db2243e
https://github.com/fukuroder/pytorch_lightning_wavenet/tree/440ef4092397998edf0df4625f1f10157db2243e
EqualConvTranspose2d
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
g33sean/RTIL
EqualConvTranspose2d
false
6,715
[ "BSD-2-Clause", "MIT" ]
1
5325f6d5e3ddf7579b6bd8199898e00eff3da631
https://github.com/g33sean/RTIL/tree/5325f6d5e3ddf7579b6bd8199898e00eff3da631
CombineSlices
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class CombineSlices(nn.Module): def __init__(self, slice_dim=2): super().__init__() self.slice_dim = slice_dim def forward(self, x): return torch.index_select(x, dim=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 import nn import torch.utils.data import torch.utils.data.distributed import torch.optim assert_size_stride = torch._C._dynamo.gu...
gbosdet/fastMRI
CombineSlices
false
6,716
[ "MIT" ]
1
7f94f8006f8919d98fb87788b6dadec9a58d1a3a
https://github.com/gbosdet/fastMRI/tree/7f94f8006f8919d98fb87788b6dadec9a58d1a3a
ResBlock
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ResBlock(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gaozhihan/torchdiffeq
ResBlock
false
6,717
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
ConcatConv2d
import torch import torch.nn as nn class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() module = nn.ConvTranspose2d if transpose else nn.Conv2d 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gaozhihan/torchdiffeq
ConcatConv2d
false
6,718
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
Decoder
import torch import torch.nn as nn class Decoder(nn.Module): def __init__(self, latent_dim=4, obs_dim=2, nhidden=20): super(Decoder, self).__init__() self.relu = nn.ReLU(inplace=True) self.fc1 = nn.Linear(latent_dim, nhidden) self.fc2 = nn.Linear(nhidden, obs_dim) def forward...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gaozhihan/torchdiffeq
Decoder
false
6,719
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
MaskedHuberLoss
import torch import torch.nn as nn class MaskedHuberLoss(torch.nn.Module): def __init__(self): super(MaskedHuberLoss, self).__init__() def forward(self, output, labels, mask): lossHuber = nn.SmoothL1Loss(reduction='none') l = lossHuber(output * mask, labels * mask) l = l.sum(...
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...
gabrieleangeletti/GndNet
MaskedHuberLoss
false
6,720
[ "MIT" ]
1
323af65c9c16a725805f480ff799936b77b04d53
https://github.com/gabrieleangeletti/GndNet/tree/323af65c9c16a725805f480ff799936b77b04d53
Netleaky
import torch import torch.nn as nn import torch.nn.functional as F class Netleaky(nn.Module): def __init__(self, input_dim, output_dim): super(Netleaky, self).__init__() self.linear1 = nn.Linear(input_dim, 32) self.linear2 = nn.Linear(32, 32) self.linear3 = nn.Linear(32, 64) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gautam-sharma1/openRL
Netleaky
false
6,721
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
Cartesian
import torch from torch import nn import torch.utils.data import torch.utils.data.distributed import torch.optim class Cartesian(nn.Module): def forward(self, x): r, phi = x[..., 0], x[..., 1] return torch.stack((r * torch.cos(phi), r * torch.sin(phi)), dim=-1) def get_inputs(): return [tor...
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 import torch.utils.data import torch.utils.data.dist...
gbosdet/fastMRI
Cartesian
false
6,722
[ "MIT" ]
1
7f94f8006f8919d98fb87788b6dadec9a58d1a3a
https://github.com/gbosdet/fastMRI/tree/7f94f8006f8919d98fb87788b6dadec9a58d1a3a
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, input_dim, output_dim): super(Net, self).__init__() self.linear1 = nn.Linear(input_dim, 256) self.linear2 = nn.Linear(256, output_dim) def forward(self, x): x = 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 assert_...
gautam-sharma1/openRL
Net
false
6,723
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
NN_2layer_regression
import torch from torch import nn class NN_2layer_regression(nn.Module): def __init__(self, input_dim, interm_dim1, interm_dim2): super().__init__() self.d = input_dim self.interm_dim1 = interm_dim1 self.interm_dim2 = interm_dim2 self.fc1 = nn.Linear(input_dim, interm_dim1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
gaseln/FLIX_small_scale_experiments
NN_2layer_regression
false
6,724
[ "MIT" ]
1
af9ebd7f192fc0f67a6a94af7939fd3d6f548bd6
https://github.com/gaseln/FLIX_small_scale_experiments/tree/af9ebd7f192fc0f67a6a94af7939fd3d6f548bd6
HighwayLayer
import torch import torch.nn.functional as F import torch.nn as nn import torch.onnx.operators class HighwayLayer(nn.Module): def __init__(self, input_dim, transform_activation=F.relu, gate_activation=F.softmax, gate_bias=-2): super().__init__() self.highway_transform_activation = transfo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gardenia22/translate
HighwayLayer
false
6,725
[ "BSD-3-Clause" ]
1
0be57c8f55b52fc9d39197efa02e05d1c1cda024
https://github.com/gardenia22/translate/tree/0be57c8f55b52fc9d39197efa02e05d1c1cda024
DPSLTMAdapter
import math import torch from torch import Tensor import torch.nn as nn from torch.nn.utils.rnn import pad_sequence import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel from typing import Optional from typing import Union from typing import List from typing import Tuple from torch.nn.uti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
ffuuugor/opacus
DPSLTMAdapter
false
6,726
[ "Apache-2.0" ]
1
2048a6e92902685c2a735e9fb7c0d48b4846b494
https://github.com/ffuuugor/opacus/tree/2048a6e92902685c2a735e9fb7c0d48b4846b494
Net16
import torch import torch.nn as nn import torch.nn.functional as F class Net16(nn.Module): def __init__(self, input_dim, output_dim): super(Net16, self).__init__() self.linear1 = nn.Linear(input_dim, 16) self.linear2 = nn.Linear(16, output_dim) def forward(self, x): x = F.rel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gautam-sharma1/openRL
Net16
false
6,727
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
MLP
import torch import torch.nn as nn import torch.utils.data class MLP(nn.Module): def __init__(self, input_size, output_size, hidden_size=500, weight_decay=0.0): super(MLP, self).__init__() self.i2h = nn.Linear(in_features=input_size, out_features=hidden_size) self.Dropout = nn.Dro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
gchrupala/platalea
MLP
false
6,728
[ "Apache-2.0" ]
1
65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
https://github.com/gchrupala/platalea/tree/65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
MeanPool
import torch import torch.nn as nn import torch.utils.data class MeanPool(nn.Module): def __init__(self): super(MeanPool, self).__init__() def forward(self, input): x = input.mean(dim=1) return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
gchrupala/platalea
MeanPool
false
6,729
[ "Apache-2.0" ]
1
65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
https://github.com/gchrupala/platalea/tree/65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
NNet
import torch import torch.nn as nn import torch.nn.functional as F class NNet(nn.Module): def __init__(self, input_dim, output_dim): super(NNet, self).__init__() self.linear1 = nn.Linear(input_dim, 64) self.linear2 = nn.Linear(64, 256) self.linear3 = nn.Linear(256, output_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
gautam-sharma1/openRL
NNet
false
6,730
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
ELBO
import torch import torch.nn.functional import torch.nn as nn class ELBO(nn.Module): def __init__(self, train_size, loss_function=nn.MSELoss()): """ Quantify the Evidence Lower Bound (ELBO) and provide the total loss. """ super(ELBO, self).__init__() self.train_size = trai...
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.functional import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
geek-yang/NEmo
ELBO
false
6,731
[ "Apache-2.0" ]
1
4f310535c4865f3816155b99b4a2bbb891672cc9
https://github.com/geek-yang/NEmo/tree/4f310535c4865f3816155b99b4a2bbb891672cc9
SCNLayer
import torch import torch.nn as nn def chebyshev(L, X, k=3): if k == 1: return torch.sparse.mm(L, X) dp = [X, torch.sparse.mm(L, X)] for i in range(2, k): nxt = 2 * torch.sparse.mm(L, dp[i - 1]) dp.append(torch.sparse.FloatTensor.add(nxt, -dp[i - 2])) return torch.cat(dp, dim=1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ggoh29/Simplicial-neural-network-benchmark
SCNLayer
false
6,733
[ "MIT" ]
1
9a12bcd054251790d85e3971f5473dcffaa5664b
https://github.com/ggoh29/Simplicial-neural-network-benchmark/tree/9a12bcd054251790d85e3971f5473dcffaa5664b
Temp
import torch import torch.nn as nn import torch.nn.functional as F class Temp(nn.Module): def __init__(self, input_dim, output_dim): super(Temp, self).__init__() self.linear1 = nn.Linear(input_dim, 256) self.linear2 = nn.Linear(256, 256) self.linear3 = nn.Linear(256, 256) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gautam-sharma1/openRL
Temp
false
6,734
[ "MIT" ]
1
14310a97a328fe5682a01ee85d83a6b5e1ae29ca
https://github.com/gautam-sharma1/openRL/tree/14310a97a328fe5682a01ee85d83a6b5e1ae29ca
GroupNorm
import torch import torch.nn as nn class GroupNorm(nn.Module): def __init__(self, c_num, group_num=16, eps=1e-10): """ The groupnorm layer from https://arxiv.org/abs/1803.08494 Args: c_num (int): Number of input channels group_num (int): Number of group by which to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
generall/Torchlite
GroupNorm
false
6,735
[ "MIT" ]
1
2eb3e2a20b7619bd58b0b0fca120e2aefca0e79a
https://github.com/generall/Torchlite/tree/2eb3e2a20b7619bd58b0b0fca120e2aefca0e79a
LinearAttention
import torch import torch.nn as nn import torch.utils.data class LinearAttention(nn.Module): def __init__(self, in_size): super(LinearAttention, self).__init__() self.out = nn.Linear(in_size, 1) nn.init.orthogonal_(self.out.weight.data) self.softmax = nn.Softmax(dim=1) def fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gchrupala/platalea
LinearAttention
false
6,736
[ "Apache-2.0" ]
1
65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
https://github.com/gchrupala/platalea/tree/65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
GreedyCTCDecoder
import torch import torch.nn as nn class GreedyCTCDecoder(nn.Module): """ Greedy CTC Decoder """ def __init__(self, **kwargs): nn.Module.__init__(self) def forward(self, log_probs): with torch.no_grad(): argmx = log_probs.argmax(dim=-1, keepdim=False).int() 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ghdrl95/Naver-Speech-Hackathon
GreedyCTCDecoder
false
6,737
[ "Apache-2.0" ]
1
10b4526d98ce535415cb91d24338790d9c175b63
https://github.com/ghdrl95/Naver-Speech-Hackathon/tree/10b4526d98ce535415cb91d24338790d9c175b63
RegionPenaltyLoss
import torch from torch import nn class RegionPenaltyLoss(nn.Module): def __init__(self, scale=1.0): """ Multiplicative penalty. Penalizes "forbidden" regions instead of exact distribution matches. Optionally used in tandem with MTCrossEntropyRegionAwareLoss. `scale` para...
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...
geoffreyangus/pet-ct
RegionPenaltyLoss
false
6,738
[ "Apache-2.0" ]
1
fa96a07734afade475f6a1e1587ec14965fe2de3
https://github.com/geoffreyangus/pet-ct/tree/fa96a07734afade475f6a1e1587ec14965fe2de3
Network
import torch class Network(torch.nn.Module): def __init__(self, input_dimension, output_dimension): super(Network, self).__init__() self.layer_1 = torch.nn.Linear(in_features=input_dimension, out_features=100) self.layer_2 = torch.nn.Linear(in_features=100, out_features=200) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
georgeyiasemis/Deep-Reinforcement-Learning-on-a-Grid-World-
Network
false
6,739
[ "MIT" ]
1
f32ceac5f4e29cba212d6fd1b8a25c08ac733666
https://github.com/georgeyiasemis/Deep-Reinforcement-Learning-on-a-Grid-World-/tree/f32ceac5f4e29cba212d6fd1b8a25c08ac733666
ScalarAttention
import torch import torch.nn as nn import torch.utils.data class ScalarAttention(nn.Module): def __init__(self, in_size, hidden_size): super(ScalarAttention, self).__init__() self.hidden = nn.Linear(in_size, hidden_size) nn.init.orthogonal_(self.hidden.weight.data) self.out = nn.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 from torch._inductor.runtime....
gchrupala/platalea
ScalarAttention
false
6,740
[ "Apache-2.0" ]
1
65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
https://github.com/gchrupala/platalea/tree/65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
ODEfunc
import torch import torch.nn as nn def norm(dim): return nn.GroupNorm(min(32, dim), dim) class ConcatConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatConv2d, self).__init__() module = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gaozhihan/torchdiffeq
ODEfunc
false
6,741
[ "MIT" ]
1
414781617d595ba01cc3f23382e25ab890f4ca66
https://github.com/gaozhihan/torchdiffeq/tree/414781617d595ba01cc3f23382e25ab890f4ca66
MSELoss2d
import torch from torch import 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) 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
giannifranchi/deeplabv3-superpixelmix
MSELoss2d
false
6,742
[ "MIT" ]
1
db52bf83b3b242af05bde5e39ee3de896e44c264
https://github.com/giannifranchi/deeplabv3-superpixelmix/tree/db52bf83b3b242af05bde5e39ee3de896e44c264
ResidualBlock
import torch import torch.nn as nn class ResidualBlock(nn.Module): def __init__(self, channels): super(ResidualBlock, self).__init__() self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1) self.in1 = nn.InstanceNorm2d(channels) self.prelu = nn.PReLU() self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
generall/Torchlite
ResidualBlock
false
6,743
[ "MIT" ]
1
2eb3e2a20b7619bd58b0b0fca120e2aefca0e79a
https://github.com/generall/Torchlite/tree/2eb3e2a20b7619bd58b0b0fca120e2aefca0e79a
ConvBlock
import torch import torch.nn as nn class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvBlock, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding=1) self.lr = nn.LeakyReLU() 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
gle-bellier/DuelingNetwork
ConvBlock
false
6,744
[ "MIT" ]
1
8909fe1ba6aee08b6249cb6ca3287752039c6410
https://github.com/gle-bellier/DuelingNetwork/tree/8909fe1ba6aee08b6249cb6ca3287752039c6410
WordPredictor
import torch import torch.nn.functional as F import torch.nn as nn import torch.onnx.operators class WordPredictor(nn.Module): def __init__(self, encoder_output_dim, hidden_dim, output_dim): super().__init__() self.encoder_output_dim = encoder_output_dim self.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 from torch._inductor.runtime....
gardenia22/translate
WordPredictor
false
6,745
[ "BSD-3-Clause" ]
1
0be57c8f55b52fc9d39197efa02e05d1c1cda024
https://github.com/gardenia22/translate/tree/0be57c8f55b52fc9d39197efa02e05d1c1cda024
VideoNormalizer
import torch import torch.nn as nn class VideoNormalizer(nn.Module): def __init__(self): super(VideoNormalizer, self).__init__() self.scale = nn.Parameter(torch.Tensor([255.0]), requires_grad=False) self.mean = nn.Parameter(torch.Tensor([0.485, 0.456, 0.406]), requires_grad=Fa...
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...
glee1228/segment_temporal_context_aggregation
VideoNormalizer
false
6,746
[ "Apache-2.0" ]
1
e5778f848f1cfd89bd1f77beb5e1b38a66a2f13d
https://github.com/glee1228/segment_temporal_context_aggregation/tree/e5778f848f1cfd89bd1f77beb5e1b38a66a2f13d
LogSparsemax
from torch.autograd import Function import torch import torch.nn.init import torch.nn as nn def _make_ix_like(input, dim=0): d = input.size(dim) rho = torch.arange(1, d + 1, device=input.device, dtype=input.dtype) view = [1] * input.dim() view[0] = -1 return rho.view(view).transpose(0, dim) 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.autograd im...
gililior/qasrl-modeling
LogSparsemax
false
6,747
[ "MIT" ]
1
2f9684536f6d5f0283b0e4b90a911ea12fa72f72
https://github.com/gililior/qasrl-modeling/tree/2f9684536f6d5f0283b0e4b90a911ea12fa72f72
RegressionSubNet
import torch import torch.nn as nn class RegressionSubNet(nn.Module): def __init__(self, in_channels, num_anchors=9): super().__init__() self.conv2d_1 = nn.Conv2d(in_channels, 256, 3, padding=1) nn.init.normal_(self.conv2d_1.weight.data, std=0.01) nn.init.zeros_(self.conv2d_1.bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
geez0219/ARC
RegressionSubNet
false
6,748
[ "Apache-2.0" ]
1
f2176f0d442d4a2d6028f0770b1efc1a9ae982b8
https://github.com/geez0219/ARC/tree/f2176f0d442d4a2d6028f0770b1efc1a9ae982b8
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, dims, norm=False): super(Attention, self).__init__() self.norm = norm if self.norm: self.constrain = L2Constrain() else: self.transform = nn.Linear(dims, dims) self.co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
glee1228/segment_temporal_context_aggregation
Attention
false
6,749
[ "Apache-2.0" ]
1
e5778f848f1cfd89bd1f77beb5e1b38a66a2f13d
https://github.com/glee1228/segment_temporal_context_aggregation/tree/e5778f848f1cfd89bd1f77beb5e1b38a66a2f13d
Sparsemax
from torch.autograd import Function import torch import torch.nn.init import torch.nn as nn def _make_ix_like(input, dim=0): d = input.size(dim) rho = torch.arange(1, d + 1, device=input.device, dtype=input.dtype) view = [1] * input.dim() view[0] = -1 return rho.view(view).transpose(0, dim) 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 from torch._inductor.runtime import triton_helpers from torch.autograd import Function import torch.nn.init import torch.nn as nn assert_siz...
gililior/qasrl-modeling
Sparsemax
false
6,750
[ "MIT" ]
1
2f9684536f6d5f0283b0e4b90a911ea12fa72f72
https://github.com/gililior/qasrl-modeling/tree/2f9684536f6d5f0283b0e4b90a911ea12fa72f72
ActorNetwork
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class ActorNetwork(nn.Module): def __init__(self, state_size, action_size, hidden_size, init_w=0.003, log_std_min=-20, log_std_max=2): super(ActorNetwork, self).__init__() self.log_std_min = log_std...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
godnpeter/DMC_Clustering_PICA
ActorNetwork
false
6,751
[ "BSD-2-Clause" ]
1
1b3e14dd4034f3941af1caa06c1d4b6f9d606408
https://github.com/godnpeter/DMC_Clustering_PICA/tree/1b3e14dd4034f3941af1caa06c1d4b6f9d606408
Net
import torch import torch.nn.functional as F import torch.nn as nn class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) self.conv2_drop = nn.Dropout2d() self.fc1 = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
generall/Torchlite
Net
false
6,752
[ "MIT" ]
1
2eb3e2a20b7619bd58b0b0fca120e2aefca0e79a
https://github.com/generall/Torchlite/tree/2eb3e2a20b7619bd58b0b0fca120e2aefca0e79a
ClassificationSubNet
import torch import numpy as np import torch.nn as nn class ClassificationSubNet(nn.Module): def __init__(self, in_channels, num_classes, num_anchors=9): super().__init__() self.num_classes = num_classes self.conv2d_1 = nn.Conv2d(in_channels, 256, 3, padding=1) nn.init.normal_(sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
geez0219/ARC
ClassificationSubNet
false
6,753
[ "Apache-2.0" ]
1
f2176f0d442d4a2d6028f0770b1efc1a9ae982b8
https://github.com/geez0219/ARC/tree/f2176f0d442d4a2d6028f0770b1efc1a9ae982b8
ZeroConv1d
import torch import torch.nn as nn class ZeroConv1d(nn.Module): def __init__(self, in_channel, out_channel): super().__init__() self.conv = nn.Conv1d(in_channel, out_channel, 1, padding=0) self.conv.weight.data.zero_() self.conv.bias.data.zero_() self.scale = nn.Parameter(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
gorinars/VQ-VAE-Speech
ZeroConv1d
false
6,754
[ "MIT" ]
1
60398f03eb129195bce402a423ace8cca8995f3c
https://github.com/gorinars/VQ-VAE-Speech/tree/60398f03eb129195bce402a423ace8cca8995f3c
Conv
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, dilation=1, causal=True): super(Conv, self).__init__() self.causal = causal if self.causal: self.padding = dilation * (kernel_size - 1) else: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
gorinars/VQ-VAE-Speech
Conv
false
6,755
[ "MIT" ]
1
60398f03eb129195bce402a423ace8cca8995f3c
https://github.com/gorinars/VQ-VAE-Speech/tree/60398f03eb129195bce402a423ace8cca8995f3c
HingeLoss
import torch import torch.utils.data from torch import nn import torch import torch.nn.parallel import torch.optim class HingeLoss(nn.Module): def __init__(self): super(HingeLoss, self).__init__() self.margin = 1.0 def hinge_loss(self, input, target): output = self.margin - input.mul...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from torch import nn import torch import torch.nn.parallel import...
graphbuilder/BNN
HingeLoss
false
6,756
[ "MIT" ]
1
d99eb5c7ef19f8b0c14a135d40a489f154a3c894
https://github.com/graphbuilder/BNN/tree/d99eb5c7ef19f8b0c14a135d40a489f154a3c894
ContrastiveLoss
import torch import torch.utils.data class ContrastiveLoss(torch.nn.Module): """ Contrastive loss function. """ def __init__(self, margin=1.0): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, x0, x1, y): diff = x0 - x1 dist_sq = torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data asse...
guruprasaad123/all_dl_projects
ContrastiveLoss
false
6,757
[ "Apache-2.0" ]
1
04c869f7f001ef94c467740260663d91a34815e0
https://github.com/guruprasaad123/all_dl_projects/tree/04c869f7f001ef94c467740260663d91a34815e0
AlignQuestionEmbedding
import torch import torch.nn.functional as F from torch import nn class AlignQuestionEmbedding(nn.Module): def __init__(self, input_dim): super().__init__() self.linear = nn.Linear(input_dim, input_dim) self.relu = nn.ReLU() def forward(self, context, question, question_mask): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gustavhartz/legal-contract-elements
AlignQuestionEmbedding
false
6,758
[ "MIT" ]
1
7a1e1f0024f9d336c7166f51b4325acf03db86a2
https://github.com/gustavhartz/legal-contract-elements/tree/7a1e1f0024f9d336c7166f51b4325acf03db86a2
BasicBlock
import torch import torch.utils.data from torch import nn import torch import torch.nn.parallel import torch.optim def Binarize(tensor, quant_mode='det'): if quant_mode == 'det': tensor = tensor.sign() zero = torch.zeros_like(tensor) one = torch.ones_like(tensor) zero - one ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
graphbuilder/BNN
BasicBlock
false
6,759
[ "MIT" ]
1
d99eb5c7ef19f8b0c14a135d40a489f154a3c894
https://github.com/graphbuilder/BNN/tree/d99eb5c7ef19f8b0c14a135d40a489f154a3c894
NetVLAD
import math import torch import torch.nn as nn import torch.nn.functional as F class NetVLAD(nn.Module): def __init__(self, dims, num_clusters, outdims=None): super(NetVLAD, self).__init__() self.num_clusters = num_clusters self.dims = dims self.centroids = nn.Parameter(torch.rand...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
glee1228/segment_temporal_context_aggregation
NetVLAD
false
6,760
[ "Apache-2.0" ]
1
e5778f848f1cfd89bd1f77beb5e1b38a66a2f13d
https://github.com/glee1228/segment_temporal_context_aggregation/tree/e5778f848f1cfd89bd1f77beb5e1b38a66a2f13d
Attention
import torch import torch.nn as nn import torch.utils.data class Attention(nn.Module): def __init__(self, in_size, hidden_size): super(Attention, self).__init__() self.hidden = nn.Linear(in_size, hidden_size) nn.init.orthogonal_(self.hidden.weight.data) self.out = nn.Linear(hidden...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
gchrupala/platalea
Attention
false
6,761
[ "Apache-2.0" ]
1
65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
https://github.com/gchrupala/platalea/tree/65833307bb6c5ad6cbdd6b17ad8ca59cf51fcd81
Auxiliary
import torch import torch.nn as nn import torch.nn.functional as F class Auxiliary(nn.Module): def __init__(self, input_channels, n_classes): super(Auxiliary, self).__init__() self.Conv2 = nn.Conv2d(input_channels, 128, kernel_size=1) self.FC1 = nn.Linear(2048, 1024) self.FC2 = 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_...
gogo5911/PyTorch_Network
Auxiliary
false
6,762
[ "MIT" ]
1
396e2ebfe2c7e23143e72972e2fd55613c0098a3
https://github.com/gogo5911/PyTorch_Network/tree/396e2ebfe2c7e23143e72972e2fd55613c0098a3
Conv2dBlock
import torch import torch.utils.data import torch from torch import nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
guyii54/Contrastive-I2I
Conv2dBlock
false
6,763
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647
GRU
import torch import torch as tc import torch.nn as nn class Layer_Norm(nn.Module): def __init__(self, d_hid, eps=0.001): super(Layer_Norm, self).__init__() self.eps = eps self.g = nn.Parameter(tc.ones(d_hid), requires_grad=True) self.b = nn.Parameter(tc.zeros(d_hid), requires_grad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 as tc ...
gushu333/DA4NMT
GRU
false
6,764
[ "Apache-2.0" ]
1
dba52a3d3784cd795b6f9aaf655b63475a848798
https://github.com/gushu333/DA4NMT/tree/dba52a3d3784cd795b6f9aaf655b63475a848798
Normalize
import torch import torch.utils.data import torch from torch import nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch from torch import nn assert_size_stride = ...
guyii54/Contrastive-I2I
Normalize
false
6,765
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647
GroupedChannelNorm
import torch import torch.utils.data import torch from torch import nn class GroupedChannelNorm(nn.Module): def __init__(self, num_groups): super().__init__() self.num_groups = num_groups def forward(self, x): shape = list(x.shape) new_shape = [shape[0], self.num_groups, shap...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch from torch import nn assert_size_stride = ...
guyii54/Contrastive-I2I
GroupedChannelNorm
false
6,766
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647