We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice to have an export-feature for each sort of layer that can generate sample code for the main NN libraries, e.g.,
pytorch
model = torch.nn.Sequential() model.add_module("linear_1", torch.nn.Linear(input_dim, 128)) model.add_module("relu_1", torch.nn.ReLU()) model.add_module("linear_2", torch.nn.Linear(128, 64)) model.add_module("relu_1", torch.nn.ReLU()) model.add_module("linear_3", torch.nn.Linear(64, output_dim))
keras
???
tf
# Hidden 1 with tf.name_scope('hidden1'): weights = tf.Variable( tf.truncated_normal([IMAGE_PIXELS, hidden1_units], stddev=1.0 / math.sqrt(float(IMAGE_PIXELS))), name='weights') biases = tf.Variable(tf.zeros([hidden1_units]), name='biases') hidden1 = tf.nn.relu(tf.matmul(images, weights) + biases) # Hidden 2 with tf.name_scope('hidden2'): weights = tf.Variable( tf.truncated_normal([hidden1_units, hidden2_units], stddev=1.0 / math.sqrt(float(hidden1_units))), name='weights') biases = tf.Variable(tf.zeros([hidden2_units]),name='biases') hidden2 = tf.nn.relu(tf.matmul(hidden1, weights) + biases) # Linear with tf.name_scope('softmax_linear'): weights = tf.Variable( tf.truncated_normal([hidden2_units, NUM_CLASSES], stddev=1.0 / math.sqrt(float(hidden2_units))), name='weights') biases = tf.Variable(tf.zeros([NUM_CLASSES]),name='biases') logits = tf.matmul(hidden2, weights) + biases # return logits
mxnet
data = mx.symbol.Variable('data') fc1 = mx.symbol.FullyConnected(data = data, name='fc1', num_hidden=128) act1 = mx.symbol.Activation(data = fc1, name='relu1', act_type="relu") fc2 = mx.symbol.FullyConnected(data = act1, name = 'fc2', num_hidden = 64) act2 = mx.symbol.Activation(data = fc2, name='relu2', act_type="relu") fc3 = mx.symbol.FullyConnected(data = act2, name='fc3', num_hidden=10) mlp = mx.symbol.SoftmaxOutput(data = fc3, name = 'softmax')
The text was updated successfully, but these errors were encountered:
Keras (Sequential API):
model = Sequential() model.add(Dense(128, activation='relu', input_dim=input_dim)) model.add(Dense(64, activation='relu')) model.add(Dense(out_dim, activation='softmax'))
Sorry, something went wrong.
No branches or pull requests
It would be nice to have an export-feature for each sort of layer that can generate sample code for the main NN libraries, e.g.,
pytorch
keras
tf
mxnet
The text was updated successfully, but these errors were encountered: