Skip to content

Instantly share code, notes, and snippets.

Sharing from a friend.....
This chilled me to the bone. This problem is outrageously out of control....and this...so insightful. TIME TO WAKE UP!
(I am not the original creator of this post)
“Can you tell the difference between these kids? Can you tell if they’re sad or asking for help? Could you pick them out in a crowd of 1000 people? By requiring kids to wear masks - whether it’s in stores, in schools, or a public place - you are robbing them of their ONE hope of being found in the event that they get taken - their faces.
Did you know that more than 2,000 missing-child reports are filed each day, and that many of them can be found when parents provide specific details about their physical appearance and a photo of THEIR FACE?
Did you KNOW that a child in AMERICA is over 66,000 x more likely to be human trafficked than to get COVID-19?
So DO YOU REALIZE that by requiring children over the age of 2 to wear a mask, you are making child abduction & human trafficking SO MUCH EASIER on the offenders?
Don’t bel
import torch
import torch_geometric
from torch import nn
from torch_geometric.nn.conv import EdgeConv
class EdgeNetWithCategoriesJittable(nn.Module):
def __init__(self, input_dim=3, hidden_dim=8, output_dim=4, n_iters=1, aggr='add',
norm=torch.tensor([1./500., 1./500., 1./54., 1/25., 1./1000.])):
super(EdgeNetWithCategoriesJittable, self).__init__()
import os
import os.path as osp
import math
import numpy as np
import torch
import gc
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric.transforms as T
@lgray
lgray / column_combinatorics.py
Created July 8, 2020 20:26
examples of doing heterogenous combinations in awkward0
from uproot_methods import TLorentzVectorArray
import awkward as ak
from coffea.nanoaod import NanoEvents
def make_labeled_p4(x, indices, itype):
p4 = TLorentzVectorArray.from_ptetaphim(x.pt, x.eta, x.phi, x.mass)
return ak.JaggedArray.zip(p4=p4,
ptype=itype*x.pt.ones_like().astype(np.int),
pidx=indices
charge=x.charge)
import sys
import os
import requests
import argparse
import json
from uuid import uuid1
import pprint
os.environ['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'
Traceback (most recent call last):
File "mnist_nn_conv.py", line 71, in <module>
model = Net().to(device)
File "mnist_nn_conv.py", line 45, in __init__
self.conv1 = conv1.jittable(x=init_data.x, edge_index=init_data.edge_index, edge_attr=init_data.edge_attr)
File "/Users/lagray/pytorch_work/pytorch_geometric/torch_geometric/nn/conv/message_passing.py", line 608, in jittable
out = torch.jit.script(out)
File "/anaconda3/envs/torch/lib/python3.7/site-packages/torch/jit/__init__.py", line 1261, in script
return torch.jit._recursive.create_script_module(obj, torch.jit._recursive.infer_methods_to_compile)
File "/anaconda3/envs/torch/lib/python3.7/site-packages/torch/jit/_recursive.py", line 305, in create_script_module
import os
import os.path as osp
import math
import numpy as np
import torch
import gc
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric.transforms as T
import torch
import torch.nn.functional as F
import torch_geometric.transforms as T
import torch.nn as nn
from torch_geometric.nn import EdgeConv, DynamicEdgeConv
#let's try a basic implementation of really simple message passing
from torch_scatter import scatter_add
class NodeNetwork(nn.Module):
def __init__(self, input_dim, output_dim, hidden_activation=nn.Tanh):
# here's a dynamic reduction network that can categorize
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.drn = DynamicReductionNetwork(input_dim=3, hidden_dim=64,
k = 16,
output_dim=2, aggr='add',
norm=torch.tensor([1., 1./27., 1./27.]))
def forward(self, data):
import pyarrow as pa
import pyarrow.parquet as pq
def nanoaod2arrowtable(params):
"""
takes as input a (list of) root file(s) of ~flat ntuples
and convert into a single arrow table
"""
random.seed(None)