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 |
|---|---|---|---|---|---|---|---|---|---|---|
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.... | qlindazm/asv-subtools | SoftmaxAffineLayer | false | 4,235 | [
"Apache-2.0"
] | 0 | fe1d31db9f3268622016babe944201f6ff81ed56 | https://github.com/qlindazm/asv-subtools/tree/fe1d31db9f3268622016babe944201f6ff81ed56 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, Cin, Cout):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(Cin, Cout, (3, 3))
def forward(self, x):
x0 = self.conv1(x)
x1 = self.conv1(x)
z = torch.cat([x0,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | saeta/mlir-npcomp | Net | false | 4,236 | [
"Apache-2.0"
] | 0 | 85898aaf10ea30237ee1d66c977b966cf7fcf6d0 | https://github.com/saeta/mlir-npcomp/tree/85898aaf10ea30237ee1d66c977b966cf7fcf6d0 |
ChunkSeparationAffine | 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.functional as F
import torch.nn
assert_size_stride = torch._C._d... | qlindazm/asv-subtools | ChunkSeparationAffine | false | 4,237 | [
"Apache-2.0"
] | 0 | fe1d31db9f3268622016babe944201f6ff81ed56 | https://github.com/qlindazm/asv-subtools/tree/fe1d31db9f3268622016babe944201f6ff81ed56 |
BartClassificationHead | import torch
from torch import nn
import torch.utils.checkpoint
class BartClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, input_dim: 'int', inner_dim: 'int', pooler_dropout:
'float'):
super().__init__()
self.dense = nn.Linear(input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | sajastu/transformers-sent-curr | BartClassificationHead | false | 4,238 | [
"Apache-2.0"
] | 0 | 6dc41545c4ac298a010090fbca4b454c2eaf3dbb | https://github.com/sajastu/transformers-sent-curr/tree/6dc41545c4ac298a010090fbca4b454c2eaf3dbb |
GroupedLinearLayer | import torch
from torch import nn
import torch.utils.checkpoint
class GroupedLinearLayer(nn.Module):
def __init__(self, input_size, output_size, num_groups):
super().__init__()
self.input_size = input_size
self.output_size = output_size
self.num_groups = num_groups
self.gr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.checkpoint
assert_size_stride = torch._C... | sajastu/transformers-sent-curr | GroupedLinearLayer | false | 4,239 | [
"Apache-2.0"
] | 0 | 6dc41545c4ac298a010090fbca4b454c2eaf3dbb | https://github.com/sajastu/transformers-sent-curr/tree/6dc41545c4ac298a010090fbca4b454c2eaf3dbb |
HubertFeatureProjection | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.checkpoint
class HubertFeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.
layer_norm_eps)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | sajastu/transformers-sent-curr | HubertFeatureProjection | false | 4,240 | [
"Apache-2.0"
] | 0 | 6dc41545c4ac298a010090fbca4b454c2eaf3dbb | https://github.com/sajastu/transformers-sent-curr/tree/6dc41545c4ac298a010090fbca4b454c2eaf3dbb |
Actor | import torch
import torch.nn as nn
from torch.distributions import Categorical
from torch.distributions import Normal
from torch.distributions import Independent
class Actor(nn.Module):
def __init__(self, obs_dim: 'int', ac_lim: 'float', ac_dim: 'int',
discrete: 'bool'=True):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | raznem/rlex | Actor | false | 4,242 | [
"MIT"
] | 0 | d24b964d80067becc81d86f6ce87e5be413b7049 | https://github.com/raznem/rlex/tree/d24b964d80067becc81d86f6ce87e5be413b7049 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super(DiceLoss, self).__init__()
def forward(self, inputs, targets, smooth=1):
inputs = torch.sigmoid(inputs)
inputs = inputs.view(-1)
targets = targets.view(-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... | salem-devloper/COVID-Lung-Segment | DiceLoss | false | 4,243 | [
"MIT"
] | 0 | 6896f6b0c56dac6d32e005afd4a94d59b1917b44 | https://github.com/salem-devloper/COVID-Lung-Segment/tree/6896f6b0c56dac6d32e005afd4a94d59b1917b44 |
ImageTransformationNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResidualBlock(nn.Module):
"""
Vanilla convolutional residual block from seminal paper by He et al.
Use of instance normalization suggested by Ulyanov et al. in
https://arxiv.org/pdf/1607.08022.pdf%C2%A0%C2%A0%C2%A0%C2%A0.
""... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rileypsmith/Fast-Style-Transfer | ImageTransformationNet | false | 4,244 | [
"MIT"
] | 0 | 8b2164f8bc6d63530f914610b6c5c5c1b0f4ffd5 | https://github.com/rileypsmith/Fast-Style-Transfer/tree/8b2164f8bc6d63530f914610b6c5c5c1b0f4ffd5 |
LayerNormCustom | import torch
import torch.nn as nn
class LayerNormCustom(nn.Module):
"""A layernorm module in the TF style (epsilon inside the square root)."""
def __init__(self, n_hidden, variance_epsilon=1e-12):
super().__init__()
self.gamma = nn.Parameter(torch.ones(n_hidden))
self.beta = nn.Param... | 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_... | renebidart/pytorch-cifar | LayerNormCustom | false | 4,245 | [
"MIT"
] | 0 | 8f623299c25f7f219bab34bc7df41fe24232b1af | https://github.com/renebidart/pytorch-cifar/tree/8f623299c25f7f219bab34bc7df41fe24232b1af |
IBertLMHead | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.checkpoint
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 *
torch.pow(x, 3))))
class IBertLMHead(nn.Module):
"""I-BERT Head for masked language modelin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | sajastu/transformers-sent-curr | IBertLMHead | false | 4,246 | [
"Apache-2.0"
] | 0 | 6dc41545c4ac298a010090fbca4b454c2eaf3dbb | https://github.com/sajastu/transformers-sent-curr/tree/6dc41545c4ac298a010090fbca4b454c2eaf3dbb |
PatchSequential | import math
import torch
import warnings
from typing import Dict
from typing import Optional
from typing import Tuple
import torch.nn as nn
import torch.nn.functional as F
from typing import cast
from typing import List
from typing import Union
from torch.distributions import Bernoulli
from itertools import zip_longest... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import warnings
from typing import Dict
from typing import Optional
from typing import Tuple
import torch.nn as nn
import torch.... | rozumden/kornia | PatchSequential | false | 4,247 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f62f324b201eea50e1e50db3fbf3e968e0a337c5 | https://github.com/rozumden/kornia/tree/f62f324b201eea50e1e50db3fbf3e968e0a337c5 |
DAModule | import torch
import numpy as np
from torch import nn
from torch.nn import init
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h, dropout=0.1):
"""
:param d_model: Output dimensionality of the model
:param ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rushirajsherlocked/External-Attention-pytorch | DAModule | false | 4,248 | [
"MIT"
] | 0 | 7d6814b2d90909adf81c62f3f8a89e30a59d6481 | https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481 |
MaskedWordPredictions | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
def gelu(x):
"""Gaussian Error Linear Unitという活性化関数です。
LeLUが0でカクっと不連続なので、そこを連続になるように滑らかにした形のLeLUです。
"""
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
class BertLayerNorm(nn.Module):
def __init__(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | kimihitosugiyama/text_analysis | MaskedWordPredictions | false | 4,249 | [
"Apache-2.0"
] | 0 | 8f51022957928c31e52af1e0fd407daca3addb40 | https://github.com/kimihitosugiyama/text_analysis/tree/8f51022957928c31e52af1e0fd407daca3addb40 |
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... | qlindazm/asv-subtools | Conv1dLinear | false | 4,250 | [
"Apache-2.0"
] | 0 | fe1d31db9f3268622016babe944201f6ff81ed56 | https://github.com/qlindazm/asv-subtools/tree/fe1d31db9f3268622016babe944201f6ff81ed56 |
PositionWiseFeedForward | import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function by Hugging Face"""
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
class PositionWiseFeedForward(nn.Module):
""" FeedForward Neural Networks for each position """
def __init__(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 math
import ... | renebidart/pytorch-cifar | PositionWiseFeedForward | false | 4,251 | [
"MIT"
] | 0 | 8f623299c25f7f219bab34bc7df41fe24232b1af | https://github.com/renebidart/pytorch-cifar/tree/8f623299c25f7f219bab34bc7df41fe24232b1af |
FC_Decoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class FC_Decoder(nn.Module):
def __init__(self, embedding_size):
super(FC_Decoder, self).__init__()
self.fc3 = nn.Linear(embedding_size, 1024)
self.fc4 = nn.Linear(1024, 784)
def forward(self, z):
h3 = 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_... | saksham36/LangGrounding | FC_Decoder | false | 4,252 | [
"MIT"
] | 0 | 89ee9e5b8090e61e6bf7bf2b3e1dd45edf9664b7 | https://github.com/saksham36/LangGrounding/tree/89ee9e5b8090e61e6bf7bf2b3e1dd45edf9664b7 |
Word2Vec | import torch
from torch import nn
class Word2Vec(nn.Module):
def __init__(self, features, embedding_size):
super().__init__()
0.5 / embedding_size
self.fc1 = nn.Linear(features, embedding_size)
self.fc2 = nn.Linear(embedding_size, features)
def forward(self, one_hot):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | salmanedhi/NNTI-WS2021-NLP-Project | Word2Vec | false | 4,253 | [
"MIT"
] | 0 | 5b0a8f1258ef4e835a6e647082a8286078a0bdd6 | https://github.com/salmanedhi/NNTI-WS2021-NLP-Project/tree/5b0a8f1258ef4e835a6e647082a8286078a0bdd6 |
Beta | import torch
import torch.nn as nn
import torch.functional as F
import torch.nn.functional as F
class BoundedBeta(torch.distributions.Beta):
def log_prob(self, x):
return super().log_prob((x + 1) / 2)
class Beta(nn.Module):
def __init__(self, action_dim):
super(Beta, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | samarth-robo/apex | Beta | false | 4,254 | [
"MIT"
] | 0 | db24044acacd0fcd006886eb1677eaa2f2beedad | https://github.com/samarth-robo/apex/tree/db24044acacd0fcd006886eb1677eaa2f2beedad |
Actor | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from torch.optim.lr_scheduler import *
import torch.optim.lr_scheduler
import torch.quantization
import torch.onnx
import torch.testing
class Actor(nn.Module):
def __init__(self, nb_states, nb_actions, hidden1=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | saman-aghazadeh/distiller | Actor | false | 4,255 | [
"Apache-2.0"
] | 0 | 7e8d3e6193c807f7c55d8453f64e1bc3c02eee30 | https://github.com/saman-aghazadeh/distiller/tree/7e8d3e6193c807f7c55d8453f64e1bc3c02eee30 |
Beta2 | import torch
import numpy as np
import torch.nn as nn
class BoundedBeta(torch.distributions.Beta):
def log_prob(self, x):
return super().log_prob((x + 1) / 2)
class Beta2(nn.Module):
def __init__(self, action_dim, init_std=0.25, learn_std=False):
super(Beta2, self).__init__()
asser... | 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 numpy as np
import torch.nn as nn
assert_size_stride = torch._C._d... | samarth-robo/apex | Beta2 | false | 4,256 | [
"MIT"
] | 0 | db24044acacd0fcd006886eb1677eaa2f2beedad | https://github.com/samarth-robo/apex/tree/db24044acacd0fcd006886eb1677eaa2f2beedad |
BertPooler2 | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.nn.parallel
import torch.optim
from torch.utils.data import *
import torch.nn.functional
class BertPooler2(nn.Module):
def __init__(self, config):
super(BertPooler2, self).__init__()
self.dense = 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.triton_helpers import libdevice
from torch import n... | samuelyu2002/PACS | BertPooler2 | false | 4,257 | [
"MIT"
] | 0 | 5010b2f0d20933b0647e3d6230d673e1830249ec | https://github.com/samuelyu2002/PACS/tree/5010b2f0d20933b0647e3d6230d673e1830249ec |
ModelWithDuplicates | import torch
from collections import OrderedDict
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from torch.optim.lr_scheduler import *
import torch.optim.lr_scheduler
import torch.quantization
import torch.onnx
import torch.testing
class ModelWithDuplicates(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.... | saman-aghazadeh/distiller | ModelWithDuplicates | false | 4,258 | [
"Apache-2.0"
] | 0 | 7e8d3e6193c807f7c55d8453f64e1bc3c02eee30 | https://github.com/saman-aghazadeh/distiller/tree/7e8d3e6193c807f7c55d8453f64e1bc3c02eee30 |
MySimpleNet | import torch
import torch.nn.functional as F
from torch import nn
class MySimpleNet(nn.Module):
"""
Very simple 2-layer net, slightly adapted from the docs:
https://skorch.readthedocs.io/en/stable/user/quickstart.html
"""
def __init__(self, num_in, num_feat, num_hidden=10, nonlin=F.re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | samxu0823/anfis-pytorch | MySimpleNet | false | 4,259 | [
"MIT"
] | 0 | b4ec3f0e8259963800e9e0a2904a580d1e56cc1c | https://github.com/samxu0823/anfis-pytorch/tree/b4ec3f0e8259963800e9e0a2904a580d1e56cc1c |
BahdanauAttention | import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from torch.optim.lr_scheduler import *
import torch.optim.lr_scheduler
import torch.quantization
from torch.nn.parameter import Parameter
import torch.onnx
import torch.testing
class EltwiseAdd(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.... | saman-aghazadeh/distiller | BahdanauAttention | false | 4,260 | [
"Apache-2.0"
] | 0 | 7e8d3e6193c807f7c55d8453f64e1bc3c02eee30 | https://github.com/saman-aghazadeh/distiller/tree/7e8d3e6193c807f7c55d8453f64e1bc3c02eee30 |
GaussMembFunc | import torch
def _mk_param(val):
"""Make a torch parameter from a scalar value"""
if isinstance(val, torch.Tensor):
val = val.item()
return torch.nn.Parameter(torch.tensor(val, dtype=torch.float))
class GaussMembFunc(torch.nn.Module):
"""
Gaussian membership functions, defined by two... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | samxu0823/anfis-pytorch | GaussMembFunc | false | 4,261 | [
"MIT"
] | 0 | b4ec3f0e8259963800e9e0a2904a580d1e56cc1c | https://github.com/samxu0823/anfis-pytorch/tree/b4ec3f0e8259963800e9e0a2904a580d1e56cc1c |
qy | import torch
import torch.nn.functional as F
import torch.nn as nn
class qy(nn.Module):
def __init__(self, d_dim, x_dim, y_dim, z_dim):
super(qy, self).__init__()
self.fc1 = nn.Linear(z_dim, y_dim)
torch.nn.init.xavier_uniform_(self.fc1.weight)
self.fc1.bias.data.zero_()
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 import triton_helpers
import torch.nn as nn
assert_... | sautami26/DIVA | qy | false | 4,262 | [
"MIT"
] | 0 | 52af683db216cb6e2ac777597fd9ec744ce7c8f2 | https://github.com/sautami26/DIVA/tree/52af683db216cb6e2ac777597fd9ec744ce7c8f2 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
import torch.utils.checkpoint
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if (config.hidden_size % config.num_attention_heads != 0 and not
hasattr(config... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Hzfinfdu/Black-Box-Tuning | BertAttention | false | 4,263 | [
"MIT"
] | 0 | 64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 | https://github.com/Hzfinfdu/Black-Box-Tuning/tree/64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 |
down | import torch
from torch.functional import F
import torch.nn as nn
import torch.nn.functional as F
class down(nn.Module):
"""
A class for creating neural network blocks containing layers:
Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU
This is used in the UNet Class t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | samuelpietri/Super-SloMo | down | false | 4,264 | [
"MIT"
] | 0 | e20eaa5550c30737be42b61f8e82e731cfd17457 | https://github.com/samuelpietri/Super-SloMo/tree/e20eaa5550c30737be42b61f8e82e731cfd17457 |
BellMembFunc | import torch
def _mk_param(val):
"""Make a torch parameter from a scalar value"""
if isinstance(val, torch.Tensor):
val = val.item()
return torch.nn.Parameter(torch.tensor(val, dtype=torch.float))
class BellMembFunc(torch.nn.Module):
"""
Generalised Bell membership function; defined ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | samxu0823/anfis-pytorch | BellMembFunc | false | 4,265 | [
"MIT"
] | 0 | b4ec3f0e8259963800e9e0a2904a580d1e56cc1c | https://github.com/samxu0823/anfis-pytorch/tree/b4ec3f0e8259963800e9e0a2904a580d1e56cc1c |
qd | import torch
import torch.nn.functional as F
import torch.nn as nn
class qd(nn.Module):
def __init__(self, d_dim, x_dim, y_dim, z_dim):
super(qd, self).__init__()
self.fc1 = nn.Linear(z_dim, d_dim)
torch.nn.init.xavier_uniform_(self.fc1.weight)
self.fc1.bias.data.zero_()
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 import triton_helpers
import torch.nn as nn
assert_... | sautami26/DIVA | qd | false | 4,266 | [
"MIT"
] | 0 | 52af683db216cb6e2ac777597fd9ec744ce7c8f2 | https://github.com/sautami26/DIVA/tree/52af683db216cb6e2ac777597fd9ec744ce7c8f2 |
ConditionalBatchNorm2d | import torch
import torch.nn as nn
from torch.nn import Parameter
def l2normalize(v, eps=0.0001):
return v / (v.norm() + eps)
class SpectralNorm(nn.Module):
def __init__(self, module, name='weight', power_iterations=1):
super(SpectralNorm, self).__init__()
self.module = module
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | samuelemarro/anne | ConditionalBatchNorm2d | false | 4,267 | [
"MIT"
] | 0 | 918022eb029a46fbfd1589369e9817f570d5651c | https://github.com/samuelemarro/anne/tree/918022eb029a46fbfd1589369e9817f570d5651c |
GlobalAvgPool1d | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from abc import abstractmethod
from torch.nn import functional
class AvgPool(nn.Module):
"""
AvgPool Module.
"""
def __init__(self):
super().__init__()
@abstractmethod
def forward(s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from abc import abstractmethod
assert_size_stride ... | savan77/nni | GlobalAvgPool1d | false | 4,268 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
DeepQNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class DeepQNetwork(nn.Module):
def __init__(self, imagesize, num_input_frames, num_actions, **kwargs):
super(DeepQNetwork, self).__init__()
self.conv1 = nn.Conv2d(in_channels=num_input_frames, out_channels=
32, kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | sanmusane/AIGames | DeepQNetwork | false | 4,269 | [
"MIT"
] | 0 | 3f4eecdd02089911d1989e40e2b336e13b800e55 | https://github.com/sanmusane/AIGames/tree/3f4eecdd02089911d1989e40e2b336e13b800e55 |
Mask | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class Mask(nn.Module):
def forward(self, seq, mask):
seq_mask = torch.unsqueeze(mask, 2)
seq_mask = torch.transpose(seq_mask.repeat(1, 1, seq.size()[1]), 1, 2)
return seq.where(torch.eq(... | 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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | savan77/nni | Mask | false | 4,270 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
Pooling | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class ReLUConvBN(nn.Module):
"""
Parameters
---
C_in: int
the number of input channels
C_out: int
the number of output channels
stride: int
stride of the convolution
... | 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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | savan77/nni | Pooling | false | 4,271 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
BackboneModel1 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class BackboneModel1(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 1, 1, 1)
def forward(self, x):
return self.conv1(x)
def get_inputs():
return ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | savan77/nni | BackboneModel1 | false | 4,272 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
InteractiveKLLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class InteractiveKLLoss(nn.Module):
def __init__(self, temperature):
super().__init__()
self.temperature = temperature
self.kl_loss = nn.KLDivLoss()
... | 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... | savan77/nni | InteractiveKLLoss | false | 4,273 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
GAT | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class GraphAttention(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttention, 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.... | NightmareNyx/pygcn | GAT | false | 4,274 | [
"MIT"
] | 0 | 3972f167ce7fcc41cb21284d75816dfd9a15f7ef | https://github.com/NightmareNyx/pygcn/tree/3972f167ce7fcc41cb21284d75816dfd9a15f7ef |
Auto_Encoder_Model | import torch
import torch.nn as nn
import torch.nn.functional as F
class Auto_Encoder_Model(nn.Module):
def __init__(self):
super(Auto_Encoder_Model, self).__init__()
self.conv1 = nn.Conv2d(1, 64, padding=1, kernel_size=3)
self.max_pool1 = nn.MaxPool2d(2)
self.conv2 = nn.Conv2d(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
import ... | sarahESL/MICCAI19-MedVQA | Auto_Encoder_Model | false | 4,275 | [
"MIT"
] | 0 | aa751cb905f79cd356ad5746f8a0640f1d81b5d2 | https://github.com/sarahESL/MICCAI19-MedVQA/tree/aa751cb905f79cd356ad5746f8a0640f1d81b5d2 |
ZeroLayer | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class ZeroLayer(nn.Module):
def __init__(self, stride):
super(ZeroLayer, self).__init__()
self.stride = stride
def forward(self, x):
"""n, c, h, w = x.size()
h //= self.stri... | 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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | savan77/nni | ZeroLayer | false | 4,276 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
FCNet | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class FCNet(nn.Module):
def __init__(self, input_size, output_size):
super().__init__()
self.l1 = nn.Linear(input_size, 5)
self.relu = nn.ReLU()
self.l2 = nn.Linear(5, output_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | savan77/nni | FCNet | false | 4,277 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
LinearCombine | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class LinearCombine(nn.Module):
def __init__(self, layers_num, trainable=True, input_aware=False,
word_level=False):
super(LinearCombine, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import ... | savan77/nni | LinearCombine | false | 4,278 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
TorchAdd | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class TorchAdd(nn.Module):
"""
TorchAdd Module.
"""
def forward(self, input_list):
return input_list[0] + input_list[1]
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_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 as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | savan77/nni | TorchAdd | false | 4,279 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
ActorCritic | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class ActorCritic(nn.Module):
def __init__(self, num_states, num_actions, hidden_size):
super(ActorCritic, self).__init__()
self.num_actions = num_actions
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | savan77/nni | ActorCritic | false | 4,280 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
LipschitzCube | import torch
from torch import nn
import torch.utils.data.distributed
class LipschitzCube(nn.Module):
def forward(self, x):
return (x >= 1) * (x - 2 / 3) + (x <= -1) * (x + 2 / 3) + (x > -1) * (x
< 1) * x ** 3 / 3
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_input... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda ... | rh-ia/color-information | LipschitzCube | false | 4,281 | [
"MIT"
] | 0 | e912a1667e4fffb339dbc574c85020ec6cf78b02 | https://github.com/rh-ia/color-information/tree/e912a1667e4fffb339dbc574c85020ec6cf78b02 |
ExtendedModel | import torch
import torch.nn as nn
class ExtendedModel(nn.Module):
def __init__(self, D_in, H, D_out):
"""
In the constructor we instantiate two nn.Linear modules and assign them as
member variables.
"""
super(ExtendedModel, self).__init__()
self.linear1 = 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
import torch.nn as nn
assert_... | sauyon/BentoML | ExtendedModel | false | 4,282 | [
"Apache-2.0"
] | 0 | ff702f1fc1ee7cc4cf7aab2e67d1e27512858fe4 | https://github.com/sauyon/BentoML/tree/ff702f1fc1ee7cc4cf7aab2e67d1e27512858fe4 |
FullSort | import torch
from torch import nn
import torch.utils.data.distributed
class FullSort(nn.Module):
def forward(self, x):
return torch.sort(x, 1)[0]
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
import torch.utils.data.distributed
assert_size_stride = torch._C._d... | rh-ia/color-information | FullSort | false | 4,283 | [
"MIT"
] | 0 | e912a1667e4fffb339dbc574c85020ec6cf78b02 | https://github.com/rh-ia/color-information/tree/e912a1667e4fffb339dbc574c85020ec6cf78b02 |
Clamp | import torch
from torch import nn
import torch.utils.data
class Clamp(nn.Module):
def __init__(self, min_out=-3, max_out=3):
super().__init__()
self.min_out = min_out
self.max_out = max_out
def forward(self, input):
return input.clamp(self.min_out, self.max_out)
def get_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 import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards... | sbuschjaeger/Pysembles | Clamp | false | 4,284 | [
"MIT"
] | 0 | 7e69b0975a7d4373242c7026ade6c5fdbad4fe67 | https://github.com/sbuschjaeger/Pysembles/tree/7e69b0975a7d4373242c7026ade6c5fdbad4fe67 |
SpatialAttentionGate | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class SpatialAttentionGate(nn.Module):
def __init__(self, channel, reduction=16):
super(SpatialAttentionGate, self).__init__()
self.fc1 = nn.Conv2d(channel, reduc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | savan77/nni | SpatialAttentionGate | false | 4,285 | [
"MIT"
] | 0 | 510213393d9cae58c5a8cccd21f322f7bba4e0cf | https://github.com/savan77/nni/tree/510213393d9cae58c5a8cccd21f322f7bba4e0cf |
FlexibleDropout | import torch
import torch.nn as nn
from torch.distributions import Bernoulli
class FlexibleDropout(nn.Module):
"""FlexibleDropout disconnects the sampling step from the masking step of dropout.
There are two important differences between FlexibleDropout and nn.Dropout. First, FlexibleDropout exposes a
sa... | 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 torch.distributions import Bernoulli
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_stride... | scfrank/deep-generative-lm | FlexibleDropout | false | 4,286 | [
"MIT"
] | 0 | 70067fcda82aa035bba805ce6c2709097166a7a4 | https://github.com/scfrank/deep-generative-lm/tree/70067fcda82aa035bba805ce6c2709097166a7a4 |
BertImagePooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.multiprocessing
class BertImagePooler(nn.Module):
def __init__(self, config):
super(BertImagePooler, self).__init__()
self.dense = nn.Linear(config.v_hidden_size, config.bi_hidden_size)
self.acti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | ayushjain1144/vilbert-multi-task | BertImagePooler | false | 4,287 | [
"MIT"
] | 0 | cf30feee9617dd92bb030f380f8b59388b7054f6 | https://github.com/ayushjain1144/vilbert-multi-task/tree/cf30feee9617dd92bb030f380f8b59388b7054f6 |
LipNormConv2d | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data.distributed
def _max_except_dim(input, dim):
maxed = input
for axis in range(input.ndimension() - 1, dim, -1):
maxed, _ = maxed.max(axis, keepdim=True)
for axis in range(dim - 1, -1, -1):
maxed, _ = m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch im... | rh-ia/color-information | LipNormConv2d | false | 4,288 | [
"MIT"
] | 0 | e912a1667e4fffb339dbc574c85020ec6cf78b02 | https://github.com/rh-ia/color-information/tree/e912a1667e4fffb339dbc574c85020ec6cf78b02 |
RelevanceVector | import torch
import torch.nn as nn
class RelevanceVector(nn.Module):
def __init__(self, z_dim):
super(RelevanceVector, self).__init__()
self.rvlogit = nn.Parameter(0.001 * torch.randn(z_dim))
def forward(self):
rv = torch.sigmoid(self.rvlogit)
return self.rvlogit, rv
def ge... | 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... | seqam-lab/rfvae | RelevanceVector | false | 4,289 | [
"MIT"
] | 0 | 07089e2cca6d51f305731750c2c67b83a42df12a | https://github.com/seqam-lab/rfvae/tree/07089e2cca6d51f305731750c2c67b83a42df12a |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64, fc2=128):
"""Initialize parameters and build model.
Params
======
state_size (int): 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_... | schottkey7/deep-reinforcement-learning | QNetwork | false | 4,290 | [
"MIT"
] | 0 | 92c97fadbb5b95caa3fd3813a0757debc2c2747a | https://github.com/schottkey7/deep-reinforcement-learning/tree/92c97fadbb5b95caa3fd3813a0757debc2c2747a |
LipNormLinear | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data.distributed
def _max_except_dim(input, dim):
maxed = input
for axis in range(input.ndimension() - 1, dim, -1):
maxed, _ = maxed.max(axis, keepdim=True)
for axis in range(dim - 1, -1, -1):
maxed, _ = m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch im... | rh-ia/color-information | LipNormLinear | false | 4,291 | [
"MIT"
] | 0 | e912a1667e4fffb339dbc574c85020ec6cf78b02 | https://github.com/rh-ia/color-information/tree/e912a1667e4fffb339dbc574c85020ec6cf78b02 |
Net1 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
class Net1(nn.Module):
def __init__(self):
super(Net1, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 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
import ... | sermolin/amazon-sagemaker-examples | Net1 | false | 4,292 | [
"Apache-2.0"
] | 0 | 3e6083d1b53cb718893a04c46513a9482a17bd6b | https://github.com/sermolin/amazon-sagemaker-examples/tree/3e6083d1b53cb718893a04c46513a9482a17bd6b |
DemodulatedConv2d | import torch
import torch.utils.data
import torch
from torchvision.transforms import functional as F
import torch.nn as nn
from torch.nn import functional as F
class DemodulatedConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size=3, stride=1,
padding=0, bias=False, dilation=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.triton_helpers import libdevice
import torch.utils.... | seawee1/ForkGAN-pytorch | DemodulatedConv2d | false | 4,293 | [
"BSD-3-Clause"
] | 0 | 02d721875d47e4a1e96a14cc4770edcb6b68a5d0 | https://github.com/seawee1/ForkGAN-pytorch/tree/02d721875d47e4a1e96a14cc4770edcb6b68a5d0 |
ATLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class ATLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logits, labels):
th_label = torch.zeros_like(labels, dtype=torch.float)
th_label[:, 0] = 1.0
labels[:, 0] = 0.0
p_mask ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | seanswyi/R-BERT | ATLoss | false | 4,294 | [
"Apache-2.0"
] | 0 | 4a4aeab3a9314307ce4458bd2b943d94aaf4a706 | https://github.com/seanswyi/R-BERT/tree/4a4aeab3a9314307ce4458bd2b943d94aaf4a706 |
Planar | import torch
import torch.nn as nn
class PlanarStep(nn.Module):
def __init__(self):
super(PlanarStep, self).__init__()
self.h = nn.Tanh()
self.softplus = nn.Softplus()
def _der_h(self, x):
"""Derivative of activation function h."""
return self._der_tanh(x)
def _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.triton_helpers import libdevice, math as tl_math
im... | scfrank/deep-generative-lm | Planar | false | 4,295 | [
"MIT"
] | 0 | 70067fcda82aa035bba805ce6c2709097166a7a4 | https://github.com/scfrank/deep-generative-lm/tree/70067fcda82aa035bba805ce6c2709097166a7a4 |
Decoder_h | import torch
import torch.distributions as dist
import torch.nn as nn
class Decoder_h(nn.Module):
def __init__(self, B, H_dim):
super().__init__()
self.B = B
self.H_dim = H_dim
self.make_parameters()
def make_parameters(self):
self.mu = nn.Linear(self.H_dim, self.B, b... | 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.distributions as dist
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda ... | shaabhishek/pp_lvm | Decoder_h | false | 4,296 | [
"Apache-2.0"
] | 0 | 0fcceb7f004ab01da7c5508b576983b9d4af36c8 | https://github.com/shaabhishek/pp_lvm/tree/0fcceb7f004ab01da7c5508b576983b9d4af36c8 |
VDB | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class VDB(nn.Module):
def __init__(self, num_inputs, args):
super(VDB, self).__init__()
self.fc1 = nn.Linear(num_inputs, args.hidden_size)
self.fc2 = nn.Linear(args.hidden_size, args.z_size)
self.fc3 ... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libd... | sgrimbly/lets-do-irl | VDB | false | 4,297 | [
"MIT"
] | 0 | 4233e238342394feef6a7bd495cc6b700d435b00 | https://github.com/sgrimbly/lets-do-irl/tree/4233e238342394feef6a7bd495cc6b700d435b00 |
FCDiscriminator_low | import torch
from torch import nn
class FCDiscriminator_low(nn.Module):
def __init__(self, inplanes, planes=64):
super(FCDiscriminator_low, self).__init__()
self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, stride=2,
padding=1)
self.conv2 = nn.Conv2d(planes, planes * 2, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | seabearlmx/PA-DAN | FCDiscriminator_low | false | 4,298 | [
"MIT"
] | 0 | bdd1200396d102e68acdd265db9d22ddb83b6404 | https://github.com/seabearlmx/PA-DAN/tree/bdd1200396d102e68acdd265db9d22ddb83b6404 |
ParallelPolarizedSelfAttention | import torch
from torch import nn
class ParallelPolarizedSelfAttention(nn.Module):
def __init__(self, channel=512):
super().__init__()
self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1))
self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1))
self.softmax_channel = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | rushirajsherlocked/External-Attention-pytorch | ParallelPolarizedSelfAttention | false | 4,299 | [
"MIT"
] | 0 | 7d6814b2d90909adf81c62f3f8a89e30a59d6481 | https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | sermolin/amazon-sagemaker-examples | BertSelfAttention | false | 4,300 | [
"Apache-2.0"
] | 0 | 3e6083d1b53cb718893a04c46513a9482a17bd6b | https://github.com/sermolin/amazon-sagemaker-examples/tree/3e6083d1b53cb718893a04c46513a9482a17bd6b |
BaselineNN | import torch
from torch import nn
import torch.nn.functional as F
class BaselineNN(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(4, 32)
self.fc2 = nn.Linear(32, 32)
self.fc3 = nn.Linear(32, 32)
self.fc4 = nn.Linear(32, 32)
self.fc5 = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | severilov/master-thesis | BaselineNN | false | 4,301 | [
"MIT"
] | 0 | 145382d5d551761fcdbd2b77d7b96fabcc8f78ec | https://github.com/severilov/master-thesis/tree/145382d5d551761fcdbd2b77d7b96fabcc8f78ec |
Maxout | import torch
from torch import nn
class Maxout(nn.Module):
def __init__(self, in_features, out_features):
super(Maxout, self).__init__()
self.layer1 = nn.Linear(in_features, out_features)
self.layer2 = nn.Linear(in_features, out_features)
def forward(self, x):
output1 = self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | shadow2496/KAIST_2019_Deep-Learning_HW4 | Maxout | false | 4,302 | [
"MIT"
] | 0 | f837ee23816c7486952733925b1f338b54d7086f | https://github.com/shadow2496/KAIST_2019_Deep-Learning_HW4/tree/f837ee23816c7486952733925b1f338b54d7086f |
ResidualAttention | import torch
from torch import nn
class ResidualAttention(nn.Module):
def __init__(self, channel=512, num_class=1000, la=0.2):
super().__init__()
self.la = la
self.fc = nn.Conv2d(in_channels=channel, out_channels=num_class,
kernel_size=1, stride=1, bias=False)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | rushirajsherlocked/External-Attention-pytorch | ResidualAttention | false | 4,303 | [
"MIT"
] | 0 | 7d6814b2d90909adf81c62f3f8a89e30a59d6481 | https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481 |
LipSwish | import torch
class LipSwish(torch.nn.Module):
def forward(self, x):
return 0.909 * torch.nn.functional.silu(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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | shi27feng/torchsde | LipSwish | false | 4,304 | [
"Apache-2.0"
] | 0 | 58105bb6b839766c1d27b73c4fe3f949869d7394 | https://github.com/shi27feng/torchsde/tree/58105bb6b839766c1d27b73c4fe3f949869d7394 |
Actor | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class Actor(nn.Module):
def __init__(self, num_inputs, num_outputs, args):
super(Actor, self).__init__()
self.fc1 = nn.Linear(num_inputs, args.hidden_size)
self.fc2 = nn.Linear(args.hidden_size, args.hidden_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 ... | sgrimbly/lets-do-irl | Actor | false | 4,305 | [
"MIT"
] | 0 | 4233e238342394feef6a7bd495cc6b700d435b00 | https://github.com/sgrimbly/lets-do-irl/tree/4233e238342394feef6a7bd495cc6b700d435b00 |
Encoder1 | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
def kaiming_init(m):
if isinstance(m, (nn.Linear, nn.Conv2d)):
init.kaiming_normal_(m.weight)
if m.bias is not None:
m.bias.data.fill_(0)
elif isinstance(m, (nn.BatchNorm1d, nn.BatchNorm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | seqam-lab/rfvae | Encoder1 | false | 4,306 | [
"MIT"
] | 0 | 07089e2cca6d51f305731750c2c67b83a42df12a | https://github.com/seqam-lab/rfvae/tree/07089e2cca6d51f305731750c2c67b83a42df12a |
SelfAttention | import torch
import torch.nn as nn
from torch.nn import functional as F
class SelfAttention(nn.Module):
"""
Implementation of the attention block
"""
def __init__(self, input_size, hidden_size, output_size):
super(SelfAttention, self).__init__()
self.layer1 = 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 import triton_helpers
from torch._inductor.runtime.... | shahrukhx01/model_serve_pytorch | SelfAttention | false | 4,307 | [
"MIT"
] | 0 | c97ab45264b41ce349828e8b230ed85a51d6b213 | https://github.com/shahrukhx01/model_serve_pytorch/tree/c97ab45264b41ce349828e8b230ed85a51d6b213 |
Discriminator | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, num_inputs, args):
super(Discriminator, self).__init__()
self.fc1 = nn.Linear(num_inputs, args.hidden_size)
self.fc2 = nn.Linear(args.hidden_size, args.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.triton_helpers import libdevice
import torch.nn as ... | sgrimbly/lets-do-irl | Discriminator | false | 4,308 | [
"MIT"
] | 0 | 4233e238342394feef6a7bd495cc6b700d435b00 | https://github.com/sgrimbly/lets-do-irl/tree/4233e238342394feef6a7bd495cc6b700d435b00 |
Attention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import *
class Attention(nn.Module):
def __init__(self, opt):
super(Attention, self).__init__()
self.rnn_size = opt.rnn_size
self.att_hid_size = opt.att_hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Romero027/ImageCaptioning.pytorch | Attention | false | 4,309 | [
"MIT"
] | 0 | 069c95f5d343fb126afa8b10ec18e472f30b7b35 | https://github.com/Romero027/ImageCaptioning.pytorch/tree/069c95f5d343fb126afa8b10ec18e472f30b7b35 |
DeltaGFit | import torch
from scipy import constants
import torch.nn as nn
import torch as t
class DeltaGFit(nn.Module):
def __init__(self, deltaG):
super(DeltaGFit, self).__init__()
self.deltaG = deltaG
def forward(self, temperature, X, k_int, timepoints):
"""
# inputs, list of:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | sajetan/PyHDX | DeltaGFit | false | 4,310 | [
"MIT"
] | 0 | f764849e33b2dd1bcae5824795a38c64ef01e13c | https://github.com/sajetan/PyHDX/tree/f764849e33b2dd1bcae5824795a38c64ef01e13c |
SequentialPolarizedSelfAttention | import torch
from torch import nn
class SequentialPolarizedSelfAttention(nn.Module):
def __init__(self, channel=512):
super().__init__()
self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1))
self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1))
self.softmax_channel = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | rushirajsherlocked/External-Attention-pytorch | SequentialPolarizedSelfAttention | false | 4,311 | [
"MIT"
] | 0 | 7d6814b2d90909adf81c62f3f8a89e30a59d6481 | https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481 |
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.... | seulbinHwang/DeepReinforcementLearningInAction | SimulatorReward | false | 4,312 | [
"MIT"
] | 0 | c9039fd6951c46c8902cda04580c69159d172c82 | https://github.com/seulbinHwang/DeepReinforcementLearningInAction/tree/c9039fd6951c46c8902cda04580c69159d172c82 |
VNLinear | import torch
import torch.nn as nn
import torch.utils.data
import torch
import torch.nn.parallel
class VNLinear(nn.Module):
def __init__(self, in_channels, out_channels):
super(VNLinear, self).__init__()
self.map_to_feat = nn.Linear(in_channels, out_channels, bias=False)
def forward(self, x)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch
import torch.nn.paral... | shiyani21/vnn | VNLinear | false | 4,313 | [
"MIT"
] | 0 | 921be51d6651ff32bff895f4da99ef83d50900da | https://github.com/shiyani21/vnn/tree/921be51d6651ff32bff895f4da99ef83d50900da |
ConvAutoencoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvAutoencoder(nn.Module):
"""Simple convolutional autoencoder
...
Methods
-------
forward(x)
Forward pass of x
"""
def __init__(self):
super(ConvAutoencoder, self).__init__()
self.conv_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | shankal17/Autoencoders | ConvAutoencoder | false | 4,314 | [
"MIT"
] | 0 | 17aa9f1fe573008fa84694e30e9d395127684191 | https://github.com/shankal17/Autoencoders/tree/17aa9f1fe573008fa84694e30e9d395127684191 |
GatedLinearUnit | import torch
import torch.nn as nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, hidden_layer_size, dropout_rate,
activation=None):
super(GatedLinearUnit, self).__init__()
self.input_size = input_size
self.hidden_layer_size = hidden_layer_size
self.dropo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | sherpahu/AutoX | GatedLinearUnit | false | 4,315 | [
"Apache-2.0"
] | 0 | 37aca6bb848ecfdde6868b9f8eb869563fece3eb | https://github.com/sherpahu/AutoX/tree/37aca6bb848ecfdde6868b9f8eb869563fece3eb |
MLP | import torch
from torch import nn
from torch.nn import functional as F
class MLP(torch.nn.Module):
"""MLP for patch segmentation."""
def __init__(self, n_classes, input_dim):
super().__init__()
self.layer_1 = nn.Linear(input_dim, 200)
self.layer_2 = nn.Linear(200, 100)
self.la... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | sachaMorin/dino | MLP | false | 4,316 | [
"Apache-2.0"
] | 0 | b5c42ecffb535a8e6735c63ddc314118927cfd52 | https://github.com/sachaMorin/dino/tree/b5c42ecffb535a8e6735c63ddc314118927cfd52 |
ContinuousLoss_L2 | import torch
import torch.nn as nn
class ContinuousLoss_L2(nn.Module):
""" Class to measure loss between continuous emotion dimension predictions and labels. Using l2 loss as base. """
def __init__(self, margin=1):
super(ContinuousLoss_L2, self).__init__()
self.margin = margin
def forwar... | 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
... | shrookehab/Body-Language-and-Emotion-Recognition | ContinuousLoss_L2 | false | 4,317 | [
"MIT"
] | 0 | a13068be1f8599fa2df6db925a98ac64fd2adf42 | https://github.com/shrookehab/Body-Language-and-Emotion-Recognition/tree/a13068be1f8599fa2df6db925a98ac64fd2adf42 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
"""policy-value network module"""
def __init__(self, board_width, board_height):
super(Net, self).__init__()
self.board_width = board_width
self.board_height = board_height
self.conv1 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | sewon0918/pj4 | Net | false | 4,318 | [
"MIT"
] | 0 | 144996e7f99e7639f1fffb34770ab9713307428d | https://github.com/sewon0918/pj4/tree/144996e7f99e7639f1fffb34770ab9713307428d |
MyBatchNorm | import torch
import torch.nn as nn
class MyBatchNorm(nn.Module):
def __init__(self, size, epsilon=1e-05):
super(MyBatchNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(size))
self.beta = nn.Parameter(torch.zeros(size))
self.epsilon = epsilon
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | shohamda/deep-learning | MyBatchNorm | false | 4,319 | [
"MIT"
] | 0 | 160296c403cefd5351ffe5161e07789c22637284 | https://github.com/shohamda/deep-learning/tree/160296c403cefd5351ffe5161e07789c22637284 |
MSELoss | import torch
import torch._C
import torch.serialization
from torch import nn
import torch.nn.functional as F
from typing import *
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "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
import torch._C
import torch.serialization
from torch import nn
import torch.nn.functional as F
from typing import *
assert_size_stride = to... | shuaizzZ/mmsegmentation | MSELoss | false | 4,320 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
GCN | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.functional as F
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | shovalf/OGRE-1 | GCN | false | 4,321 | [
"MIT"
] | 0 | 08efad50fac27e8c9621897838e122a2e8fdae1c | https://github.com/shovalf/OGRE-1/tree/08efad50fac27e8c9621897838e122a2e8fdae1c |
ECA | import torch
import torch._C
import torch.serialization
from torch import nn
from typing import *
def int_size(x):
size = tuple(int(s) for s in x.size())
return size
class ECA(nn.Module):
"""Constructs a ECA module.
Args:
channel: Number of channels of the input feature map
k_size: A... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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._C
import torch.serialization
from torch import nn
from typing impo... | shuaizzZ/mmsegmentation | ECA | false | 4,322 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
Mix2Pooling | import torch
import torch._C
import torch.serialization
from torch import nn
from typing import *
class Mix2Pooling(nn.Module):
def __init__(self, size):
super(Mix2Pooling, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(size)
self.max_pool = nn.AdaptiveMaxPool2d(size)
def forw... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch._C
import torch.serialization
from torch import nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.assert_siz... | shuaizzZ/mmsegmentation | Mix2Pooling | false | 4,323 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
CDiceLoss | import torch
import torch._C
import torch.serialization
from torch import nn
import torch.nn.functional as F
from typing import *
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch._C
import... | shuaizzZ/mmsegmentation | CDiceLoss | false | 4,324 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
SpatialAttention | import torch
import torch._C
import torch.serialization
from torch import nn
from typing import *
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch._C
import torch.... | shuaizzZ/mmsegmentation | SpatialAttention | false | 4,325 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
RecallLoss | import torch
import torch._C
import torch.serialization
from torch import nn
import torch.nn.functional as F
from typing import *
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch._C
import... | shuaizzZ/mmsegmentation | RecallLoss | false | 4,326 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
ContrastiveLoss | import torch
from torch import nn
from torch.nn import functional as F
class ContrastiveLoss(nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin=5.0):
super(ContrastiveLoss, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_... | shuuchen/siamese_network | ContrastiveLoss | false | 4,327 | [
"Apache-2.0"
] | 0 | 54a952d320800c6bb5618cb40386e4c25bdde6fb | https://github.com/shuuchen/siamese_network/tree/54a952d320800c6bb5618cb40386e4c25bdde6fb |
TripletLoss | import torch
from torch import nn
from torch.nn.modules.distance import PairwiseDistance
class TripletLoss(nn.Module):
def __init__(self, margin=5.0):
super(TripletLoss, self).__init__()
self.margin = margin
self.pdist = PairwiseDistance(2)
def forward(self, anchor, negative, positiv... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | shuuchen/siamese_network | TripletLoss | false | 4,328 | [
"Apache-2.0"
] | 0 | 54a952d320800c6bb5618cb40386e4c25bdde6fb | https://github.com/shuuchen/siamese_network/tree/54a952d320800c6bb5618cb40386e4c25bdde6fb |
BinaryFocalLossWithLogits | import torch
import warnings
from typing import Optional
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def binary_focal_loss_with_logits(input: 'torch.Tensor', target:
'torch.Tensor', alpha: 'float'=0.25, gamma: 'float'=2.0, reduction:
'str'='none', eps: 'Optional[float]'=None)... | 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 warn... | shubham-gupta-iitr/mmmlX | BinaryFocalLossWithLogits | false | 4,329 | [
"Apache-2.0"
] | 0 | 3485e6191e0e45bf1c8168e4e928a36ab9264d22 | https://github.com/shubham-gupta-iitr/mmmlX/tree/3485e6191e0e45bf1c8168e4e928a36ab9264d22 |
FCDiscriminator | import torch
import torch.nn as nn
import torch.utils.data
class FCDiscriminator(nn.Module):
"""
inplanes, planes. Patch-gan
"""
def __init__(self, inplanes, planes=64):
super(FCDiscriminator, self).__init__()
self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, stride=2,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | shiyutang/ProDA | FCDiscriminator | false | 4,330 | [
"MIT"
] | 0 | 38209ced03c6044743273bb60e07cd915ac2ae12 | https://github.com/shiyutang/ProDA/tree/38209ced03c6044743273bb60e07cd915ac2ae12 |
F1Loss | import torch
import torch._C
import torch.serialization
from torch import nn
import torch.nn.functional as F
from typing import *
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "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
import torch._C
import torch.serialization
from torch import nn
import torch.nn.functional as F
from typing import *
assert_size_stride = to... | shuaizzZ/mmsegmentation | F1Loss | false | 4,331 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
NonLocal | import torch
import torch._C
import torch.serialization
from torch import nn
from typing import *
def int_size(x):
size = tuple(int(s) for s in x.size())
return size
class NonLocal(nn.Module):
def __init__(self, in_channels):
super(NonLocal, self).__init__()
self.inter_channel = 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
from torch._inductor.runtime.... | shuaizzZ/mmsegmentation | NonLocal | false | 4,332 | [
"Apache-2.0"
] | 0 | a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c | https://github.com/shuaizzZ/mmsegmentation/tree/a6c6b348dbf8c4a0a39ffbdb832a1e82309c533c |
BertOutput | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.data
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-05):
"""Construct a layernorm module in the TF style (epsilon inside the square root)."""
super(BertLayerNorm, self).__in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | shubham-gupta-iitr/mmmlX | BertOutput | false | 4,333 | [
"Apache-2.0"
] | 0 | 3485e6191e0e45bf1c8168e4e928a36ab9264d22 | https://github.com/shubham-gupta-iitr/mmmlX/tree/3485e6191e0e45bf1c8168e4e928a36ab9264d22 |
GELU | import math
import torch
from torch import nn
class GELU(nn.Module):
def __init__(self):
super(GELU, self).__init__()
def forward(self, tensor):
geluPow = tensor + 0.044715 * torch.pow(tensor, 3)
geluTanh = torch.tanh(math.sqrt(2 / math.pi) * geluPow)
geluResult = 1 + geluTan... | 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... | simonepreite/QABERT | GELU | false | 4,334 | [
"MIT"
] | 0 | ed3e49f6619f3ff660068291231909693cb8f5d5 | https://github.com/simonepreite/QABERT/tree/ed3e49f6619f3ff660068291231909693cb8f5d5 |
RefModel1d | import torch
import torch.nn.functional as F
class RefModel1d(torch.nn.Module):
"""The 3D reference model."""
def __init__(self):
super().__init__()
self.l1 = torch.nn.Conv1d(2, 2, 1, bias=True)
self.l2 = torch.nn.InstanceNorm1d(2, affine=True)
self.l3 = torch.nn.ReLU()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | shuohan/pytorch-layers | RefModel1d | false | 4,335 | [
"MIT"
] | 0 | 020846fd02d501cf477552179c19ba4b5e9a0695 | https://github.com/shuohan/pytorch-layers/tree/020846fd02d501cf477552179c19ba4b5e9a0695 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.