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 | |
import tensorflow as tf | |
data_size = 10 | |
input_size = 28 * 28 | |
hidden1_output = 200 | |
output_size = 1 | |
data = tf.placeholder(tf.float32, shape=(data_size, input_size)) |
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 | |
import tensorflow as tf | |
data_size = 10 | |
input_size = 28 * 28 | |
hidden1_output = 200 | |
output_size = 1 | |
data = np.random.randn(data_size, input_size) |
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 torch | |
import torch.nn as nn | |
import torch.nn.functional as fun | |
data_size = 10 | |
input_size = 28 * 28 | |
hidden1_output = 200 | |
output_size = 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
# update for https://gist.github.com/Oktai15/4b6617b916c0fa4feecab35be09c1bd6 | |
a = tf.constant(10) | |
data = tf.placeholder(tf.float32, shape=(data_size, input_size)) | |
h1_w1 = tf.placeholder(tf.float32, shape=(input_size, hidden1_output)) | |
h2_w1 = tf.placeholder(tf.float32, shape=(input_size, hidden1_output)) | |
def first(): return tf.matmul(data, h1_w1) | |
def second(): return tf.matmul(data, h2_w1) | |
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 torch | |
h0 = torch.randn(10) | |
x = torch.randn(5, 10) | |
h = [h0] | |
for i in range(5): | |
h_i = h[-1] * x[i] | |
h.append(h_i) |
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: "SimpleCaffeNet" | |
layer { | |
name: "data" | |
type: "Input" | |
top: "data" | |
input_param { shape: { dim: 10 dim: 1 dim: 28 dim: 28 } } | |
} | |
layer { | |
name: "fc1" | |
type: "InnerProduct" |
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 torch | |
import torch.nn as nn | |
import torch.optim as optim | |
from torch.distributions.normal import Normal | |
num_gaussian = 6 | |
gaussian_dim = 1 | |
device = torch.device("cuda") |