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 |
|---|---|---|---|---|---|---|---|---|---|---|
MaxPool | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class MaxPool(nn.Module):
def __init__(self, kernel_size, stride=1, padding=1, zero_pad=False):
super(MaxPool, self).__init__()
self.zero_pad = nn.ZeroPad2d((1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
... | Ramstein/Retinopathy2 | MaxPool | false | 974 | [
"MIT"
] | 0 | 669e74206c466e6351d4e3df6087c6aa39b5c6c2 | https://github.com/Ramstein/Retinopathy2/tree/669e74206c466e6351d4e3df6087c6aa39b5c6c2 |
LinearEnsemble | import torch
import torch as T
import torch.nn as nn
class LinearEnsemble(nn.Module):
__constants__ = ['in_features', 'out_features']
ensemble_size: 'int'
in_features: 'int'
out_features: 'int'
weight: 'T.Tensor'
def __init__(self, ensemble_size: 'int', in_features: 'int',
out_feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 as T
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | RamiSketcher/AMMI-RL | LinearEnsemble | false | 975 | [
"MIT"
] | 0 | 6d51587ff4d5dc14cba87fca561bd7b340b44586 | https://github.com/RamiSketcher/AMMI-RL/tree/6d51587ff4d5dc14cba87fca561bd7b340b44586 |
WordPredictor | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.jit.quantized
import torch.onnx.operators
class WordPredictor(nn.Module):
def __init__(self, encoder_output_dim, hidden_dim, output_dim,
topk_labels_per_source_token=None, use_self_attention=False):
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | ROCmSoftwarePlatform/translate | WordPredictor | false | 976 | [
"BSD-3-Clause"
] | 0 | 32a6380d914ebe1a6c38c4992aac9600ed3d9810 | https://github.com/ROCmSoftwarePlatform/translate/tree/32a6380d914ebe1a6c38c4992aac9600ed3d9810 |
GlobalAvgPool2d | import torch
import torch.nn as nn
import torch.utils.data
class GlobalAvgPool2d(nn.Module):
def __init__(self):
"""Global average pooling over the input's spatial dimensions"""
super(GlobalAvgPool2d, self).__init__()
def forward(self, inputs):
in_size = inputs.size()
return ... | 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.... | Rming/Self-Correction-Human-Parsing | GlobalAvgPool2d | false | 977 | [
"MIT"
] | 0 | c2b711c0a11f3980a8bf4c7a2acf85d80732620a | https://github.com/Rming/Self-Correction-Human-Parsing/tree/c2b711c0a11f3980a8bf4c7a2acf85d80732620a |
CustomBatchNormManualModule | import torch
import torch.nn as nn
class CustomBatchNormManualFunction(torch.autograd.Function):
"""
This torch.autograd.Function implements a functional custom version of the batch norm operation for MLPs.
Using torch.autograd.Function allows you to write a custom backward function.
The function will... | 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_... | RaymondKoopmanschap/DL_assignment_code | CustomBatchNormManualModule | false | 978 | [
"MIT"
] | 0 | 68b3290be9fbd6c55433a7585e2cfa18e0f35f5c | https://github.com/RaymondKoopmanschap/DL_assignment_code/tree/68b3290be9fbd6c55433a7585e2cfa18e0f35f5c |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, latent_dim):
super(Encoder, self).__init__()
self.FC_input = nn.Linear(input_dim, hidden_dim)
self.FC_mean = nn.Linear(hidden_dim, latent_dim)
self.FC_var = nn.Linear(hidden_dim,... | 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 import triton_helpers
from... | RasmusJuul/dtu_mlops | Encoder | false | 979 | [
"Apache-2.0"
] | 0 | 98bca082067aa7575bb8e8193991723d474f0850 | https://github.com/RasmusJuul/dtu_mlops/tree/98bca082067aa7575bb8e8193991723d474f0850 |
Brightness | import torch
import torch.nn as nn
from torchvision import transforms as ttf
class Brightness(nn.Module):
def __init__(self, M):
super().__init__()
self.M = M
def forward(self, img):
return ttf.functional.adjust_brightness(img, self.M / 5.0)
def get_inputs():
return [torch.rand... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Hayoung93/UDA | Brightness | false | 980 | [
"Apache-2.0"
] | 0 | a587b01c76141d64e7cead55b62e0f3ed75890bf | https://github.com/Hayoung93/UDA/tree/a587b01c76141d64e7cead55b62e0f3ed75890bf |
RegKappa | import torch
from torch.nn.modules.loss import _Loss
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class RegKappa(_Loss):
def __init__(self, ignore_index=None):
super(RegKappa, self).__init__()
self.min = min
self.max = max
... | 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.nn.modules.loss i... | Ramstein/Retinopathy2 | RegKappa | false | 981 | [
"MIT"
] | 0 | 669e74206c466e6351d4e3df6087c6aa39b5c6c2 | https://github.com/Ramstein/Retinopathy2/tree/669e74206c466e6351d4e3df6087c6aa39b5c6c2 |
ScaledL2Norm | import torch
import torch.onnx
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledL2Norm(nn.Module):
def __init__(self, in_channels, initial_scale):
super(ScaledL2Norm, self).__init__()
self.in_channels = in_channels
self.scale = nn.Parameter(torch.Tensor(in_ch... | 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.onnx
import tor... | Richard-cpu2333/tx2dl | ScaledL2Norm | false | 982 | [
"Apache-2.0"
] | 0 | 985d9f9f24004271e85745a49252ab9922aec655 | https://github.com/Richard-cpu2333/tx2dl/tree/985d9f9f24004271e85745a49252ab9922aec655 |
CosineLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
class CosineLinear(nn.Module):
def __init__(self, in_features, out_features):
super(CosineLinear, self).__init__()
self.in_features = in_features
self.out_features = out_features
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.... | QingquanBao/Spear-Shield | CosineLinear | false | 983 | [
"Apache-2.0"
] | 0 | d57b8f4412c3d651b6f7e056c9c45cfd0dc950c3 | https://github.com/QingquanBao/Spear-Shield/tree/d57b8f4412c3d651b6f7e056c9c45cfd0dc950c3 |
MultiheadAttention | import math
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.jit.quantized
import torch.onnx.operators
def combine_heads(X):
"""
Combine heads (the inverse of split heads):
1) Transpose X from (batch size, nheads, sequence length, d_head) ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ROCmSoftwarePlatform/translate | MultiheadAttention | false | 984 | [
"BSD-3-Clause"
] | 0 | 32a6380d914ebe1a6c38c4992aac9600ed3d9810 | https://github.com/ROCmSoftwarePlatform/translate/tree/32a6380d914ebe1a6c38c4992aac9600ed3d9810 |
LogisticCumulativeLink | import torch
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class LogisticCumulativeLink(nn.Module):
"""
Converts a single number to the proportional odds of belonging to a class.
Parameters
----------
num_classes : int
... | 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.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
assert_size_str... | Ramstein/Retinopathy2 | LogisticCumulativeLink | false | 985 | [
"MIT"
] | 0 | 669e74206c466e6351d4e3df6087c6aa39b5c6c2 | https://github.com/Ramstein/Retinopathy2/tree/669e74206c466e6351d4e3df6087c6aa39b5c6c2 |
Beta | import torch
import torch.nn as nn
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__()
self.action_dim = action_d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | RohanPankaj/apex | Beta | false | 986 | [
"MIT"
] | 0 | 74e96386bf9446d1179106d6d65ea0368c1b5b27 | https://github.com/RohanPankaj/apex/tree/74e96386bf9446d1179106d6d65ea0368c1b5b27 |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self, n_channels, scale=1.0):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.scale = scale
self.eps = 1e-10
self.weight = nn.Parameter(torch.Tensor(self.n_channels))
self.wei... | 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_... | Rocketbase-AI/rockets-s3fd | L2Norm | false | 987 | [
"MIT"
] | 0 | 40d978270a6b3ba2d397217ede0c735712814250 | https://github.com/Rocketbase-AI/rockets-s3fd/tree/40d978270a6b3ba2d397217ede0c735712814250 |
RMSLELoss | import torch
import torch.nn as nn
class RMSLELoss(nn.Module):
def __init__(self):
super().__init__()
self.mse = nn.MSELoss()
def forward(self, pred, actual):
return torch.sqrt(self.mse(torch.log(pred + 1), torch.log(actual + 1)))
def get_inputs():
return [torch.rand([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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | RosarioAndolina/psychXRF | RMSLELoss | false | 988 | [
"MIT"
] | 0 | e2adadbd17664d7f74c10304f84b3751c571226e | https://github.com/RosarioAndolina/psychXRF/tree/e2adadbd17664d7f74c10304f84b3751c571226e |
SVIGlobalMeanPool2D | import torch
import torch.nn as nn
class SVIGlobalMeanPool2D(nn.Module):
"""
Expects
:param x: [examples, samples, channels, H, W]
:return: [examples, samples, channels]
"""
def __init__(self):
super(SVIGlobalMeanPool2D, self).__init__()
def forward(self, x):
x = x.mean(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | RomanShen/radial-bnn | SVIGlobalMeanPool2D | false | 989 | [
"Apache-2.0"
] | 0 | 7c8bc85397c1461a6fd5ea9adf0631f9ade27f6c | https://github.com/RomanShen/radial-bnn/tree/7c8bc85397c1461a6fd5ea9adf0631f9ade27f6c |
MAPE | import torch
import torch.nn as nn
class MAPE(nn.Module):
def __init__(self):
super().__init__()
self.l1 = nn.L1Loss(reduction='none')
def forward(self, pred, actual):
mape = 100 * self.l1(pred, actual) / torch.max(pred, actual)
return mape.mean()
def get_inputs():
retu... | 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
... | RosarioAndolina/psychXRF | MAPE | false | 990 | [
"MIT"
] | 0 | e2adadbd17664d7f74c10304f84b3751c571226e | https://github.com/RosarioAndolina/psychXRF/tree/e2adadbd17664d7f74c10304f84b3751c571226e |
MultiheadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
class MultiheadAttention(nn.Module):
"""Multi-headed attention.
See "Attention Is All You Need" for more details.
"""
def __init__(self, embed_dim, num_heads, attn_dropout=0.0, bias=True,
add_bia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Redaimao/RERD | MultiheadAttention | false | 991 | [
"MIT"
] | 0 | 40413d4b6743f3e5db0c30ee969d45661d001834 | https://github.com/Redaimao/RERD/tree/40413d4b6743f3e5db0c30ee969d45661d001834 |
SVIGlobalMaxPool2D | import torch
import torch.nn as nn
class SVIGlobalMaxPool2D(nn.Module):
"""
Expects
:param x: [examples, samples, channels, H, W]
:return: [examples, samples, channels]
"""
def __init__(self):
super(SVIGlobalMaxPool2D, self).__init__()
def forward(self, x):
x = x.max(4)[0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | RomanShen/radial-bnn | SVIGlobalMaxPool2D | false | 992 | [
"Apache-2.0"
] | 0 | 7c8bc85397c1461a6fd5ea9adf0631f9ade27f6c | https://github.com/RomanShen/radial-bnn/tree/7c8bc85397c1461a6fd5ea9adf0631f9ade27f6c |
Critic | import torch
import torch.nn.functional as f
from torch import nn
class Critic(nn.Module):
def __init__(self, input_dim):
super(Critic, self).__init__()
self._input_dim = input_dim
self.dense1 = nn.Linear(self._input_dim, self._input_dim)
self.dense2 = nn.Linear(self._input_dim, s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | RosalRicardo/RTRGAN | Critic | false | 993 | [
"MIT"
] | 0 | 6f4551ab8445367f8b9c711f41f15dd465abaef1 | https://github.com/RosalRicardo/RTRGAN/tree/6f4551ab8445367f8b9c711f41f15dd465abaef1 |
R2Score | import torch
import torch.nn as nn
class R2Score(nn.Module):
def __init__(self):
super().__init__()
def forward(self, pred, actual):
rss = ((actual - pred) ** 2).sum()
ym = actual.mean()
tss = ((actual - ym) ** 2).sum()
return 1 - rss / tss
def get_inputs():
ret... | 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... | RosarioAndolina/psychXRF | R2Score | false | 994 | [
"MIT"
] | 0 | e2adadbd17664d7f74c10304f84b3751c571226e | https://github.com/RosarioAndolina/psychXRF/tree/e2adadbd17664d7f74c10304f84b3751c571226e |
MultiHeadAttention | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttention(nn.Module):
def __init__(self, d_model, n_heads, p_drop=0.1):
super(MultiHeadAttention, self).__init__()
assert d_model % n_heads == 0
self.d_model = d_model
self.n_heads... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RegiusQuant/nlp-practice | MultiHeadAttention | false | 995 | [
"MIT"
] | 0 | ffa99aa585134941aa148da11775c2b16d42eef7 | https://github.com/RegiusQuant/nlp-practice/tree/ffa99aa585134941aa148da11775c2b16d42eef7 |
ACNet | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def from_numpy(np_array, dtype=np.float32):
if np_array.dtype != dtype:
np_array = np_array.astype(dtype)
return Variable(torch.from_numpy(np_array))
class ACNet(nn.Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | RocksonZeta/ac | ACNet | false | 996 | [
"MIT"
] | 0 | 050a5cd176864cc2e1f7c376045c3342a7f93221 | https://github.com/RocksonZeta/ac/tree/050a5cd176864cc2e1f7c376045c3342a7f93221 |
BReLU | import torch
import torch.nn as nn
class BReLU(nn.Module):
"""
Biased ReLU
BReLU(x) = ReLU(x) + b
Shape:
-Input: (N, *)
-Output: (N, *), same shape as the input
Parameters:
-in_features: number of input features
-b: fixed parameter (bias like for relu... | 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... | RosarioAndolina/psychXRF | BReLU | false | 997 | [
"MIT"
] | 0 | e2adadbd17664d7f74c10304f84b3751c571226e | https://github.com/RosarioAndolina/psychXRF/tree/e2adadbd17664d7f74c10304f84b3751c571226e |
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... | RohanPankaj/apex | Beta2 | false | 998 | [
"MIT"
] | 0 | 74e96386bf9446d1179106d6d65ea0368c1b5b27 | https://github.com/RohanPankaj/apex/tree/74e96386bf9446d1179106d6d65ea0368c1b5b27 |
LN_Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class LN_Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action, hidden_size1,
hidden_size2):
super(LN_Actor, self).__init__()
self.l1 = nn.Linear(state_dim, hidden_size1)
self.ln1 = nn.LayerNorm(hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RohanPankaj/apex | LN_Actor | false | 999 | [
"MIT"
] | 0 | 74e96386bf9446d1179106d6d65ea0368c1b5b27 | https://github.com/RohanPankaj/apex/tree/74e96386bf9446d1179106d6d65ea0368c1b5b27 |
CFReLU | import torch
import torch.nn as nn
import torch.nn.functional as F
class CFReLU(nn.Module):
"""
Custom FReLU
cfrelu(x) = relu(x + a) + b
see psychXRF.activation.FReLU
Shape:
-Input: (N, *)
-Output: (N, *), same shape as the input
Parameters:
-a: 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 as nn
import torch.nn.functional as F
assert_size_stride = torch._C._dyna... | RosarioAndolina/psychXRF | CFReLU | false | 1,000 | [
"MIT"
] | 0 | e2adadbd17664d7f74c10304f84b3751c571226e | https://github.com/RosarioAndolina/psychXRF/tree/e2adadbd17664d7f74c10304f84b3751c571226e |
LN_DDPGCritic | import torch
import torch.nn as nn
import torch.nn.functional as F
class LN_DDPGCritic(nn.Module):
def __init__(self, state_dim, action_dim, hidden_size1, hidden_size2):
super(LN_DDPGCritic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, hidden_size1)
self.ln1 = nn.LayerNorm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RohanPankaj/apex | LN_DDPGCritic | false | 1,001 | [
"MIT"
] | 0 | 74e96386bf9446d1179106d6d65ea0368c1b5b27 | https://github.com/RohanPankaj/apex/tree/74e96386bf9446d1179106d6d65ea0368c1b5b27 |
ReQUNet | import torch
import torch.nn as nn
def MyReQU(x):
x[x < 0] = 0
z = x * x
return z
class ReQUNet(nn.Module):
def __init__(self):
super(ReQUNet, self).__init__()
n_in, n_h, n_out = 4, 64, 3
self.fc1 = nn.Linear(n_in, n_h, True)
self.fc2 = nn.Linear(n_h, n_out, True)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | RoyHirsch/DeepLearningCourse | ReQUNet | false | 1,002 | [
"MIT"
] | 0 | 9036c0fdbb08b610524d7be991f8e4b490a82c6c | https://github.com/RoyHirsch/DeepLearningCourse/tree/9036c0fdbb08b610524d7be991f8e4b490a82c6c |
SumNorm | import torch
import torch.nn as nn
class SumNorm(nn.Module):
"""
Normalize dividing by the sum
Shape:
-Input: (N, *)
-Output: (N, *), same shape as the input
Parameters:
-in_features: number of input features
-dim(int): A dimension along witch sum will be comp... | 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... | RosarioAndolina/psychXRF | SumNorm | false | 1,003 | [
"MIT"
] | 0 | e2adadbd17664d7f74c10304f84b3751c571226e | https://github.com/RosarioAndolina/psychXRF/tree/e2adadbd17664d7f74c10304f84b3751c571226e |
PITF_Loss | import torch
import torch as t
import torch.nn as nn
class PITF_Loss(nn.Module):
"""
定义PITF的loss function
"""
def __init__(self):
super(PITF_Loss, self).__init__()
None
def forward(self, r_p, r_ne):
return -t.log(t.sigmoid(r_p - r_ne))
def get_inputs():
return [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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | SamHaoYuan/pitf | PITF_Loss | false | 1,004 | [
"MIT"
] | 0 | 5fdebc3b44c6462126876101b052a3980804da79 | https://github.com/SamHaoYuan/pitf/tree/5fdebc3b44c6462126876101b052a3980804da79 |
SpatialGather_Module | import torch
import torch.nn as nn
from torch.nn import functional as F
import torch._utils
import torch.optim
class SpatialGather_Module(nn.Module):
"""
Aggregate the context features according to the initial
predicted probability distribution.
Employ the soft-weighted method to aggregat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SSJIACV/HRNet-Semantic-Segmentation | SpatialGather_Module | false | 1,005 | [
"MIT"
] | 0 | 7e2840ce7a91ae3845dfb203c992f84affa15e40 | https://github.com/SSJIACV/HRNet-Semantic-Segmentation/tree/7e2840ce7a91ae3845dfb203c992f84affa15e40 |
_boundary | import torch
from torch import nn
class _boundary(nn.Module):
def __init__(self, dim):
super(_boundary, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(dim, dim, kernel_size=3, padding=1)
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
from torch import nn
assert_s... | STARBOYsachin/semantic-segmentation | _boundary | false | 1,006 | [
"MIT"
] | 0 | 7f553a93b717641edc6c2d463903dfab67267039 | https://github.com/STARBOYsachin/semantic-segmentation/tree/7f553a93b717641edc6c2d463903dfab67267039 |
SinglePITF_Loss | import torch
import torch as t
import torch.nn as nn
class SinglePITF_Loss(nn.Module):
"""
定义PITF的loss function
"""
def __init__(self):
super(SinglePITF_Loss, self).__init__()
None
def forward(self, r):
return t.sum(-t.log(t.sigmoid(r)))
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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | SamHaoYuan/pitf | SinglePITF_Loss | false | 1,007 | [
"MIT"
] | 0 | 5fdebc3b44c6462126876101b052a3980804da79 | https://github.com/SamHaoYuan/pitf/tree/5fdebc3b44c6462126876101b052a3980804da79 |
CAMMNISTClassifier | import torch
from torch import nn as nn
from torch import optim as optim
from torchvision import transforms as transforms
class CAMMNISTClassifier(nn.Module):
def __init__(self):
super(CAMMNISTClassifier, self).__init__()
self.conv1 = nn.Conv2d(1, 32, kernel_size=3)
self.relu1 = 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 import nn as nn
fr... | RobinMaas95/GTSRB_Visualization | CAMMNISTClassifier | false | 1,008 | [
"MIT"
] | 0 | fa837ff94e089a936ef4f4418970d262b35f70b6 | https://github.com/RobinMaas95/GTSRB_Visualization/tree/fa837ff94e089a936ef4f4418970d262b35f70b6 |
Standardize | from torch.nn import Module
import torch
from torch.nn import init
from torch.nn.parameter import Parameter
class Standardize(Module):
"""
Applies (element-wise) standardization with trainable translation parameter μ and scale parameter σ, i.e. computes
(x - μ) / σ where '/' is applied element-wise.
... | 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.nn import Module
from torch.nn import init
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.... | SDJustus/Deep-SAD-PyTorch | Standardize | false | 1,009 | [
"MIT"
] | 0 | 4d98e6474a7256329134c075894f885a56f59281 | https://github.com/SDJustus/Deep-SAD-PyTorch/tree/4d98e6474a7256329134c075894f885a56f59281 |
NetFCN12 | import torch
import torch.nn as nn
import torch.nn.functional as F
class NetFCN12(nn.Module):
def __init__(self):
super(NetFCN12, self).__init__()
self.conv = nn.Conv2d(3, 16, 3)
self.pool = nn.MaxPool2d((3, 3), stride=2)
self.conv2 = nn.Conv2d(16, 16, 4)
self.conv3 = nn.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
import torch.nn as nn
assert_... | RoyHirsch/DeepLearningCourse | NetFCN12 | false | 1,010 | [
"MIT"
] | 0 | 9036c0fdbb08b610524d7be991f8e4b490a82c6c | https://github.com/RoyHirsch/DeepLearningCourse/tree/9036c0fdbb08b610524d7be991f8e4b490a82c6c |
AttentionConv | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class AttentionConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=False):
super(AttentionConv, self).__init__()
self.out_channels = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | Sam-limyr/End-to-end-ASR-Pytorch | AttentionConv | false | 1,011 | [
"MIT"
] | 0 | 623a50792f48218228549ea17b8ea5e8bb1b342f | https://github.com/Sam-limyr/End-to-end-ASR-Pytorch/tree/623a50792f48218228549ea17b8ea5e8bb1b342f |
ResBlock | import torch
import torch.nn as nn
class ResBlock(nn.Module):
def __init__(self, size):
super().__init__()
self.size = size
self.layer1 = nn.Linear(self.size, self.size)
self.relu = nn.ReLU()
self.layer2 = nn.Linear(self.size, self.size)
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_... | RosarioAndolina/psychXRF | ResBlock | false | 1,012 | [
"MIT"
] | 0 | e2adadbd17664d7f74c10304f84b3751c571226e | https://github.com/RosarioAndolina/psychXRF/tree/e2adadbd17664d7f74c10304f84b3751c571226e |
LN_TD3Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class LN_TD3Critic(nn.Module):
def __init__(self, state_dim, action_dim, hidden_size1, hidden_size2):
super(LN_TD3Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, hidden_size1)
self.ln1 = nn.LayerNorm(h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | RohanPankaj/apex | LN_TD3Critic | false | 1,013 | [
"MIT"
] | 0 | 74e96386bf9446d1179106d6d65ea0368c1b5b27 | https://github.com/RohanPankaj/apex/tree/74e96386bf9446d1179106d6d65ea0368c1b5b27 |
Transformer | import torch
import torch as t
import torch.nn as nn
from torch.distributions.categorical import Categorical
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
class Transformer(nn.Module):
def __init__(self, input_size, num_actions, hidden_size, learning_rate=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LucWeber/2048-RLenv | Transformer | false | 1,014 | [
"MIT"
] | 0 | 6beff54691f0436f0fbca6bdbb9430fd37eab37d | https://github.com/LucWeber/2048-RLenv/tree/6beff54691f0436f0fbca6bdbb9430fd37eab37d |
TwoLayerNet | import torch
class TwoLayerNet(torch.nn.Module):
def __init__(self, D_in, H, D_out):
super(TwoLayerNet, self).__init__()
self.linear1 = torch.nn.Linear(D_in, H)
self.linear2 = torch.nn.Linear(H, D_out)
def forward(self, x):
h_relu = self.linear1(x).clamp(min=0)
y_pred... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Saran-nns/delve | TwoLayerNet | false | 1,015 | [
"MIT"
] | 0 | 3489d8aa13181b392d3c47a19f9d9a47d87f8790 | https://github.com/Saran-nns/delve/tree/3489d8aa13181b392d3c47a19f9d9a47d87f8790 |
PixelwiseNorm | import torch
class PixelwiseNorm(torch.nn.Module):
"""
------------------------------------------------------------------------------------
Pixelwise feature vector normalization.
reference:
https://github.com/tkarras/progressive_growing_of_gans/blob/master/networks.py#L120
-------------------... | 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... | SashaMatsun/torch-GAN | PixelwiseNorm | false | 1,016 | [
"MIT"
] | 0 | 534a634530548d3f8b3a102c3e43e1cc64d8506d | https://github.com/SashaMatsun/torch-GAN/tree/534a634530548d3f8b3a102c3e43e1cc64d8506d |
CAMMNISTExtendedClassifier | import torch
from torch import nn as nn
from torch import optim as optim
from torchvision import transforms as transforms
from torch.nn.functional import pad
class CAMMNISTExtendedClassifier(nn.Module):
def __init__(self):
super(CAMMNISTExtendedClassifier, self).__init__()
self.conv1 = nn.Conv2d(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn as nn
fr... | RobinMaas95/GTSRB_Visualization | CAMMNISTExtendedClassifier | false | 1,017 | [
"MIT"
] | 0 | fa837ff94e089a936ef4f4418970d262b35f70b6 | https://github.com/RobinMaas95/GTSRB_Visualization/tree/fa837ff94e089a936ef4f4418970d262b35f70b6 |
Model | import torch
class Model(torch.nn.Module):
def __init__(self, D_in, D_out):
super(Model, self).__init__()
self.w1 = torch.nn.Parameter(torch.randn(D_in, D_out),
requires_grad=True)
self.sig = torch.nn.Sigmoid()
def forward(self, x):
y_pred = self.sig(x.mm(self.w1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Saran-nns/gradients | Model | false | 1,018 | [
"MIT"
] | 0 | 67f9ff92589047828563dbbe30f225dca7ad47fd | https://github.com/Saran-nns/gradients/tree/67f9ff92589047828563dbbe30f225dca7ad47fd |
DisentangledAELatent | import torch
class DisentangledAELatent(torch.nn.Module):
"""Dense Dientangled Latent Layer between encoder and decoder"""
def __init__(self, hidden_size: 'int', latent_size: 'int', dropout: 'float'
):
super(DisentangledAELatent, self).__init__()
self.latent_size = latent_size
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_s... | Saran-nns/traja | DisentangledAELatent | false | 1,019 | [
"MIT"
] | 0 | f2256cc47abd33377b3a87f110f4c8da1cf6765f | https://github.com/Saran-nns/traja/tree/f2256cc47abd33377b3a87f110f4c8da1cf6765f |
LayerCake | import torch
class LayerCake(torch.nn.Module):
def __init__(self, D_in, H1, H2, H3, H4, H5, D_out):
"""
In the constructor we instantiate two nn.Linear modules and assign them as
member variables.
"""
super(LayerCake, self).__init__()
self.linear1 = torch.nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | Saran-nns/delve | LayerCake | false | 1,021 | [
"MIT"
] | 0 | 3489d8aa13181b392d3c47a19f9d9a47d87f8790 | https://github.com/Saran-nns/delve/tree/3489d8aa13181b392d3c47a19f9d9a47d87f8790 |
GCN | from torch.nn import Module
import math
import torch
import torch.nn as nn
import torch.utils.data
import torch
from torch.nn.modules.module import Module
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class GCN_Spectral(Module):
""" Simple GCN layer, similar to https://arxiv.org/abs/160... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SamujjwalSam/XC_GCN | GCN | false | 1,022 | [
"MIT"
] | 0 | 7902cbd6b3ebc7806655080979e8c52caa4a16e0 | https://github.com/SamujjwalSam/XC_GCN/tree/7902cbd6b3ebc7806655080979e8c52caa4a16e0 |
ReOrgLayer | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch._utils
class ReOrgLayer(nn.Module):
def __init__(self, stride=2):
super(ReOrgLayer, self).__init__()
self.stride = stride
def forward(self, x):
assert x.data.dim() == 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
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch._utils
assert_size_stride = torch._C._dynamo.... | Sarathismg/Pose-Estimator-Old-Version | ReOrgLayer | false | 1,023 | [
"Apache-2.0"
] | 0 | ecaa03769323b94a4d7222e2d3606d1ce92a2fae | https://github.com/Sarathismg/Pose-Estimator-Old-Version/tree/ecaa03769323b94a4d7222e2d3606d1ce92a2fae |
TracedModule | import torch
import torch.onnx
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.autograd
class TracedModule(torch.nn.Module):
def forward(self, x):
x = x.type(torch.float32)
return torch.floor(torch.sqrt(x) / 5.0)
def get_input... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.onnx
import torch.nn.parallel
import torch.optim
import torch.util... | ScorpioDoctor/antares02 | TracedModule | false | 1,024 | [
"BSD-3-Clause"
] | 0 | 631b817d2e98f351d1173b620d15c4a5efed11da | https://github.com/ScorpioDoctor/antares02/tree/631b817d2e98f351d1173b620d15c4a5efed11da |
SRCNN | import logging
import torch
import torchvision
import warnings
from collections import OrderedDict
from torch.utils import model_zoo
from torch.nn import functional as F
import torch.nn as nn
def get_root_logger(log_file=None, log_level=logging.INFO):
"""Get the root logger.
The logger will be initialized if... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Jason-Khan/mmediting | SRCNN | false | 1,025 | [
"Apache-2.0"
] | 0 | d187f95a675dff3eb975a575bd9278d643b5b645 | https://github.com/Jason-Khan/mmediting/tree/d187f95a675dff3eb975a575bd9278d643b5b645 |
PairCosineSim | import torch
import torch.utils.data
import torch.nn as nn
class PairCosineSim(nn.Module):
def __init__(self):
super(PairCosineSim, self).__init__()
def forward(self, supports, target):
"""
Calculates pairwise cosine similarity of support sets with target sample.
:param supp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SamujjwalSam/MatchingNetworks4XC | PairCosineSim | false | 1,026 | [
"MIT"
] | 0 | 2519cc1a527ea121c4966c1a860d890d5182f887 | https://github.com/SamujjwalSam/MatchingNetworks4XC/tree/2519cc1a527ea121c4966c1a860d890d5182f887 |
squeeze | import torch
import torch.nn as nn
class squeeze(nn.Module):
def __init__(self, block_size):
super(squeeze, self).__init__()
self.block_size = block_size
self.block_size_sq = block_size * block_size
def inverse(self, input):
output = input.permute(0, 2, 3, 1)
batch_si... | 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... | Schwartz-Zha/My-invertible-resnet | squeeze | false | 1,027 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
MaxMinGroup | import torch
import torch.nn as nn
def process_maxmin_groupsize(x, group_size, axis=-1):
size = list(x.size())
num_channels = size[axis]
if num_channels % group_size:
raise ValueError(
'number of features({}) is not a multiple of group_size({})'.
format(num_channels, num_ch... | 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... | Schwartz-Zha/My-invertible-resnet | MaxMinGroup | false | 1,028 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
Split | import torch
import torch.nn as nn
class Split(nn.Module):
def __init__(self):
super(Split, self).__init__()
def forward(self, x):
n = int(x.size(1) / 2)
x1 = x[:, :n, :, :].contiguous()
x2 = x[:, n:, :, :].contiguous()
return x1, x2
def inverse(self, x1, x2):
... | 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... | Schwartz-Zha/My-invertible-resnet | Split | false | 1,029 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
NormalAttention_gaussian | import torch
import torch.nn as nn
class NormalAttention_gaussian(nn.Module):
def __init__(self, input_channel_num):
super(NormalAttention_gaussian, self).__init__()
self.c_in = input_channel_num
self.value_conv = nn.Conv2d(in_channels=self.c_in, out_channels=
self.c_in, kerne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Schwartz-Zha/My-invertible-resnet | NormalAttention_gaussian | false | 1,030 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
Conv2dZeroInit | import torch
import torch.nn as nn
class Conv2dZeroInit(nn.Conv2d):
def __init__(self, channels_in, channels_out, filter_size, stride=1,
padding=0, logscale=3.0):
super().__init__(channels_in, channels_out, filter_size, stride=
stride, padding=padding)
self.register_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.... | Schwartz-Zha/My-invertible-resnet | Conv2dZeroInit | false | 1,031 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, h2):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Saran-nns/delve | Net | false | 1,032 | [
"MIT"
] | 0 | 3489d8aa13181b392d3c47a19f9d9a47d87f8790 | https://github.com/Saran-nns/delve/tree/3489d8aa13181b392d3c47a19f9d9a47d87f8790 |
MeanVarFC | import torch
import torch.nn as nn
class MeanVarFC(nn.Module):
def __init__(self, input_shape):
super(MeanVarFC, self).__init__()
shape = list(input_shape)
shape[0] = 1
shape[1] *= 2
self.param = nn.Parameter(0.01 * torch.randn(shape))
def forward(self, x):
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Schwartz-Zha/My-invertible-resnet | MeanVarFC | false | 1,033 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
injective_pad | import torch
import torch.nn as nn
class injective_pad(nn.Module):
def __init__(self, pad_size):
super(injective_pad, self).__init__()
self.pad_size = pad_size
self.pad = nn.ZeroPad2d((0, 0, 0, pad_size))
def forward(self, x):
x = x.permute(0, 2, 1, 3)
x = self.pad(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Schwartz-Zha/My-invertible-resnet | injective_pad | false | 1,034 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
ANNClassifier | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class AttentionConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1, bias=False):
super(AttentionConv, self).__init__()
self.out_channels = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Sam-limyr/End-to-end-ASR-Pytorch | ANNClassifier | false | 1,035 | [
"MIT"
] | 0 | 623a50792f48218228549ea17b8ea5e8bb1b342f | https://github.com/Sam-limyr/End-to-end-ASR-Pytorch/tree/623a50792f48218228549ea17b8ea5e8bb1b342f |
ActNorm | import torch
import torch.nn as nn
from torch.nn import Parameter
class ActNorm(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super(ActNorm, self).__init__()
self.eps = eps
self.num_channels = num_channels
self._log_scale = Parameter(torch.Tensor(num_channels))
... | 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
from torch.nn import Parameter
assert_size_stride =... | Schwartz-Zha/My-invertible-resnet | ActNorm | false | 1,036 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
NormalAttention_dot | import torch
import torch.nn as nn
class NormalAttention_dot(nn.Module):
def __init__(self, input_channel_num, k=4):
super(NormalAttention_dot, self).__init__()
self.c_in = input_channel_num
self.query_conv = nn.Conv2d(in_channels=self.c_in, out_channels=
self.c_in // k, kerne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Schwartz-Zha/My-invertible-resnet | NormalAttention_dot | false | 1,037 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
ActNorm2D | import torch
import torch.nn as nn
from torch.nn import Parameter
class ActNorm2D(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super(ActNorm2D, self).__init__()
self.eps = eps
self.num_channels = num_channels
self._log_scale = Parameter(torch.Tensor(num_channels))
... | 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
from torch.nn import Parameter
assert_size_stride =... | Schwartz-Zha/My-invertible-resnet | ActNorm2D | false | 1,038 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
NormalAttention_embedded_gaussian | import torch
import torch.nn as nn
class NormalAttention_embedded_gaussian(nn.Module):
def __init__(self, input_channel_num, k=4):
super(NormalAttention_embedded_gaussian, self).__init__()
self.c_in = input_channel_num
self.query_conv = nn.Conv2d(in_channels=self.c_in, out_channels=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | Schwartz-Zha/My-invertible-resnet | NormalAttention_embedded_gaussian | false | 1,039 | [
"MIT"
] | 0 | 5415975bb0d640f3bf3ef4a7b986563e84109270 | https://github.com/Schwartz-Zha/My-invertible-resnet/tree/5415975bb0d640f3bf3ef4a7b986563e84109270 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
def set_init(layers):
for layer in layers:
nn.init.normal_(layer.weight, mean=0.0, std=0.1)
nn.init.constant_(layer.bias, 0.0)
class Net(nn.Module):
def __init__(self, s_dim, a_dim):
super(Net, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | SeungyounShin/pytorch-A3C | Net | false | 1,040 | [
"MIT"
] | 0 | acb9c05a5e1a697c48a7d4c1a48b1c86326faf91 | https://github.com/SeungyounShin/pytorch-A3C/tree/acb9c05a5e1a697c48a7d4c1a48b1c86326faf91 |
DiceLoss | import functools
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "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 math as tl_math
import functools
impor... | SeHwanJoo/mmsegmentation_body | DiceLoss | false | 1,041 | [
"Apache-2.0"
] | 0 | 31c4bf27c3dc0a84bfbb06a0c017c5908c17f0ac | https://github.com/SeHwanJoo/mmsegmentation_body/tree/31c4bf27c3dc0a84bfbb06a0c017c5908c17f0ac |
VAE | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.autograd
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Li... | 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 import triton_helpers
from... | ScorpioDoctor/antares02 | VAE | false | 1,042 | [
"BSD-3-Clause"
] | 0 | 631b817d2e98f351d1173b620d15c4a5efed11da | https://github.com/ScorpioDoctor/antares02/tree/631b817d2e98f351d1173b620d15c4a5efed11da |
MultiHeadAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
def __init__(self):
super(ScaledDotProductAttention, self).__init__()
def forward(self, query, key, value, mask=None):
_1, _2, query_sequence_length, _3 = query.size()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | SeungoneKim/Transformer_implementation | MultiHeadAttention | false | 1,043 | [
"Apache-2.0"
] | 0 | a52bf552eb645fc9bfb812cc26842fc147d6c008 | https://github.com/SeungoneKim/Transformer_implementation/tree/a52bf552eb645fc9bfb812cc26842fc147d6c008 |
Encoding | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
class Encoding(nn.Module):
"""Encoding Layer: a learnable residual encoder.
Input is of shape (batch_size, channels, height, width).
Output is of shape (batch_size, num_codes, channels).
Ar... | 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
... | SeHwanJoo/mmsegmentation_body | Encoding | false | 1,044 | [
"Apache-2.0"
] | 0 | 31c4bf27c3dc0a84bfbb06a0c017c5908c17f0ac | https://github.com/SeHwanJoo/mmsegmentation_body/tree/31c4bf27c3dc0a84bfbb06a0c017c5908c17f0ac |
CnnNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class CnnNet(nn.Module):
def __init__(self):
super(CnnNet, self).__init__()
self.conv1 = nn.Conv2d(1, 32, 3)
self.pool1 = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(32, 64, 2)
self.pool2 = nn.MaxPool2d(2, 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
assert_... | RoyHirsch/DeepLearningCourse | CnnNet | false | 1,045 | [
"MIT"
] | 0 | 9036c0fdbb08b610524d7be991f8e4b490a82c6c | https://github.com/RoyHirsch/DeepLearningCourse/tree/9036c0fdbb08b610524d7be991f8e4b490a82c6c |
BILM | import torch
import torch.nn as nn
class BILM(nn.Module):
def __init__(self):
super(BILM, self).__init__()
self.maxpool1 = nn.MaxPool2d(kernel_size=3, stride=1, padding=1)
self.maxpool2 = nn.MaxPool2d(kernel_size=3, stride=1, padding=1)
def forward(self, feat):
pos_sig = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | SeunghwanByun/Real-Time-Road-Detection-Network | BILM | false | 1,046 | [
"MIT"
] | 0 | bc46615adef0e2b1a9a03dd4951559ca5849e6e1 | https://github.com/SeunghwanByun/Real-Time-Road-Detection-Network/tree/bc46615adef0e2b1a9a03dd4951559ca5849e6e1 |
KLDLoss | import torch
import torch.nn as nn
import torch.utils.data
class KLDLoss(nn.Module):
def forward(self, mu, logvar):
return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | SebyakinAndrei/MichiGAN | KLDLoss | false | 1,047 | [
"MIT"
] | 0 | 6584c9a106b33096f38e8f5b11d0320f7065fd26 | https://github.com/SebyakinAndrei/MichiGAN/tree/6584c9a106b33096f38e8f5b11d0320f7065fd26 |
AddCoords | import torch
import torch.nn as nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Args:
input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_size, _,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | SeunghwanByun/Real-Time-Road-Detection-Network | AddCoords | false | 1,048 | [
"MIT"
] | 0 | bc46615adef0e2b1a9a03dd4951559ca5849e6e1 | https://github.com/SeunghwanByun/Real-Time-Road-Detection-Network/tree/bc46615adef0e2b1a9a03dd4951559ca5849e6e1 |
BCEDiceLoss | import functools
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
def _expand_onehot_labels(labels, label_weights, target_shape, ignore_index):
"""Expand onehot labels to match the size of prediction."""
bin_labels = labels.new_ze... | 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 functools
impor... | SeHwanJoo/mmsegmentation_body | BCEDiceLoss | false | 1,049 | [
"Apache-2.0"
] | 0 | 31c4bf27c3dc0a84bfbb06a0c017c5908c17f0ac | https://github.com/SeHwanJoo/mmsegmentation_body/tree/31c4bf27c3dc0a84bfbb06a0c017c5908c17f0ac |
BasicBlock | import torch
import torch.nn as nn
import torch.utils.data
def conv1x1(in_planes, out_planes, stride=1):
"""1x1 convolution"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride,
bias=False)
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | SebyakinAndrei/MichiGAN | BasicBlock | false | 1,050 | [
"MIT"
] | 0 | 6584c9a106b33096f38e8f5b11d0320f7065fd26 | https://github.com/SebyakinAndrei/MichiGAN/tree/6584c9a106b33096f38e8f5b11d0320f7065fd26 |
BahdanauAttention | import math
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn.parameter import Parameter
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.optim
import torch.utils.data.distributed
class BahdanauAttention(nn.Module):
"""
It should be very similar to ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | SerailHydra/examples | BahdanauAttention | false | 1,051 | [
"BSD-3-Clause"
] | 0 | 547226ff28032d4dab1dbf26e0b5f8b8276d79ae | https://github.com/SerailHydra/examples/tree/547226ff28032d4dab1dbf26e0b5f8b8276d79ae |
StateActionEmbedding | import math
import torch
import numpy as np
from abc import ABC
from abc import abstractmethod
from abc import abstractproperty
from torch import nn
from enum import Enum
def tensor_to_numpy(tensor):
return tensor.detach().cpu().numpy()
class MLPParamHandler(ABC):
def __init__(self) ->None:
"""Inte... | 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 numpy as np
from abc import ABC
from abc import abstractmethod
from abc import abstractproperty
from torch import nn
from... | Sebastian-Griesbach/Improving-Policy-Conditioned-Value-Functions | StateActionEmbedding | false | 1,052 | [
"MIT"
] | 0 | ec4125c5e056753e507df0406fcd60b6b6c3dc25 | https://github.com/Sebastian-Griesbach/Improving-Policy-Conditioned-Value-Functions/tree/ec4125c5e056753e507df0406fcd60b6b6c3dc25 |
GatedConv2d | import torch
import torch.nn as nn
class GatedConv2d(torch.nn.Module):
"""
Gated Convlution layer with activation (default activation:LeakyReLU)
Params: same as conv2d
Input: The feature from last layer "I"
Output:\\phi(f(I))*\\sigmoid(g(I))
"""
def __init__(self, in_channels, out_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.triton_helpers import libdevice
import torch.nn as ... | ShiraLightricks/3d-photo-inpainting | GatedConv2d | false | 1,053 | [
"MIT"
] | 0 | c42ac41576690b765e50f5281ddbfb58439ff36d | https://github.com/ShiraLightricks/3d-photo-inpainting/tree/c42ac41576690b765e50f5281ddbfb58439ff36d |
CoordConv | import torch
import torch.nn as nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Args:
input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_size, _,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | SeunghwanByun/Real-Time-Road-Detection-Network | CoordConv | false | 1,054 | [
"MIT"
] | 0 | bc46615adef0e2b1a9a03dd4951559ca5849e6e1 | https://github.com/SeunghwanByun/Real-Time-Road-Detection-Network/tree/bc46615adef0e2b1a9a03dd4951559ca5849e6e1 |
ScaledDotProductAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
def __init__(self):
super(ScaledDotProductAttention, self).__init__()
def forward(self, query, key, value, mask=None):
_1, _2, query_sequence_length, _3 = query.size()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | SeungoneKim/Transformer_implementation | ScaledDotProductAttention | false | 1,055 | [
"Apache-2.0"
] | 0 | a52bf552eb645fc9bfb812cc26842fc147d6c008 | https://github.com/SeungoneKim/Transformer_implementation/tree/a52bf552eb645fc9bfb812cc26842fc147d6c008 |
Swish | import torch
import torch.nn as nn
class Swish(nn.Module):
def __init__(self, inplace=True):
super(Swish, self).__init__()
self.inplace = inplace
def forward(self, x):
return x.mul_(x.sigmoid()) if self.inplace else x.mul(x.sigmoid())
def get_inputs():
return [torch.rand([4, 4,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_mul_sigmoid_0(in_pt... | ShowLo/Networks | Swish | false | 1,056 | [
"MIT"
] | 0 | 48f8545783966c383b6c3b600fbe37a15ea8ae3c | https://github.com/ShowLo/Networks/tree/48f8545783966c383b6c3b600fbe37a15ea8ae3c |
Bicubic | from torch.nn import Module
import torch
import torch.nn.functional as F
class Bicubic(Module):
def __init__(self, scale_factor):
super().__init__()
self.scale_factor = scale_factor
def forward(self, x):
return F.interpolate(x, scale_factor=self.scale_factor, mode='bicubic')
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
... | ShivanshuPurohit/Diffusion | Bicubic | false | 1,057 | [
"MIT"
] | 0 | 9a190d9aa4ed9767cf223e4ef57d0c31690f92cc | https://github.com/ShivanshuPurohit/Diffusion/tree/9a190d9aa4ed9767cf223e4ef57d0c31690f92cc |
adder2d | import torch
import torch.nn as nn
def adder2d_function(X, W, stride=1, padding=0, groups=1):
n_filters, _d_filter, h_filter, w_filter = W.size()
n_x, _d_x, h_x, w_x = X.size()
h_out = (h_x - h_filter + 2 * padding) / stride + 1
w_out = (w_x - w_filter + 2 * padding) / stride + 1
h_out, w_out = 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ShangyinGao/pytorch-cifar | adder2d | false | 1,058 | [
"MIT"
] | 0 | 480e19825bb155e3d0fafae3545faa3a4165bd77 | https://github.com/ShangyinGao/pytorch-cifar/tree/480e19825bb155e3d0fafae3545faa3a4165bd77 |
FFN | import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
class FFN(nn.Module):
def __init__(self, d_model, d_ffn, dropout=0):
super().__init__()
self.linear1 = nn.Linear(d_model, d_ffn)
self.activation = 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
from torch._inductor.runtime.... | SelvamArul/MOTR | FFN | false | 1,059 | [
"MIT"
] | 0 | 2a0b70288feaca665d460096159100d5077e9312 | https://github.com/SelvamArul/MOTR/tree/2a0b70288feaca665d460096159100d5077e9312 |
BinaryReg | import torch
import torch.nn as nn
import torch.utils.data
class BinaryReg(nn.Module):
"""Regularization for encouraging the outputs to be binary.
"""
def __init__(self, alpha=0.1):
super().__init__()
self.alpha = alpha
def forward(self, pred):
diff = pred - 0.5
diff ... | 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
... | Shray64/pytorch_connectomics | BinaryReg | false | 1,060 | [
"MIT"
] | 0 | d6c814f11ac2f8418ede5ae220a93016f50214fc | https://github.com/Shray64/pytorch_connectomics/tree/d6c814f11ac2f8418ede5ae220a93016f50214fc |
MessageNormalizer | import torch
import torch.nn as nn
class MessageNormalizer(nn.Module):
def __init__(self, in_features, init_mean=1.0, init_stddev=0.01):
super(MessageNormalizer, self).__init__()
self.in_features = in_features
self.out_features = in_features
self.weight = torch.nn.Parameter(torch.... | 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... | ShinyaFUKUMOTO/LeMPA | MessageNormalizer | false | 1,061 | [
"BSD-2-Clause"
] | 0 | 23b8c9f60fc13cf28d4485757d2ae0b3465b3e92 | https://github.com/ShinyaFUKUMOTO/LeMPA/tree/23b8c9f60fc13cf28d4485757d2ae0b3465b3e92 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
import torch._utils
class MaxPoolStride1(nn.Module):
def __init__(self, kernel_size):
super(MaxPoolStride1, self).__init__()
self.kernel_size = kernel_size
self.p... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import ... | Sarathismg/Pose-Estimator-Old-Version | MaxPoolStride1 | false | 1,062 | [
"Apache-2.0"
] | 0 | ecaa03769323b94a4d7222e2d3606d1ce92a2fae | https://github.com/Sarathismg/Pose-Estimator-Old-Version/tree/ecaa03769323b94a4d7222e2d3606d1ce92a2fae |
GroupNorm32 | import torch
import torch.nn as nn
import torch.nn.functional as F
class GroupNorm32(nn.GroupNorm):
def __init__(self, num_groups, num_channels, swish, eps=1e-05):
super().__init__(num_groups=num_groups, num_channels=num_channels,
eps=eps)
self.swish = swish
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_... | ShivanshuPurohit/Diffusion | GroupNorm32 | false | 1,063 | [
"MIT"
] | 0 | 9a190d9aa4ed9767cf223e4ef57d0c31690f92cc | https://github.com/ShivanshuPurohit/Diffusion/tree/9a190d9aa4ed9767cf223e4ef57d0c31690f92cc |
HardSigmoid | import torch
import torch.nn.functional as F
class HardSigmoid(torch.nn.Module):
"""
Pytorch implementation of the hard sigmoid activation function
"""
def __init__(self):
super(HardSigmoid, self).__init__()
def forward(self, input):
x = 0.2 * input + 0.5
x = torch.clamp(... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | ShiraLightricks/3d-photo-inpainting | HardSigmoid | false | 1,064 | [
"MIT"
] | 0 | c42ac41576690b765e50f5281ddbfb58439ff36d | https://github.com/ShiraLightricks/3d-photo-inpainting/tree/c42ac41576690b765e50f5281ddbfb58439ff36d |
Classifier | import torch
import torch.nn as nn
from abc import *
class Classifier(nn.Module):
def __init__(self, in_channels, num_classes):
super(Classifier, self).__init__()
self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
self.fc = nn.Linear(in_channels, num_classes)
def forward(self, x):
o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from abc import *
assert_size_stride = torch._C._dynamo.gu... | Slime0519/simple-faster-rcnn-pytorch | Classifier | false | 1,065 | [
"MIT"
] | 0 | 0503e9b4d07a24ae0bc1789a61ed937709f5304c | https://github.com/Slime0519/simple-faster-rcnn-pytorch/tree/0503e9b4d07a24ae0bc1789a61ed937709f5304c |
TemporalAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class TemporalAttention(nn.Module):
def __init__(self, hidden_size, feat_size, bottleneck_size):
super(TemporalAttention, self).__init__()
self.hidden_size = hidden_size
self.feat_size = feat_size
self.bottleneck_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Shashwat07gupta/MSVD | TemporalAttention | false | 1,066 | [
"MIT"
] | 0 | 8026557ef7681a504b5140560ec4aaad9944de2d | https://github.com/Shashwat07gupta/MSVD/tree/8026557ef7681a504b5140560ec4aaad9944de2d |
FastRNNCell | import torch
import torch.nn as nn
import torch.onnx
from itertools import product as product
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ShishirPatil/EdgeML-1 | FastRNNCell | false | 1,067 | [
"MIT"
] | 0 | cbba9f8b989e545788427c004eb8450e7e4c1a21 | https://github.com/ShishirPatil/EdgeML-1/tree/cbba9f8b989e545788427c004eb8450e7e4c1a21 |
Downsample | import torch
import numpy as np
class BaseModule(torch.nn.Module):
def __init__(self):
super(BaseModule, self).__init__()
@property
def nparams(self):
"""
Returns number of trainable parameters of the module.
"""
num_params = 0
for name, param in self.name... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 numpy as np
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | Sobsz/uberduck-ml-dev | Downsample | false | 1,068 | [
"Apache-2.0"
] | 0 | f099238f6f2e3f600d72d89dea3c883c59d91387 | https://github.com/Sobsz/uberduck-ml-dev/tree/f099238f6f2e3f600d72d89dea3c883c59d91387 |
AddFunction | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class AddFunction(nn.Module):
def __init__(self):
super(AddFunction, self).__init__()
def forward(self, x, y):
return x + y
def get_inputs():
retur... | 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
import torch.utils.data.distributed
assert_size_st... | ShounoLab/res-net-interpretation-open | AddFunction | false | 1,069 | [
"MIT"
] | 0 | 282dc0ae261467ee1866996416149959db216c02 | https://github.com/ShounoLab/res-net-interpretation-open/tree/282dc0ae261467ee1866996416149959db216c02 |
WeightedCE | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
class WeightedCE(nn.Module):
"""Mask weighted multi-class cross-entropy (CE) loss.
"""
def __init__(self):
super().__init__()
def forward(self, pred, target, weight_mask=None):
loss = F.cross_e... | 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
... | Shray64/pytorch_connectomics | WeightedCE | false | 1,070 | [
"MIT"
] | 0 | d6c814f11ac2f8418ede5ae220a93016f50214fc | https://github.com/Shray64/pytorch_connectomics/tree/d6c814f11ac2f8418ede5ae220a93016f50214fc |
PartialConv | import math
import torch
import torch.nn as nn
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 == 'gaussian':
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | ShiraLightricks/3d-photo-inpainting | PartialConv | false | 1,071 | [
"MIT"
] | 0 | c42ac41576690b765e50f5281ddbfb58439ff36d | https://github.com/ShiraLightricks/3d-photo-inpainting/tree/c42ac41576690b765e50f5281ddbfb58439ff36d |
ProtoNN | import torch
import numpy as np
import torch.nn as nn
import torch.onnx
from itertools import product as product
class ProtoNN(nn.Module):
def __init__(self, inputDimension, projectionDimension, numPrototypes,
numOutputLabels, gamma, W=None, B=None, Z=None):
"""
Forward computation graph ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ShishirPatil/EdgeML-1 | ProtoNN | false | 1,072 | [
"MIT"
] | 0 | cbba9f8b989e545788427c004eb8450e7e4c1a21 | https://github.com/ShishirPatil/EdgeML-1/tree/cbba9f8b989e545788427c004eb8450e7e4c1a21 |
GRULRCell | import torch
import torch.nn as nn
import torch.onnx
from itertools import product as product
def gen_nonlinearity(A, nonlinearity):
"""
Returns required activation for a tensor based on the inputs
nonlinearity is either a callable or a value in
['tanh', 'sigmoid', 'relu', 'quantTanh', 'quantSigm... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ShishirPatil/EdgeML-1 | GRULRCell | false | 1,073 | [
"MIT"
] | 0 | cbba9f8b989e545788427c004eb8450e7e4c1a21 | https://github.com/ShishirPatil/EdgeML-1/tree/cbba9f8b989e545788427c004eb8450e7e4c1a21 |
Connect2Model | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class Connect2Model(nn.Module):
def __init__(self, board_size, action_size, device):
super(Connect2Model, self).__init__()
self.device = device
self.size = board_size
self.action_size = action_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.... | ShokuninSan/AlphaZeroSimple | Connect2Model | false | 1,074 | [
"MIT"
] | 0 | e32e6a28f872a046705a3f68882139688d5a43c3 | https://github.com/ShokuninSan/AlphaZeroSimple/tree/e32e6a28f872a046705a3f68882139688d5a43c3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.