entry_point stringlengths 1 65 | original_triton_code stringlengths 4.5k 619k | python_code stringlengths 208 60.9k | 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 | pytorch_code stringlengths 200 4.05k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
ConvSample | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
class ConvSample(torch.nn.Module):
def __init__(self):
super().__init__()
self.conv1 = torch.nn.Conv2d(in_channels=1, out_channels=5,
kernel_size=5, stride=2, padding=2)
self.conv2 = torch.nn.Conv2d(in_channels=5, out_channels=5,
kernel_size=3, stride=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ahgamut/torchrecord | ConvSample | false | 6,126 | [
"MIT"
] | 1 | 6ab623776d12e0ae6497c34e93d16407e0a9c9c2 | https://github.com/ahgamut/torchrecord/tree/6ab623776d12e0ae6497c34e93d16407e0a9c9c2 | import torch
class Model(torch.nn.Module):
def __init__(self):
super().__init__()
self.conv1 = torch.nn.Conv2d(in_channels=1, out_channels=5,
kernel_size=5, stride=2, padding=2)
self.conv2 = torch.nn.Conv2d(in_channels=5, out_channels=5,
kernel_size=3, stride=1, pa... |
NoisyLinear | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import torch.nn as nn
import torch.nn
import torch.optim
class NoisyLinear(nn.Linear):
def __init__(self, in_dimension, out_dimension, std_dev_init=0.4) ->None:
"""
Noisy Networks for Exploration: https://arxiv.org/abs/1706.10295
Standard linear layer: y = wx + b
... | 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... | ailzy/Horizon | NoisyLinear | false | 6,127 | [
"BSD-3-Clause"
] | 1 | 377786d6c0306c3ecec1b18b6029f72949a4fdea | https://github.com/ailzy/Horizon/tree/377786d6c0306c3ecec1b18b6029f72949a4fdea | import math
import torch
import torch.nn as nn
import torch.nn
import torch.optim
class Model(nn.Linear):
def __init__(self, in_dimension, out_dimension, std_dev_init=0.4) ->None:
"""
Noisy Networks for Exploration: https://arxiv.org/abs/1706.10295
Standard linear layer: y = wx + b
... |
CELoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
class CELoss(nn.Module):
def __init__(self, ratio=1, weight=None, size_average=None,
ignore_index=-100, reduce=None, reduction='mean'):
super(CELoss, self).__init... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ahmad4633/mmfashion | CELoss | false | 6,128 | [
"Apache-2.0"
] | 1 | ad2c911bf71bb95dce340a963e7f83c477a84824 | https://github.com/ahmad4633/mmfashion/tree/ad2c911bf71bb95dce340a963e7f83c477a84824 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
class Model(nn.Module):
def __init__(self, ratio=1, weight=None, size_average=None,
ignore_index=-100, reduce=None, reduction='mean'):
super().__init__()
... |
DiscriminatorLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class DiscriminatorLoss(nn.Module):
def __init__(self):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
def forward(self, fake_pred, real_pred):
fake_target = torch.zeros_like(fake_pred)
real_target = torch.ones_like(real_pred)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | akanametov/CycleGAN | DiscriminatorLoss | false | 6,129 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 | import torch
from torch import nn
class Model(nn.Module):
def __init__(self):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
def forward(self, fake_pred, real_pred):
fake_target = torch.zeros_like(fake_pred)
real_target = torch.ones_like(real_pred)
fake_loss... |
GeneratorLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class GeneratorLoss(nn.Module):
def __init__(self, alpha=1, beta=10, gamma=10):
super().__init__()
self.bce = nn.BCEWithLogitsLoss()
self.l1 = nn.L1Loss()
self.alpha = alpha
self.beta = beta
self.gamma = gamma
def forward(self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | akanametov/CycleGAN | GeneratorLoss | false | 6,130 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 | import torch
from torch import nn
class Model(nn.Module):
def __init__(self, alpha=1, beta=10, gamma=10):
super().__init__()
self.bce = nn.BCEWithLogitsLoss()
self.l1 = nn.L1Loss()
self.alpha = alpha
self.beta = beta
self.gamma = gamma
def forward(self, fake_p... |
NavACLNetwork | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class NavACLNetwork(nn.Module):
def __init__(self, task_param_dim, hidden_dim, init_w=0.0005):
super(NavACLNetwork, self).__init__()
self.layer_1 = nn.Linear(task_param_dim, hidden_dim)
self.layer_2 = nn.Linear(hidden_dim, hidden_dim)
self.layer_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ai-lab-science/Deep-Reinforcement-Learning-for-mapless-navigation-in-intralogistics | NavACLNetwork | false | 6,131 | [
"MIT"
] | 1 | ac29a691317c69bc397809b222c0f3cf3f1916bc | https://github.com/ai-lab-science/Deep-Reinforcement-Learning-for-mapless-navigation-in-intralogistics/tree/ac29a691317c69bc397809b222c0f3cf3f1916bc | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, task_param_dim, hidden_dim, init_w=0.0005):
super().__init__()
self.layer_1 = nn.Linear(task_param_dim, hidden_dim)
self.layer_2 = nn.Linear(hidden_dim, hidden_dim)
self.layer_3 = nn.Linear(hidden_dim, h... |
PointerHead | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.quantization
from torch import nn
class PointerHead(nn.Module):
"""Head for pointer ordering task."""
def __init__(self, embed_dim, bias=True):
super().__init__()
self.embed_dim = embed_dim
self.scaling = self.embed_dim ** -0.5
self.k_proj = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.quantization
from torch import nn
assert_size_stride = torch._C._dy... | airKlizz/passage-ordering | PointerHead | false | 6,132 | [
"MIT"
] | 1 | f63b993dfd5b7e6475e7fb8950c23c3f22951979 | https://github.com/airKlizz/passage-ordering/tree/f63b993dfd5b7e6475e7fb8950c23c3f22951979 | import torch
import torch.quantization
from torch import nn
class Model(nn.Module):
"""Head for pointer ordering task."""
def __init__(self, embed_dim, bias=True):
super().__init__()
self.embed_dim = embed_dim
self.scaling = self.embed_dim ** -0.5
self.k_proj = nn.Linear(embed... |
stack_pool | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class stack_pool(nn.Module):
def __init__(self):
super(stack_pool, self).__init__()
self.pool2 = nn.MaxPool2d(2, stride=2)
self.pool2s1 = nn.MaxPool2d(2, stride=1)
self.pool3s1 = nn.MaxPool2d(3, stride=1, padding=1)
self.padding = nn.Repl... | 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... | ahhaa/crowdcount-stackpool | stack_pool | false | 6,133 | [
"MIT"
] | 1 | b849b72e88d5e53a9f6b5dbc93014668aee43fb4 | https://github.com/ahhaa/crowdcount-stackpool/tree/b849b72e88d5e53a9f6b5dbc93014668aee43fb4 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
self.pool2 = nn.MaxPool2d(2, stride=2)
self.pool2s1 = nn.MaxPool2d(2, stride=1)
self.pool3s1 = nn.MaxPool2d(3, stride=1, padding=1)
self.padding = nn.ReplicationPad2d((0, 1, 0... |
BasicBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class BasicBlock(nn.Module):
"""Basic block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True):
super().__init__()
self.conv = nn.Conv2d(inplanes, outplanes, kernel_size, stride, padding
)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | akanametov/CycleGAN | BasicBlock | false | 6,134 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 | import torch
from torch import nn
class Model(nn.Module):
"""Basic block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True):
super().__init__()
self.conv = nn.Conv2d(inplanes, outplanes, kernel_size, stride, padding
)
self.isn... |
PixLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class PixLoss(nn.Module):
"""Pixel-wise MSE loss for images"""
def __init__(self, alpha=20):
super().__init__()
self.alpha = alpha
def forward(self, fake, real):
return self.alpha * torch.mean((fake - real) ** 2)
def get_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | akanametov/SuperResolution | PixLoss | false | 6,135 | [
"MIT"
] | 1 | 45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | https://github.com/akanametov/SuperResolution/tree/45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | import torch
import torch.nn as nn
class Model(nn.Module):
"""Pixel-wise MSE loss for images"""
def __init__(self, alpha=20):
super().__init__()
self.alpha = alpha
def forward(self, fake, real):
return self.alpha * torch.mean((fake - real) ** 2)
def get_inputs():
return [to... |
DecoderBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class DecoderBlock(nn.Module):
"""Decoder block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, dropout=False):
super().__init__()
self.relu = nn.ReLU(inplace=True)
self.deconv = nn.ConvTranspose2d(inplanes, outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | akanametov/CycleGAN | DecoderBlock | false | 6,136 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 | import torch
from torch import nn
class Model(nn.Module):
"""Decoder block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, dropout=False):
super().__init__()
self.relu = nn.ReLU(inplace=True)
self.deconv = nn.ConvTranspose2d(inplanes, outplanes, ... |
EncoderBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class EncoderBlock(nn.Module):
"""Encoder block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True, padding_mode='zeros'):
super().__init__()
self.lrelu = nn.LeakyReLU(0.2, inplace=True)
self.conv = nn.Con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | akanametov/CycleGAN | EncoderBlock | false | 6,137 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 | import torch
from torch import nn
class Model(nn.Module):
"""Encoder block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True, padding_mode='zeros'):
super().__init__()
self.lrelu = nn.LeakyReLU(0.2, inplace=True)
self.conv = nn.Conv2d(inp... |
UpdateCell | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
import torch as th
class UpdateCell(nn.Module):
def __init__(self, input_dim, output_dim):
super().__init__()
self.x2i = nn.Linear(input_dim, 2 * output_dim, bias=True)
self.h2h = nn.Linear(output_dim, 2 * output_dim, 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
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | alarca94/recbole-extension | UpdateCell | false | 6,138 | [
"MIT"
] | 1 | 171d4e58c83d35838307503d85e6c006701b3003 | https://github.com/alarca94/recbole-extension/tree/171d4e58c83d35838307503d85e6c006701b3003 | import torch
from torch import nn
import torch as th
class Model(nn.Module):
def __init__(self, input_dim, output_dim):
super().__init__()
self.x2i = nn.Linear(input_dim, 2 * output_dim, bias=True)
self.h2h = nn.Linear(output_dim, 2 * output_dim, bias=False)
def forward(self, x, hidd... |
AdvLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class AdvLoss(nn.Module):
"""BCE for True and False reals"""
def __init__(self, alpha=1):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
self.alpha = alpha
def forward(self, pred, target):
return self.alpha * self.loss_fn(pred,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | akanametov/SuperResolution | AdvLoss | false | 6,139 | [
"MIT"
] | 1 | 45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | https://github.com/akanametov/SuperResolution/tree/45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | import torch
import torch.nn as nn
class Model(nn.Module):
"""BCE for True and False reals"""
def __init__(self, alpha=1):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
self.alpha = alpha
def forward(self, pred, target):
return self.alpha * self.loss_fn(pred, t... |
DiscriminatorLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class AdvLoss(nn.Module):
"""BCE for True and False reals"""
def __init__(self, alpha=1):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
self.alpha = alpha
def forward(self, pred, target):
return self.alpha * self.loss_fn(pred,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | akanametov/SuperResolution | DiscriminatorLoss | false | 6,140 | [
"MIT"
] | 1 | 45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | https://github.com/akanametov/SuperResolution/tree/45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | import torch
import torch.nn as nn
class AdvLoss(nn.Module):
"""BCE for True and False reals"""
def __init__(self, alpha=1):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
self.alpha = alpha
def forward(self, pred, target):
return self.alpha * self.loss_fn(pred,... |
Cos | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class Cos(nn.Module):
def __init__(self):
super().__init__()
def forward(self, X: 'torch.Tensor'):
return torch.cos(X)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | alartum/sngp-pytorch | Cos | false | 6,141 | [
"Apache-2.0"
] | 1 | 8d1f6c22d7ae635feeff0c0912624589e31e2e62 | https://github.com/alartum/sngp-pytorch/tree/8d1f6c22d7ae635feeff0c0912624589e31e2e62 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, X: 'torch.Tensor'):
return torch.cos(X)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return []
|
GeneratorLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class GeneratorLoss(nn.Module):
def __init__(self, alpha=100):
super().__init__()
self.alpha = alpha
self.bce = nn.BCEWithLogitsLoss()
self.l1 = nn.L1Loss()
def forward(self, fake, real, fake_pred):
fake_target = torch.ones_like(fake_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | akanametov/Pix2Pix-new | GeneratorLoss | false | 6,142 | [
"MIT"
] | 1 | 46aaefc506655dbf918ffdbd1c79174d76a748d0 | https://github.com/akanametov/Pix2Pix-new/tree/46aaefc506655dbf918ffdbd1c79174d76a748d0 | import torch
from torch import nn
class Model(nn.Module):
def __init__(self, alpha=100):
super().__init__()
self.alpha = alpha
self.bce = nn.BCEWithLogitsLoss()
self.l1 = nn.L1Loss()
def forward(self, fake, real, fake_pred):
fake_target = torch.ones_like(fake_pred)
... |
TotalVariationLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class TotalVariationLoss(nn.Module):
def __init__(self, loss_weight: 'int'=1) ->None:
super(TotalVariationLoss, self).__init__()
self.loss_weight = loss_weight
@staticmethod
def tensor_size(t: 'torch.Tensor') ->torch.Tensor:
return t.size()[1] *... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | aksh-ai/image-super-resolution | TotalVariationLoss | false | 6,143 | [
"MIT"
] | 1 | b3f2e48707db702dcd57733a8bcbf97ba87bb8a9 | https://github.com/aksh-ai/image-super-resolution/tree/b3f2e48707db702dcd57733a8bcbf97ba87bb8a9 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, loss_weight: 'int'=1) ->None:
super().__init__()
self.loss_weight = loss_weight
@staticmethod
def tensor_size(t: 'torch.Tensor') ->torch.Tensor:
return t.size()[1] * t.size()[2] * t.size()[3]
def f... |
HyperpriorSynthesisDLMM | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
def get_num_DLMM_channels(C, K=4, params=['mu', 'scale', 'mix']):
"""
C: Channels of latent representation (L3C uses 5).
K: Number of mixture coefficients.
"""
return C * K * len(params)
class HyperpriorSynthesisDLMM(nn.Module)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ahmedfgad/high-fidelity-generative-compression | HyperpriorSynthesisDLMM | false | 6,144 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a | import torch
import torch.nn as nn
import torch.nn.functional as F
def get_num_DLMM_channels(C, K=4, params=['mu', 'scale', 'mix']):
"""
C: Channels of latent representation (L3C uses 5).
K: Number of mixture coefficients.
"""
return C * K * len(params)
class Model(nn.Module):
"""
Outp... |
BasicBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, inplanes, planes, st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | akux2021/Learning-to-Grasp-by-Digging | BasicBlock | false | 6,145 | [
"Apache-2.0"
] | 1 | af7a32cb3e860df2d233a26174c7a27eb798b08d | https://github.com/akux2021/Learning-to-Grasp-by-Digging/tree/af7a32cb3e860df2d233a26174c7a27eb798b08d | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
class Model(nn.Module):
expansion = 1
def __init__(self, inplanes, planes, stride=... |
Discriminator | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class BasicBlock(nn.Module):
"""Basic block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True):
super().__init__()
self.conv = nn.Conv2d(inplanes, outplanes, kernel_size, stride, padding
)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | akanametov/CycleGAN | Discriminator | false | 6,146 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 | import torch
from torch import nn
class BasicBlock(nn.Module):
"""Basic block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True):
super().__init__()
self.conv = nn.Conv2d(inplanes, outplanes, kernel_size, stride, padding
)
sel... |
ImageProcessor | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class ImageProcessor(nn.Module):
def __init__(self, init_image_embedding_size, embedding_size):
super().__init__()
self.conv = nn.Conv2d(init_image_embedding_size, embedding_size,
kernel_size=1)
def forward(self, image_encoding):
x = sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | alasin/vqa_pytorch | ImageProcessor | false | 6,147 | [
"MIT"
] | 1 | 8a311226d8eea56ef79f6be3c864ec05768e2895 | https://github.com/alasin/vqa_pytorch/tree/8a311226d8eea56ef79f6be3c864ec05768e2895 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, init_image_embedding_size, embedding_size):
super().__init__()
self.conv = nn.Conv2d(init_image_embedding_size, embedding_size,
kernel_size=1)
def forward(self, image_encoding):
x = self.conv(im... |
HyperpriorSynthesis | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class HyperpriorSynthesis(nn.Module):
"""
Hyperprior 'synthesis model' as proposed in [1]. Outputs
distribution parameters of input latents.
[1] Ballé et. al., "Variational image compression with a scale hyperprior",
arXiv:1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ahmedfgad/high-fidelity-generative-compression | HyperpriorSynthesis | false | 6,148 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
Hyperprior 'synthesis model' as proposed in [1]. Outputs
distribution parameters of input latents.
[1] Ballé et. al., "Variational image compression with a scale hyperprior",
arXiv:1802.01436 (201... |
BesselBasisLayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import numpy as np
import torch.nn as nn
class Envelope(nn.Module):
def __init__(self, exponent):
super(Envelope, self).__init__()
self.exponent = exponent
self.p = exponent + 1
self.a = -(self.p + 1) * (self.p + 2) / 2
self.b = self.p * (self.p + 2)
s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._d... | akirasosa/pre-training-mol | BesselBasisLayer | false | 6,149 | [
"MIT"
] | 1 | 2fd65a959eee50e2eea260719633042ae37bb92c | https://github.com/akirasosa/pre-training-mol/tree/2fd65a959eee50e2eea260719633042ae37bb92c | import torch
import numpy as np
import torch.nn as nn
class Envelope(nn.Module):
def __init__(self, exponent):
super().__init__()
self.exponent = exponent
self.p = exponent + 1
self.a = -(self.p + 1) * (self.p + 2) / 2
self.b = self.p * (self.p + 2)
self.c = -self.... |
AdMSoftmaxLoss | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class AdMSoftmaxLoss(nn.Module):
def __init__(self, in_features, out_features, s=30.0, m=0.4):
"""
AM Softmax Loss
"""
super(AdMSoftmaxLoss, self).__init__()
self.s = s
self.m = m
self.in_fe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | albertvillanova/s3prl | AdMSoftmaxLoss | false | 6,150 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, in_features, out_features, s=30.0, m=0.4):
"""
AM Softmax Loss
"""
super().__init__()
self.s = s
self.m = m
self.in_features = in_features
... |
AP | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super(AttentivePooling, self).__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | albertvillanova/s3prl | AP | false | 6,151 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super().__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
self.act_fn = nn.R... |
AMSoftmaxLoss | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class AMSoftmaxLoss(nn.Module):
def __init__(self, hidden_dim, speaker_num, s=30.0, m=0.4, **kwargs):
"""
AM Softmax Loss
"""
super(AMSoftmaxLoss, self).__init__()
self.s = s
self.m = m
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.... | albertvillanova/s3prl | AMSoftmaxLoss | false | 6,152 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, hidden_dim, speaker_num, s=30.0, m=0.4, **kwargs):
"""
AM Softmax Loss
"""
super().__init__()
self.s = s
self.m = m
self.speaker_num = speaker_num
... |
L2Norm | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self):
super(L2Norm, self).__init__()
self.eps = 1e-10
def forward(self, x):
norm = torch.sqrt(torch.sum(x * x, dim=1) + self.eps)
x = x / norm.unsqueeze(-1).expand_as(x)
return x
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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | albutko/vlb | L2Norm | false | 6,153 | [
"BSD-2-Clause"
] | 1 | 437245c0991948eeb36a277937a7e67d389041e4 | https://github.com/albutko/vlb/tree/437245c0991948eeb36a277937a7e67d389041e4 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
self.eps = 1e-10
def forward(self, x):
norm = torch.sqrt(torch.sum(x * x, dim=1) + self.eps)
x = x / norm.unsqueeze(-1).expand_as(x)
return x
def get_inputs():
retu... |
PrecomputedNorm | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class PrecomputedNorm(nn.Module):
"""Normalization using Pre-computed Mean/Std.
Args:
stats: Precomputed (mean, std).
axis: Axis setting used to calculate mean/variance.
"""
def __init__(self, stats, axis=[1, 2]):
super().__init__()
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | albertvillanova/s3prl | PrecomputedNorm | false | 6,154 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class Model(nn.Module):
"""Normalization using Pre-computed Mean/Std.
Args:
stats: Precomputed (mean, std).
axis: Axis setting used to calculate mean/variance.
"""
def __init__(self, stats, axis=[1, 2]):
super().__init__()
self.axis =... |
ASP | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super(AttentivePooling, self).__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | albertvillanova/s3prl | ASP | false | 6,155 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super().__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
self.act_fn = nn.R... |
AttentivePooling | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super(AttentivePooling, self).__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | albertvillanova/s3prl | AttentivePooling | false | 6,156 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class Model(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super().__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
self.act_fn = nn.ReLU()
... |
Model | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, input_dim, output_class_num, **kwargs):
super(Model, self).__init__()
self.linear = nn.Linear(input_dim, output_class_num)
def forward(self, features):
pooled = features.mean(dim=1)
predicted = self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | albertvillanova/s3prl | Model | false | 6,157 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, input_dim, output_class_num, **kwargs):
super(Model, self).__init__()
self.linear = nn.Linear(input_dim, output_class_num)
def forward(self, features):
pooled = features.mean(dim=1)
predicted = self... |
ChannelNorm | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class ChannelNorm(nn.Module):
def __init__(self, numFeatures, epsilon=1e-05, affine=True):
super(ChannelNorm, self).__init__()
if affine:
self.weight = nn.parameter.Parameter(torch.Tensor(1,
numFeatures, 1))
self.bias = nn... | 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_... | albertvillanova/s3prl | ChannelNorm | false | 6,158 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, numFeatures, epsilon=1e-05, affine=True):
super().__init__()
if affine:
self.weight = nn.parameter.Parameter(torch.Tensor(1,
numFeatures, 1))
self.bias = nn.parameter.Parameter(to... |
AlternateAttention | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class AlternateAttention(nn.Module):
def __init__(self, embedding_size, hidden_size):
super().__init__()
self.hidden_size = hidden_size
self.embedding_size = embedding_size
self.x_linear = nn.Linear(self.embedding_size, self.hidden_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | alasin/vqa_pytorch | AlternateAttention | false | 6,160 | [
"MIT"
] | 1 | 8a311226d8eea56ef79f6be3c864ec05768e2895 | https://github.com/alasin/vqa_pytorch/tree/8a311226d8eea56ef79f6be3c864ec05768e2895 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, embedding_size, hidden_size):
super().__init__()
self.hidden_size = hidden_size
self.embedding_size = embedding_size
self.x_linear = nn.Linear(self.embedding_size, self.hidden_size)
self.g_linear... |
CrossEntropyLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn.functional as F
import torch.nn as nn
def _is_long(x):
return isinstance(x, torch.LongTensor) or isinstance(x, torch.LongTensor)
def onehot(indexes, N=None, ignore_index=None):
"""
Creates a one-representation of indexes with N possible entries
if N is not specified, it ... | 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.functi... | aldakata/ClassConditionalC2D | CrossEntropyLoss | false | 6,161 | [
"MIT"
] | 1 | dd73e1d4d5f0f82438340211e3c479dbd16b8ffc | https://github.com/aldakata/ClassConditionalC2D/tree/dd73e1d4d5f0f82438340211e3c479dbd16b8ffc | import torch
import torch.nn.functional as F
import torch.nn as nn
def _is_long(x):
return isinstance(x, torch.LongTensor) or isinstance(x, torch.LongTensor)
def onehot(indexes, N=None, ignore_index=None):
"""
Creates a one-representation of indexes with N possible entries
if N is not specified, it ... |
SelfAttentionPooling | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class SelfAttentionPooling(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super(SelfAttenti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | albertvillanova/s3prl | SelfAttentionPooling | false | 6,162 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class Model(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super().__init__()
self.... |
HyperpriorAnalysis | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class HyperpriorAnalysis(nn.Module):
"""
Hyperprior 'analysis model' as proposed in [1].
[1] Ballé et. al., "Variational image compression with a scale hyperprior",
arXiv:1802.01436 (2018).
C: Number of input 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.... | ahmedfgad/high-fidelity-generative-compression | HyperpriorAnalysis | false | 6,163 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
Hyperprior 'analysis model' as proposed in [1].
[1] Ballé et. al., "Variational image compression with a scale hyperprior",
arXiv:1802.01436 (2018).
C: Number of input channels
"""
def ... |
FeatureMatchingLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.utils.data
import torch
from torch import nn
class FeatureMatchingLoss(nn.Module):
def __init__(self, n_layers_D, num_D):
super(FeatureMatchingLoss, self).__init__()
self.criterion = nn.L1Loss()
self.n_layers_D = n_layers_D
self.num_D = num_D
def for... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.data
import torch
from torch import nn
assert_size_str... | alexander-telepov/RGB2MSI | FeatureMatchingLoss | false | 6,164 | [
"BSD-3-Clause"
] | 1 | 99f81f5547d40d0c92cfde39994a8c53629bd0f7 | https://github.com/alexander-telepov/RGB2MSI/tree/99f81f5547d40d0c92cfde39994a8c53629bd0f7 | import torch
import torch.utils.data
import torch
from torch import nn
class Model(nn.Module):
def __init__(self, n_layers_D, num_D):
super().__init__()
self.criterion = nn.L1Loss()
self.n_layers_D = n_layers_D
self.num_D = num_D
def forward(self, fake, real):
loss = ... |
SoftmaxLoss | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class SoftmaxLoss(nn.Module):
def __init__(self, hidden_dim, speaker_num, **kwargs):
"""
Softmax Loss
"""
super(SoftmaxLoss, self).__init__()
self.fc = nn.Linear(hidden_dim, speaker_num)
self.loss = nn.CrossEntropyLoss()
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._inductor.runtime.... | albertvillanova/s3prl | SoftmaxLoss | false | 6,165 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, hidden_dim, speaker_num, **kwargs):
"""
Softmax Loss
"""
super().__init__()
self.fc = nn.Linear(hidden_dim, speaker_num)
self.loss = nn.CrossEntropyLoss()
def forward(self, x_BxH, la... |
Delta | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
from torchaudio import transforms
class Delta(nn.Module):
def __init__(self, order=2, **kwargs):
super(Delta, self).__init__()
self.order = order
self.compute_delta = transforms.ComputeDeltas(**kwargs)
def forward(self, x):
feats = [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
from torchaudio import transforms
assert_size_stride = tor... | albertvillanova/s3prl | Delta | false | 6,166 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
from torchaudio import transforms
class Model(nn.Module):
def __init__(self, order=2, **kwargs):
super().__init__()
self.order = order
self.compute_delta = transforms.ComputeDeltas(**kwargs)
def forward(self, x):
feats = [x]
for o in... |
SAP | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class SelfAttentionPooling(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super(SelfAttenti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | albertvillanova/s3prl | SAP | false | 6,167 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | import torch
import torch.nn as nn
class SelfAttentionPooling(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super().__init__(... |
LargeMarginCosLoss | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
def cosine_sim(x1, x2, dim=1, eps=1e-08):
ip = torch.mm(x1, x2.t())
w1 = torch.norm(x1, 2, dim)
w2 = torch.norm(x2, 2, dim)
return ip / torch.ger(w1, w2).clamp(min=eps)
class LargeMarginCosLoss(nn.Module):
"""
CosFace: Large Margin Cosine Loss for Deep Face ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | alexalex222/classification_loss | LargeMarginCosLoss | false | 6,168 | [
"MIT"
] | 1 | a61617e0c0d5ecf6e0ff388305dd9f3eaa5cbf94 | https://github.com/alexalex222/classification_loss/tree/a61617e0c0d5ecf6e0ff388305dd9f3eaa5cbf94 | import torch
from torch import nn
def cosine_sim(x1, x2, dim=1, eps=1e-08):
ip = torch.mm(x1, x2.t())
w1 = torch.norm(x1, 2, dim)
w2 = torch.norm(x2, 2, dim)
return ip / torch.ger(w1, w2).clamp(min=eps)
class Model(nn.Module):
"""
CosFace: Large Margin Cosine Loss for Deep Face Recognition. ... |
ParallelAttention | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class ParallelAttention(nn.Module):
def __init__(self, embedding_size, hidden_size):
super().__init__()
self.hidden_size = hidden_size
self.embedding_size = embedding_size
self.ques_linear = nn.Linear(self.embedding_size, self.hidden_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | alasin/vqa_pytorch | ParallelAttention | false | 6,169 | [
"MIT"
] | 1 | 8a311226d8eea56ef79f6be3c864ec05768e2895 | https://github.com/alasin/vqa_pytorch/tree/8a311226d8eea56ef79f6be3c864ec05768e2895 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, embedding_size, hidden_size):
super().__init__()
self.hidden_size = hidden_size
self.embedding_size = embedding_size
self.ques_linear = nn.Linear(self.embedding_size, self.hidden_size)
self.img_l... |
SpatialAttention | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
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_size == 7 else 1
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | alexchungio/Scene-Classification-Competition | SpatialAttention | false | 6,170 | [
"Apache-2.0"
] | 1 | d936667ceba1c0b8f90eb266019f43ff27767534 | https://github.com/alexchungio/Scene-Classification-Competition/tree/d936667ceba1c0b8f90eb266019f43ff27767534 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, kernel_size=7):
super().__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv2d(in_channels=2, ... |
ScaledL2Norm | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | 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_channels))
self.initial_s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | alejodosr/adaptive-inattention | ScaledL2Norm | false | 6,171 | [
"MIT"
] | 1 | ad1c883081e5248704be5ce5c4baa24b2eda1c59 | https://github.com/alejodosr/adaptive-inattention/tree/ad1c883081e5248704be5ce5c4baa24b2eda1c59 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, in_channels, initial_scale):
super().__init__()
self.in_channels = in_channels
self.scale = nn.Parameter(torch.Tensor(in_channels))
self.initial_scale = initial_scale
... |
BottleneckLSTMCell | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import logging
import torch
import torch.nn as nn
from torch.autograd import Variable
class BottleneckLSTMCell(nn.Module):
""" Creates a LSTM layer cell
Arguments:
input_channels : variable used to contain value of number of channels in input
hidden_channels : variable used to contain value 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 import triton_helpers
import logging
import torch.n... | alejodosr/adaptive-inattention | BottleneckLSTMCell | false | 6,172 | [
"MIT"
] | 1 | ad1c883081e5248704be5ce5c4baa24b2eda1c59 | https://github.com/alejodosr/adaptive-inattention/tree/ad1c883081e5248704be5ce5c4baa24b2eda1c59 | import logging
import torch
import torch.nn as nn
from torch.autograd import Variable
class Model(nn.Module):
""" Creates a LSTM layer cell
Arguments:
input_channels : variable used to contain value of number of channels in input
hidden_channels : variable used to contain value of number of ch... |
AndMLP | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class AndMLP(nn.Module):
def __init__(self, n_layers, entity_dim):
super(AndMLP, self).__init__()
self.n_layers = n_layers
self.layers = []
for i in range(1, self.n_layers + 1):
setattr(self, 'and_layer... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | amayuelas/NNKGReasoning | AndMLP | false | 6,173 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, n_layers, entity_dim):
super().__init__()
self.n_layers = n_layers
self.layers = []
for i in range(1, self.n_layers + 1):
setattr(self, 'and_layer_{}'.format(i... |
dce_loss | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class dce_loss(nn.Module):
def __init__(self, n_classes, feat_dim, init_weight=True):
super(dce_loss, self).__init__()
self.n_classes = n_classes
self.feat_dim = feat_dim
self.centers = nn.Parameter(torch.randn(self.feat_dim, self.
n_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | alexalex222/classification_loss | dce_loss | false | 6,174 | [
"MIT"
] | 1 | a61617e0c0d5ecf6e0ff388305dd9f3eaa5cbf94 | https://github.com/alexalex222/classification_loss/tree/a61617e0c0d5ecf6e0ff388305dd9f3eaa5cbf94 | import torch
from torch import nn
class Model(nn.Module):
def __init__(self, n_classes, feat_dim, init_weight=True):
super().__init__()
self.n_classes = n_classes
self.feat_dim = feat_dim
self.centers = nn.Parameter(torch.randn(self.feat_dim, self.
n_classes), requires... |
Boom | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class Boom(nn.Module):
def __init__(self, d_model, dim_feedforward=2048, dropout=0.1, shortcut
=False, output_size=512):
super(Boom, self).__init__()
self.linear1 = nn.Linear(d_model, dim_feedforward)
self.dropout = nn.Dropout(dropout) if dropout... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | alisafaya/char-rnn.pytorch | Boom | false | 6,175 | [
"MIT"
] | 1 | 473538d9f4d57a3206dccef22f7e03826c398cfb | https://github.com/alisafaya/char-rnn.pytorch/tree/473538d9f4d57a3206dccef22f7e03826c398cfb | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, d_model, dim_feedforward=2048, dropout=0.1, shortcut
=False, output_size=512):
super().__init__()
self.linear1 = nn.Linear(d_model, dim_feedforward)
self.dropout = nn.Dropout(dropout) if dropout else Non... |
CenterLoss | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class CenterLoss(nn.Module):
"""Center loss.
Reference:
Wen et al. A Discriminative Feature Learning Approach for Deep Face Recognition. ECCV 2016.
Args:
num_classes (int): number of classes.
feat_dim (int): feature dimension.
"""
def __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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | alexalex222/classification_loss | CenterLoss | false | 6,176 | [
"MIT"
] | 1 | a61617e0c0d5ecf6e0ff388305dd9f3eaa5cbf94 | https://github.com/alexalex222/classification_loss/tree/a61617e0c0d5ecf6e0ff388305dd9f3eaa5cbf94 | import torch
from torch import nn
class Model(nn.Module):
"""Center loss.
Reference:
Wen et al. A Discriminative Feature Learning Approach for Deep Face Recognition. ECCV 2016.
Args:
num_classes (int): number of classes.
feat_dim (int): feature dimension.
"""
def __init__(se... |
PearsonCorrelation | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class PearsonCorrelation(nn.Module):
"""
Module for measuring Pearson correlation.
Given samples (x, y), the Pearson correlation coefficient is given by:
.. math::
r = rac{{}\\sum_{i=1}^{n} (x_i - \\overline{x})(y_i - \\overline{y})}
{\\sqrt{\\sum_{i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | alexhepburn/expert | PearsonCorrelation | false | 6,177 | [
"BSD-3-Clause"
] | 1 | 546f7452ced2213ef91e5ce6e7456a1668dd9f95 | https://github.com/alexhepburn/expert/tree/546f7452ced2213ef91e5ce6e7456a1668dd9f95 | import torch
import torch.nn as nn
class Model(nn.Module):
"""
Module for measuring Pearson correlation.
Given samples (x, y), the Pearson correlation coefficient is given by:
.. math::
r = rac{{}\\sum_{i=1}^{n} (x_i - \\overline{x})(y_i - \\overline{y})}
{\\sqrt{\\sum_{i=1}^{n} (x_i ... |
ThreeLayerCNN | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
class ThreeLayerCNN(torch.nn.Module):
"""
Input: 128x128 face image (eye aligned).
Output: 1-D tensor with 2 elements. Used for binary classification.
Parameters:
Number of conv layers: 3
Number of fully connected layers: 2
"""
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 import triton_helpers
import torch.utils.data
asser... | aleb/pipelines | ThreeLayerCNN | false | 6,178 | [
"Apache-2.0"
] | 1 | 2181b2fb8bdd6cd93e7d677b9840ed1b58a83a85 | https://github.com/aleb/pipelines/tree/2181b2fb8bdd6cd93e7d677b9840ed1b58a83a85 | import torch
import torch.utils.data
class Model(torch.nn.Module):
"""
Input: 128x128 face image (eye aligned).
Output: 1-D tensor with 2 elements. Used for binary classification.
Parameters:
Number of conv layers: 3
Number of fully connected layers: 2
"""
def __init__(self):
... |
BCELovaszLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
def flatten_binary_scores(scores, labels, ignore=None):
"""
Flattens predictions in the batch (binary case)
Remove labels equal to 'ignore'
"""
scores = scores.view(-1)
labe... | 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 nump... | amitkumarj441/TGS_Kaggle | BCELovaszLoss | false | 6,179 | [
"MIT"
] | 1 | a4f613046cc36f3f6dbec28adb35f97a63c2a994 | https://github.com/amitkumarj441/TGS_Kaggle/tree/a4f613046cc36f3f6dbec28adb35f97a63c2a994 | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
def flatten_binary_scores(scores, labels, ignore=None):
"""
Flattens predictions in the batch (binary case)
Remove labels equal to 'ignore'
"""
scores = scores.view(-1)
labe... |
TorchGloVeLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.utils.data
class TorchGloVeLoss(nn.Module):
def __init__(self):
super().__init__()
self.reduction = 'sum'
def forward(self, diffs, weights):
return torch.sum(0.5 * torch.mul(weights, diffs ** 2))
def get_inputs():
return [torch.ra... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | ammarhusain/cs224u | TorchGloVeLoss | false | 6,180 | [
"Apache-2.0"
] | 1 | bbdb0aaa6b7437481e2e1fab8e12bbf1996eecd1 | https://github.com/ammarhusain/cs224u/tree/bbdb0aaa6b7437481e2e1fab8e12bbf1996eecd1 | import torch
import torch.nn as nn
import torch.utils.data
class Model(nn.Module):
def __init__(self):
super().__init__()
self.reduction = 'sum'
def forward(self, diffs, weights):
return torch.sum(0.5 * torch.mul(weights, diffs ** 2))
def get_inputs():
return [torch.rand([4, 4,... |
BoxOffsetIntersection | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class BoxOffsetIntersection(nn.Module):
def __init__(self, dim):
super(BoxOffsetIntersection, self).__init__()
self.dim = dim
self.layer1 = nn.Linear(self.dim, self.dim)
self.layer2 = nn.Linear(self.dim, self.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_... | amayuelas/NNKGReasoning | BoxOffsetIntersection | false | 6,181 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
self.layer1 = nn.Linear(self.dim, self.dim)
self.layer2 = nn.Linear(self.dim, self.dim)
nn.init.xavier_uniform_(self.layer1... |
HME | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import numpy
import torch
class HME(torch.nn.Module):
def __init__(self, in_features, out_features, depth, projection='linear'):
super(HME, self).__init__()
self.proj = projection
self.depth = depth
self.in_features = in_features
self.out_features = out_features
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | alper111/hmog | HME | false | 6,182 | [
"MIT"
] | 1 | 556da11600c97bcb075a0f19ffc284120d9789d2 | https://github.com/alper111/hmog/tree/556da11600c97bcb075a0f19ffc284120d9789d2 | import numpy
import torch
class Model(torch.nn.Module):
def __init__(self, in_features, out_features, depth, projection='linear'):
super().__init__()
self.proj = projection
self.depth = depth
self.in_features = in_features
self.out_features = out_features
self.n_le... |
ME | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
class ME(torch.nn.Module):
def __init__(self, in_features, out_features, n_leaf, projection=
'linear', dropout=0.0):
super(ME, self).__init__()
self.proj = projection
self.n_leaf = n_leaf
self.in_features = in_features
self.out_features = out_features
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | alper111/hmog | ME | false | 6,183 | [
"MIT"
] | 1 | 556da11600c97bcb075a0f19ffc284120d9789d2 | https://github.com/alper111/hmog/tree/556da11600c97bcb075a0f19ffc284120d9789d2 | import torch
class Model(torch.nn.Module):
def __init__(self, in_features, out_features, n_leaf, projection=
'linear', dropout=0.0):
super().__init__()
self.proj = projection
self.n_leaf = n_leaf
self.in_features = in_features
self.out_features = out_features
... |
CenterIntersection | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class CenterIntersection(nn.Module):
def __init__(self, dim):
super(CenterIntersection, self).__init__()
self.dim = dim
self.layer1 = nn.Linear(self.dim, self.dim)
self.layer2 = nn.Linear(self.dim, self.dim)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | amayuelas/NNKGReasoning | CenterIntersection | false | 6,184 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
self.layer1 = nn.Linear(self.dim, self.dim)
self.layer2 = nn.Linear(self.dim, self.dim)
nn.init.xavier_uniform_(self.layer1... |
LinearZeros | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class LinearZeros(nn.Linear):
def __init__(self, in_channels, out_channels, logscale_factor=3):
super().__init__(in_channels, out_channels)
self.logscale_factor = logscale_factor
self.register_parameter('logs', nn.Parameter(torch.zeros(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
from torch im... | americast/glow-pytorch | LinearZeros | false | 6,185 | [
"MIT"
] | 1 | bbc576b96a5218417d25ae76b60f04ae24621de3 | https://github.com/americast/glow-pytorch/tree/bbc576b96a5218417d25ae76b60f04ae24621de3 | import torch
from torch import nn
class Model(nn.Linear):
def __init__(self, in_channels, out_channels, logscale_factor=3):
super().__init__(in_channels, out_channels)
self.logscale_factor = logscale_factor
self.register_parameter('logs', nn.Parameter(torch.zeros(out_channels))
... |
AndAttention | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class AndAttention(nn.Module):
def __init__(self, n_layers, entity_dim, temperature, attn_dropout=0.1):
super(AndAttention, self).__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | amayuelas/NNKGReasoning | AndAttention | false | 6,186 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, n_layers, entity_dim, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
self.n_layers = n_layers
... |
SpatialSEBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class SpatialSEBlock(nn.Module):
def __init__(self, channel):
super(SpatialSEBlock, self).__init__()
self.conv = nn.Conv2d(in_channels=channel, out_channels=1,
kernel_size=1)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
y = 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... | amitkumarj441/TGS_Kaggle | SpatialSEBlock | false | 6,187 | [
"MIT"
] | 1 | a4f613046cc36f3f6dbec28adb35f97a63c2a994 | https://github.com/amitkumarj441/TGS_Kaggle/tree/a4f613046cc36f3f6dbec28adb35f97a63c2a994 | import torch
from torch import nn
class Model(nn.Module):
def __init__(self, channel):
super().__init__()
self.conv = nn.Conv2d(in_channels=channel, out_channels=1,
kernel_size=1)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
y = self.sigmoid(self.conv(x))
... |
BAP | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class BAP(nn.Module):
def __init__(self, pool='GAP'):
super(BAP, self).__init__()
assert pool in ['GAP', 'GMP']
if pool == 'GAP':
self.pool = nn.AdaptiveAvgPool2d(1)
else:
self.pool = nn.AdaptiveMaxPool2d(1)
def forwa... | 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... | amobiny/hide_and_seek | BAP | false | 6,188 | [
"MIT"
] | 1 | e298d9a352a6ee58e9beedf15ef3d700473b7f27 | https://github.com/amobiny/hide_and_seek/tree/e298d9a352a6ee58e9beedf15ef3d700473b7f27 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, pool='GAP'):
super().__init__()
assert pool in ['GAP', 'GMP']
if pool == 'GAP':
self.pool = nn.AdaptiveAvgPool2d(1)
else:
self.pool = nn.AdaptiveMaxPool2d(1)
def forward(self... |
BetaIntersection | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class BetaIntersection(nn.Module):
def __init__(self, dim):
super(BetaIntersection, self).__init__()
self.dim = dim
self.layer1 = nn.Linear(2 * self.dim, 2 * self.dim)
self.layer2 = nn.Linear(2 * self.dim, self.dim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | amayuelas/NNKGReasoning | BetaIntersection | false | 6,189 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
self.layer1 = nn.Linear(2 * self.dim, 2 * self.dim)
self.layer2 = nn.Linear(2 * self.dim, self.dim)
nn.init.xavier_uniform_... |
TorchGloVeModel | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.utils.data
from torch.nn.init import xavier_uniform_
class TorchGloVeModel(nn.Module):
def __init__(self, n_words, embed_dim):
super().__init__()
self.n_words = n_words
self.embed_dim = embed_dim
self.W = self._init_weights(self.n_wo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
from torch.nn.init import xavier_u... | ammarhusain/cs224u | TorchGloVeModel | false | 6,190 | [
"Apache-2.0"
] | 1 | bbdb0aaa6b7437481e2e1fab8e12bbf1996eecd1 | https://github.com/ammarhusain/cs224u/tree/bbdb0aaa6b7437481e2e1fab8e12bbf1996eecd1 | import torch
import torch.nn as nn
import torch.utils.data
from torch.nn.init import xavier_uniform_
class Model(nn.Module):
def __init__(self, n_words, embed_dim):
super().__init__()
self.n_words = n_words
self.embed_dim = embed_dim
self.W = self._init_weights(self.n_words, self.... |
MixerBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class MlpBlock(nn.Module):
def __init__(self, features, hidden_dim):
super().__init__()
self.hidden_dim = hidden_dim
self.features = features
self.fc1 = nn.Linear(self.features, self.hidden_dim)
self.fc2 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | amayuelas/NNKGReasoning | MixerBlock | false | 6,191 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class MlpBlock(nn.Module):
def __init__(self, features, hidden_dim):
super().__init__()
self.hidden_dim = hidden_dim
self.features = features
self.fc1 = nn.Linear(self.features, self.hidden_dim)
self.fc2 = ... |
SampaddingConv1D | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class SampaddingConv1D(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, use_bias=True):
super(SampaddingConv1D, self).__init__()
self.use_bias = use_bias
self.padding = nn.ConstantPad1d((int((kernel_size - 1) / 2), int(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | amoonfana/Knowledge_Distillation | SampaddingConv1D | false | 6,192 | [
"Apache-2.0"
] | 1 | 1ee814a8f70ae00d17e1e1ee778d5420d96c43c4 | https://github.com/amoonfana/Knowledge_Distillation/tree/1ee814a8f70ae00d17e1e1ee778d5420d96c43c4 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, use_bias=True):
super().__init__()
self.use_bias = use_bias
self.padding = nn.ConstantPad1d((int((kernel_size - 1) / 2), int(
kernel_size / 2)), 0)
sel... |
ChannelPool | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelPool(nn.MaxPool1d):
def forward(self, X):
X = X.permute(1, 2, 0)
pooled = F.max_pool1d(X, self.kernel_size)
pooled = pooled.permute(2, 0, 1).squeeze(0)
return pooled
def get_inputs():
return [tor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ananyaganesh/ftmp | ChannelPool | false | 6,193 | [
"MIT"
] | 1 | 9ee23939f0c1da854846b8ce1a9abe4e9b377031 | https://github.com/ananyaganesh/ftmp/tree/9ee23939f0c1da854846b8ce1a9abe4e9b377031 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.MaxPool1d):
def forward(self, X):
X = X.permute(1, 2, 0)
pooled = F.max_pool1d(X, self.kernel_size)
pooled = pooled.permute(2, 0, 1).squeeze(0)
return pooled
def get_inputs():
return [torch.ran... |
FFNet | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class MyRelu(nn.Module):
def __init__(self):
super().__init__()
self.myrelu1 = nn.ReLU()
def forward(self, x):
out1 = self.myrelu1(x)
return out1
class FFNet(nn.Module):
def __init__(self, input_size, output_size, hidden_size):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | amilanpathirana/FeedForwardNet | FFNet | false | 6,194 | [
"MIT"
] | 1 | bdf0ebe3f80233fe970e4c60754d0ffe13cadbe1 | https://github.com/amilanpathirana/FeedForwardNet/tree/bdf0ebe3f80233fe970e4c60754d0ffe13cadbe1 | import torch
import torch.nn as nn
class MyRelu(nn.Module):
def __init__(self):
super().__init__()
self.myrelu1 = nn.ReLU()
def forward(self, x):
out1 = self.myrelu1(x)
return out1
class Model(nn.Module):
def __init__(self, input_size, output_size, hidden_size):
... |
SampaddingMaxPool1D | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class SampaddingMaxPool1D(nn.Module):
def __init__(self, pooling_size, stride):
super(SampaddingMaxPool1D, self).__init__()
self.pooling_size = pooling_size
self.stride = stride
self.padding = nn.ConstantPad1d((int((pooling_size - 1) / 2), 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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | amoonfana/Knowledge_Distillation | SampaddingMaxPool1D | false | 6,195 | [
"Apache-2.0"
] | 1 | 1ee814a8f70ae00d17e1e1ee778d5420d96c43c4 | https://github.com/amoonfana/Knowledge_Distillation/tree/1ee814a8f70ae00d17e1e1ee778d5420d96c43c4 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, pooling_size, stride):
super().__init__()
self.pooling_size = pooling_size
self.stride = stride
self.padding = nn.ConstantPad1d((int((pooling_size - 1) / 2), int(
pooling_size / 2)), 0)
... |
CMVN | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class CMVN(nn.Module):
__constants__ = ['mode', 'dim', 'eps']
def __init__(self, mode='global', dim=2, eps=1e-10):
super(CMVN, self).__init__()
if mode != 'global':
raise NotImplementedError(
'Only support global mean variance nor... | 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_... | ana-kuznetsova/s3prl | CMVN | false | 6,196 | [
"Apache-2.0"
] | 1 | 1fd3309f693f9cd765f56b12375ed0e7c41ef093 | https://github.com/ana-kuznetsova/s3prl/tree/1fd3309f693f9cd765f56b12375ed0e7c41ef093 | import torch
import torch.nn as nn
class Model(nn.Module):
__constants__ = ['mode', 'dim', 'eps']
def __init__(self, mode='global', dim=2, eps=1e-10):
super().__init__()
if mode != 'global':
raise NotImplementedError(
'Only support global mean variance normalizatio... |
PositionalEncoding | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
import torch.nn
import torch.optim
class PositionalEncoding(nn.Module):
"""
A special, non-learnable positional encoding for handling variable (possibly longer)
lengths of inputs. We simply add an ordinal number as an additional dimension for
the input embeddings, and... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | ananthsub/ReAgent | PositionalEncoding | false | 6,197 | [
"BSD-3-Clause"
] | 1 | 92f223a135b8fbc0942a217acb117ad0935897a3 | https://github.com/ananthsub/ReAgent/tree/92f223a135b8fbc0942a217acb117ad0935897a3 | import torch
from torch import nn
import torch.nn
import torch.optim
class Model(nn.Module):
"""
A special, non-learnable positional encoding for handling variable (possibly longer)
lengths of inputs. We simply add an ordinal number as an additional dimension for
the input embeddings, and then project... |
ToTensor | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | from torch.nn import Module
import torch
class ToTensor(Module):
def __init__(self):
super(ToTensor, self).__init__()
def forward(self, x):
x = x / 255
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._em... | alinavalinav/finn | ToTensor | false | 6,198 | [
"BSD-3-Clause"
] | 1 | e443a5859066a410a63c08dcfec4a90527ca24be | https://github.com/alinavalinav/finn/tree/e443a5859066a410a63c08dcfec4a90527ca24be | from torch.nn import Module
import torch
class Model(Module):
def __init__(self):
super().__init__()
def forward(self, x):
x = x / 255
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return []
|
Discriminator2d | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.utils.data
import torch
class Discriminator2d(nn.Module):
def __init__(self, ngpu, wd, nc_d):
super(Discriminator2d, self).__init__()
self.ngpu = ngpu
self.conv0 = nn.Conv2d(nc_d, 2 ** (wd - 4), 4, 2, 1)
self.conv1 = nn.Conv2d(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 ... | amirDahari1/super-res | Discriminator2d | false | 6,199 | [
"MIT"
] | 1 | 2a93a20d65c570a5398caef65957fb612c3581c8 | https://github.com/amirDahari1/super-res/tree/2a93a20d65c570a5398caef65957fb612c3581c8 | import torch
import torch.nn as nn
import torch.utils.data
import torch
class Model(nn.Module):
def __init__(self, ngpu, wd, nc_d):
super().__init__()
self.ngpu = ngpu
self.conv0 = nn.Conv2d(nc_d, 2 ** (wd - 4), 4, 2, 1)
self.conv1 = nn.Conv2d(2 ** (wd - 4), 2 ** (wd - 3), 4, 2, 1... |
KD | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class KD(nn.Module):
def __init__(self, alpha, T):
super(KD, self).__init__()
self.alpha = alpha
self.T = T
def forward(self, output_stu, output_tch, label):
loss_stu = F.cross_entropy(output_stu, label)
... | 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... | amoonfana/Knowledge_Distillation | KD | false | 6,200 | [
"Apache-2.0"
] | 1 | 1ee814a8f70ae00d17e1e1ee778d5420d96c43c4 | https://github.com/amoonfana/Knowledge_Distillation/tree/1ee814a8f70ae00d17e1e1ee778d5420d96c43c4 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, alpha, T):
super().__init__()
self.alpha = alpha
self.T = T
def forward(self, output_stu, output_tch, label):
loss_stu = F.cross_entropy(output_stu, label)
la... |
handpose_model | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from collections import OrderedDict
import torch.nn as nn
def make_layers(block, no_relu_layers):
layers = []
for layer_name, v in block.items():
if 'pool' in layer_name:
layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2])
layers.append((layer_name, l... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from collections import Order... | alanlee-chn/handpose-est | handpose_model | false | 6,201 | [
"MIT"
] | 1 | 241a6beb45e045e65a328aade22ce536f4dcd893 | https://github.com/alanlee-chn/handpose-est/tree/241a6beb45e045e65a328aade22ce536f4dcd893 | import torch
from collections import OrderedDict
import torch.nn as nn
def make_layers(block, no_relu_layers):
layers = []
for layer_name, v in block.items():
if 'pool' in layer_name:
layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2])
layers.append((layer_name, l... |
FeedForward | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff=2048, dropout=0.1):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linear(d_ff, d_mo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | and-smith/Vac-Scholar-Curb-GAN | FeedForward | false | 6,202 | [
"MIT"
] | 1 | 142bd70fdf0f1cbc4a1c20c5e58fa5b6a9dbe742 | https://github.com/and-smith/Vac-Scholar-Curb-GAN/tree/142bd70fdf0f1cbc4a1c20c5e58fa5b6a9dbe742 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, d_model, d_ff=2048, dropout=0.1):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linear(d_ff, d_model)
... |
VAE | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch.nn import functional as F
import torch.nn as nn
import torch.utils.data
class VAE(nn.Module):
def __init__(self, dim, middle=400, bottleneck=100):
super(VAE, self).__init__()
self.dim = dim
self.fc1 = nn.Linear(dim, middle)
self.fc21 = nn.Linear(middle, bot... | 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... | anandijain/audio | VAE | false | 6,203 | [
"MIT"
] | 1 | 1990de57ebc760cf6c5cc7132119b389cfd2dbfb | https://github.com/anandijain/audio/tree/1990de57ebc760cf6c5cc7132119b389cfd2dbfb | import torch
from torch.nn import functional as F
import torch.nn as nn
import torch.utils.data
class Model(nn.Module):
def __init__(self, dim, middle=400, bottleneck=100):
super().__init__()
self.dim = dim
self.fc1 = nn.Linear(dim, middle)
self.fc21 = nn.Linear(middle, bottleneck... |
SelfAttentionPooling | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class SelfAttentionPooling(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super(SelfAttentio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ana-kuznetsova/s3prl | SelfAttentionPooling | false | 6,204 | [
"Apache-2.0"
] | 1 | 1fd3309f693f9cd765f56b12375ed0e7c41ef093 | https://github.com/ana-kuznetsova/s3prl/tree/1fd3309f693f9cd765f56b12375ed0e7c41ef093 | import torch
import torch.nn as nn
class Model(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super().__init__()
self.W... |
down_right_shifted_conv2d | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm as wn
def right_shift(x, pad=None):
xs = [int(y) for y in x.size()]
x = x[:, :, :, :xs[3] - 1]
pad = nn.ZeroPad2d((1, 0, 0, 0)) if pad is None else pad
return pad(x)
class down_right_shifted_conv2d(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 torch.nn as ... | andiac/pixel-cnn-pp | down_right_shifted_conv2d | false | 6,205 | [
"MIT"
] | 1 | 3ba856320e40208cbb6e9cac3e66a739f148903e | https://github.com/andiac/pixel-cnn-pp/tree/3ba856320e40208cbb6e9cac3e66a739f148903e | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm as wn
def right_shift(x, pad=None):
xs = [int(y) for y in x.size()]
x = x[:, :, :, :xs[3] - 1]
pad = nn.ZeroPad2d((1, 0, 0, 0)) if pad is None else pad
return pad(x)
class Model(nn.Module):
def __init__(self, num_filters_... |
SuperPointNet | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
class SuperPointNet(torch.nn.Module):
""" Pytorch definition of SuperPoint Network. """
def __init__(self):
super(SuperPointNet, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.pool = torch.nn.MaxPool2d(kernel_size=2, stride=2)
c1, c2, c3, c4, c5,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | albutko/vlb | SuperPointNet | false | 6,206 | [
"BSD-2-Clause"
] | 1 | 437245c0991948eeb36a277937a7e67d389041e4 | https://github.com/albutko/vlb/tree/437245c0991948eeb36a277937a7e67d389041e4 | import torch
class Model(torch.nn.Module):
""" Pytorch definition of SuperPoint Network. """
def __init__(self):
super().__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.pool = torch.nn.MaxPool2d(kernel_size=2, stride=2)
c1, c2, c3, c4, c5, d1 = 64, 64, 128, 128, 256... |
down_shifted_conv2d | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm as wn
def down_shift(x, pad=None):
xs = [int(y) for y in x.size()]
x = x[:, :, :xs[2] - 1, :]
pad = nn.ZeroPad2d((0, 0, 1, 0)) if pad is None else pad
return pad(x)
class down_shifted_conv2d(nn.Module):
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 torch.nn as ... | andiac/pixel-cnn-pp | down_shifted_conv2d | false | 6,207 | [
"MIT"
] | 1 | 3ba856320e40208cbb6e9cac3e66a739f148903e | https://github.com/andiac/pixel-cnn-pp/tree/3ba856320e40208cbb6e9cac3e66a739f148903e | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm as wn
def down_shift(x, pad=None):
xs = [int(y) for y in x.size()]
x = x[:, :, :xs[2] - 1, :]
pad = nn.ZeroPad2d((0, 0, 1, 0)) if pad is None else pad
return pad(x)
class Model(nn.Module):
def __init__(self, num_filters_i... |
ContrastiveLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
class ContrastiveLoss(nn.Module):
"""
Contrastive loss
Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise.
Code from https://github.com/adambielski/siamese-triplet"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | anish-lu-yihe/abcpy | ContrastiveLoss | false | 6,208 | [
"BSD-3-Clause-Clear"
] | 1 | be58367c4d7e38ee696238e3d8405e8abe2defb7 | https://github.com/anish-lu-yihe/abcpy/tree/be58367c4d7e38ee696238e3d8405e8abe2defb7 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
"""
Contrastive loss
Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise.
Code from https://github.com/adambielski/siamese-triplet"""
def __i... |
LabelSmoothingBCE | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
class LabelSmoothingBCE(nn.Module):
def __init__(self, smoothing=0.0):
super(LabelSmoothingBCE, self).__init__()
self.criterion = nn.BCEWithLogitsLoss(reduction='none')
self.confidence = 1.0 - s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | anoushkt/craftassist | LabelSmoothingBCE | false | 6,209 | [
"MIT"
] | 1 | c200af65e52e800f0f0cc540fe836b644383349d | https://github.com/anoushkt/craftassist/tree/c200af65e52e800f0f0cc540fe836b644383349d | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
class Model(nn.Module):
def __init__(self, smoothing=0.0):
super().__init__()
self.criterion = nn.BCEWithLogitsLoss(reduction='none')
self.confidence = 1.0 - smoothing
self.smoothing = s... |
SmoothL1Loss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.utils.data
def smooth_l1_loss(input, target, beta=1.0 / 9, size_average=True):
"""
very similar to the smooth_l1_loss from pytorch, but with
the extra beta parameter
"""
n = torch.abs(input - target)
cond = n < beta
loss = torch.where(cond, 0.5 * n ** 2 / beta, n ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | anslt/retinamask | SmoothL1Loss | false | 6,210 | [
"MIT"
] | 1 | 12b58febfd0a5ed6914796a4a3db60c2a8181370 | https://github.com/anslt/retinamask/tree/12b58febfd0a5ed6914796a4a3db60c2a8181370 | import torch
import torch.utils.data
def smooth_l1_loss(input, target, beta=1.0 / 9, size_average=True):
"""
very similar to the smooth_l1_loss from pytorch, but with
the extra beta parameter
"""
n = torch.abs(input - target)
cond = n < beta
loss = torch.where(cond, 0.5 * n ** 2 / beta, n ... |
nin | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm as wn
class nin(nn.Module):
def __init__(self, dim_in, dim_out):
super(nin, self).__init__()
self.lin_a = wn(nn.Linear(dim_in, dim_out))
self.dim_out = dim_out
def forward(self, x):
""" a network in net... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | andiac/pixel-cnn-pp | nin | false | 6,211 | [
"MIT"
] | 1 | 3ba856320e40208cbb6e9cac3e66a739f148903e | https://github.com/andiac/pixel-cnn-pp/tree/3ba856320e40208cbb6e9cac3e66a739f148903e | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm as wn
class Model(nn.Module):
def __init__(self, dim_in, dim_out):
super().__init__()
self.lin_a = wn(nn.Linear(dim_in, dim_out))
self.dim_out = dim_out
def forward(self, x):
""" a network in network la... |
UpsamplingBlock | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.utils.data
import torch
import torch.nn as nn
class UpsamplingBlock(nn.Module):
def __init__(self, input_nc, output_nc, kernel, stride, pad):
"""
Single block of upsampling operation
Input:
- int input_nc : Input number of channels
- int outpu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
impor... | andrewjong/Guided-pix2pix | UpsamplingBlock | false | 6,212 | [
"BSD-3-Clause"
] | 1 | 0c6a7b5fde50ad7ea4fb20a6136fc6cb6c4e5542 | https://github.com/andrewjong/Guided-pix2pix/tree/0c6a7b5fde50ad7ea4fb20a6136fc6cb6c4e5542 | import torch
import torch.utils.data
import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, input_nc, output_nc, kernel, stride, pad):
"""
Single block of upsampling operation
Input:
- int input_nc : Input number of channels
- int output_nc : O... |
MultiHeadAttention | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | and-smith/Vac-Scholar-Curb-GAN | MultiHeadAttention | false | 6,213 | [
"MIT"
] | 1 | 142bd70fdf0f1cbc4a1c20c5e58fa5b6a9dbe742 | https://github.com/and-smith/Vac-Scholar-Curb-GAN/tree/142bd70fdf0f1cbc4a1c20c5e58fa5b6a9dbe742 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.0... |
HighwayNetwork | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
class HighwayNetwork(nn.Module):
def __init__(self, in_dim, out_dim):
super(HighwayNetwork, self).__init__()
self.gate_proj = nn.Linear(in_dim, out_dim)
self.lin_proj = nn.Linear(in_dim, out_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
import ... | anoushkt/craftassist | HighwayNetwork | false | 6,214 | [
"MIT"
] | 1 | c200af65e52e800f0f0cc540fe836b644383349d | https://github.com/anoushkt/craftassist/tree/c200af65e52e800f0f0cc540fe836b644383349d | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
class Model(nn.Module):
def __init__(self, in_dim, out_dim):
super().__init__()
self.gate_proj = nn.Linear(in_dim, out_dim)
self.lin_proj = nn.Linear(in_dim, out_dim)
self.nonlin_proj = ... |
HighwayLayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
def my_xavier_init(m, gain=1):
for p in m.parameters():
if p.dim() > 1:
nn.init.xavier_uniform_(p, gain)
else:
nn.init.constant_(p, 0)
class HighwayLayer(torch.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.triton_helpers import libdevice
import torch.nn as ... | anoushkt/craftassist | HighwayLayer | false | 6,215 | [
"MIT"
] | 1 | c200af65e52e800f0f0cc540fe836b644383349d | https://github.com/anoushkt/craftassist/tree/c200af65e52e800f0f0cc540fe836b644383349d | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
def my_xavier_init(m, gain=1):
for p in m.parameters():
if p.dim() > 1:
nn.init.xavier_uniform_(p, gain)
else:
nn.init.constant_(p, 0)
class Model(torch.nn.Module):
def __i... |
DiceLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
self.smooth = 1.0
def forward(self, y_pred, y_true):
assert y_pred.size() == y_true.size()
y_pred = y_pred[:, 0].contiguous().view(-1)
y_true = y_true[:,... | 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... | anudeepsekhar/Lane-Detection-Pytorch | DiceLoss | false | 6,216 | [
"MIT"
] | 1 | cfddda8a0768cf83afd87e29d605fd58aa89df59 | https://github.com/anudeepsekhar/Lane-Detection-Pytorch/tree/cfddda8a0768cf83afd87e29d605fd58aa89df59 | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self):
super().__init__()
self.smooth = 1.0
def forward(self, y_pred, y_true):
assert y_pred.size() == y_true.size()
y_pred = y_pred[:, 0].contiguous().view(-1)
y_true = y_true[:, 0].contiguous().... |
MixtureSoftmax | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
def project_simplex(x):
"""
Project an arbitary vector onto the simplex.
See [Wang & Carreira-Perpin 2013] for a description and references.
"""
n = x.size()[0]
mu = torch.sort(x, 0, descending=True)[0]
sm = 0
for j in xrange(1, n + 1):
sm += ... | 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... | anuar12/deep_game_theory | MixtureSoftmax | false | 6,217 | [
"MIT"
] | 1 | 1debe5a498fe5f017f2791965a5e529b0dfb0529 | https://github.com/anuar12/deep_game_theory/tree/1debe5a498fe5f017f2791965a5e529b0dfb0529 | import torch
import torch.nn as nn
def project_simplex(x):
"""
Project an arbitary vector onto the simplex.
See [Wang & Carreira-Perpin 2013] for a description and references.
"""
n = x.size()[0]
mu = torch.sort(x, 0, descending=True)[0]
sm = 0
for j in xrange(1, n + 1):
sm += ... |
vggUpconv | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class vggUpconv(nn.Module):
"""Some Information about vggUpconv"""
def __init__(self, in_ch, out_ch, upsample=True):
super(vggUpconv, self).__init__()
if upsample:
self.upsample = nn.Upsample(scale_factor=2, mode='bilinear')
else:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | anudeepsekhar/Lane-Detection-Pytorch | vggUpconv | false | 6,218 | [
"MIT"
] | 1 | cfddda8a0768cf83afd87e29d605fd58aa89df59 | https://github.com/anudeepsekhar/Lane-Detection-Pytorch/tree/cfddda8a0768cf83afd87e29d605fd58aa89df59 | import torch
import torch.nn as nn
class Model(nn.Module):
"""Some Information about vggUpconv"""
def __init__(self, in_ch, out_ch, upsample=True):
super().__init__()
if upsample:
self.upsample = nn.Upsample(scale_factor=2, mode='bilinear')
else:
self.upsample ... |
MCCRLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
from torch import nn
class MCCRLoss(nn.Module):
"""Maximum Correntropy Criterion Induced Losses for Regression(MCCR) Loss"""
def __init__(self, sigma=1.0):
super().__init__()
assert sigma > 0
self.sigma2 = sigma ** 2
def forward(self, _input: 'torch.Tensor', _target:... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | appleparan/mise.py | MCCRLoss | false | 6,219 | [
"MIT"
] | 1 | a77ea51be37a739928600c66d168d69b78bc0c4b | https://github.com/appleparan/mise.py/tree/a77ea51be37a739928600c66d168d69b78bc0c4b | import torch
from torch import nn
class Model(nn.Module):
"""Maximum Correntropy Criterion Induced Losses for Regression(MCCR) Loss"""
def __init__(self, sigma=1.0):
super().__init__()
assert sigma > 0
self.sigma2 = sigma ** 2
def forward(self, _input: 'torch.Tensor', _target: 't... |
OrMixer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class MlpBlock(nn.Module):
def __init__(self, features, hidden_dim):
super().__init__()
self.hidden_dim = hidden_dim
self.features = features
self.fc1 = nn.Linear(self.features, self.hidden_dim)
self.fc2 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | amayuelas/NNKGReasoning | OrMixer | false | 6,220 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class MlpBlock(nn.Module):
def __init__(self, features, hidden_dim):
super().__init__()
self.hidden_dim = hidden_dim
self.features = features
self.fc1 = nn.Linear(self.features, self.hidden_dim)
self.fc2 = ... |
MlpMixer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
import torch.nn.functional as F
class MlpBlock(nn.Module):
def __init__(self, features, hidden_dim):
super().__init__()
self.hidden_dim = hidden_dim
self.features = features
self.fc1 = nn.Linear(self.features, self.hidden_dim)
self.fc2 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | amayuelas/NNKGReasoning | MlpMixer | false | 6,221 | [
"MIT"
] | 1 | 0e3623b344fd4e3088ece897f898ddbb1f80888d | https://github.com/amayuelas/NNKGReasoning/tree/0e3623b344fd4e3088ece897f898ddbb1f80888d | import torch
import torch.nn as nn
import torch.nn.functional as F
class MlpBlock(nn.Module):
def __init__(self, features, hidden_dim):
super().__init__()
self.hidden_dim = hidden_dim
self.features = features
self.fc1 = nn.Linear(self.features, self.hidden_dim)
self.fc2 = ... |
Building_Block | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | and-smith/Vac-Scholar-Curb-GAN | Building_Block | false | 6,222 | [
"MIT"
] | 1 | 142bd70fdf0f1cbc4a1c20c5e58fa5b6a9dbe742 | https://github.com/and-smith/Vac-Scholar-Curb-GAN/tree/142bd70fdf0f1cbc4a1c20c5e58fa5b6a9dbe742 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = scores.masked_fill(mask == 0, -1000000000.0... |
LossAttentionLayer | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class LossAttentionLayer(nn.Module):
def __init__(self):
super(LossAttentionLayer, self).__init__()
def forward(self, features, W_1, b_1):
out_c = F.linear(features, W_1, b_1)
out = out_c - out... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | apardyl/ProtoPNet | LossAttentionLayer | false | 6,223 | [
"MIT"
] | 1 | b2bbd7284bfc84a37385c0e975408c68cdf64205 | https://github.com/apardyl/ProtoPNet/tree/b2bbd7284bfc84a37385c0e975408c68cdf64205 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Model(nn.Module):
def __init__(self):
super().__init__()
def forward(self, features, W_1, b_1):
out_c = F.linear(features, W_1, b_1)
out = out_c - out_c.max()
out = out.exp()
... |
KLLoss | # AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _al... | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
def kl_loss(x, y):
x = F.softmax(x.detach(), dim=1)
y = F.log_softmax(y, dim=1)
return torch.mean(torch.sum(x * (torch.log(x) - y), dim=1))
class KLLoss(nn.Module):
def forward(self, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | anurag1paul/pseudo_lidar | KLLoss | false | 6,224 | [
"MIT"
] | 1 | 02faf327efd43c986629d0ea797b058e464c05aa | https://github.com/anurag1paul/pseudo_lidar/tree/02faf327efd43c986629d0ea797b058e464c05aa | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
def kl_loss(x, y):
x = F.softmax(x.detach(), dim=1)
y = F.log_softmax(y, dim=1)
return torch.mean(torch.sum(x * (torch.log(x) - y), dim=1))
class Model(nn.Module):
def forward(self, x... |
Time2Vec | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
from torch import nn
class Time2Vec(nn.Module):
"""Encode time information
phi and omega has k + 1 elements per each time step
so, from input (batch_size, sample_size) will be
ouptut (batch_size, sample_size, embed_size)
Reference
* https://arxiv.org/abs/1907.05321
* https:/... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | appleparan/mise.py | Time2Vec | false | 6,225 | [
"MIT"
] | 1 | a77ea51be37a739928600c66d168d69b78bc0c4b | https://github.com/appleparan/mise.py/tree/a77ea51be37a739928600c66d168d69b78bc0c4b | import torch
from torch import nn
class Model(nn.Module):
"""Encode time information
phi and omega has k + 1 elements per each time step
so, from input (batch_size, sample_size) will be
ouptut (batch_size, sample_size, embed_size)
Reference
* https://arxiv.org/abs/1907.05321
* https://gi... |
MatrixLayer | # AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _alig... | import torch
import torch.nn as nn
class ActionPool(nn.Module):
"""
Basic pooling operations.
"""
def __init__(self, axis, function='mean', expand=True):
super(ActionPool, self).__init__()
self.expand = expand
self._function_name = function
self._axis_name = axis
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | anuar12/deep_game_theory | MatrixLayer | false | 6,226 | [
"MIT"
] | 1 | 1debe5a498fe5f017f2791965a5e529b0dfb0529 | https://github.com/anuar12/deep_game_theory/tree/1debe5a498fe5f017f2791965a5e529b0dfb0529 | import torch
import torch.nn as nn
class ActionPool(nn.Module):
"""
Basic pooling operations.
"""
def __init__(self, axis, function='mean', expand=True):
super().__init__()
self.expand = expand
self._function_name = function
self._axis_name = axis
if isinstanc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.