This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cugraph | |
import torch | |
def louvain(dgl_g): | |
cugraph_g = dgl_g.to_cugraph().to_undirected() | |
df, _ = cugraph.louvain(cugraph_g, resolution=3) | |
# revert the node ID renumbering by cugraph | |
df = cugraph_g.unrenumber(df, 'vertex').sort_values('vertex') | |
return torch.utils.dlpack.from_dlpack(df['partition'].to_dlpack()).long() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import re | |
import numpy as np | |
import scipy.sparse as sp | |
from sklearn.feature_extraction.text import CountVectorizer | |
top50 = [ | |
'trees', | |
'buildapc', | |
'gaming', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mxnet as mx | |
import mxnet.ndarray as nd | |
#import minpy.ndarray as nd | |
context = mx.gpu(0) | |
def linear(X, W, bias): | |
return nd.dot(X, W) + bias | |
def sigmoid(x): | |
return .5 * (nd.tanh(.5 * x) + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <dmlc/io.h> | |
#include <dmlc/recordio.h> | |
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
using namespace dmlc; | |
void print_usage() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def foo(x, y): | |
return np.dot(x, y) | |
x = np.zeros((256, 512)) | |
y = np.zeros((512, 512)) | |
def example(): | |
for i in range(0,100): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "VGG16_RPN_TEST" | |
input: "data" | |
input_shape { | |
dim: 1 | |
dim: 3 | |
dim: 224 | |
dim: 224 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Operator classes | |
class BasicOperator; | |
template<int num_input, int num_output> | |
class OperatorTempl : public BasicOperator; | |
// An user code example | |
class SomeOperator : public OperatorTempl<1, 2> { | |
public: | |
SomeOperator( ... ) { } // any constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DeclareOperator(Name) { | |
DeclareInput_1(sh) { | |
return sh.size() == 4; | |
} | |
DeclareInput_2(sh) { | |
return ... | |
} | |
DeclareOutput_1 = {24, 24, input1.shape(0)} | |
DeclareOutput_2 = {1, 1, input1.shape(3), 1} | |
DeclareKernel(InData* input1, InData* input2, OutData* output1, OutData* output2, Context& ctx) { |