Created
January 16, 2020 18:58
-
-
Save rdisipio/47458bee025045def06de9333865c595 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def make_model_quantum(n_categories, n_qubits=4, n_layers=2, embedding_dim=512): | |
text_in = keras.Input( shape=(embedding_dim,), dtype=tf.float64, name='text_in') | |
x = layers.Dense(n_qubits, activation='tanh', dtype=tf.float64)(text_in) | |
x = VariationalQuantumCircuit( | |
n_categories=n_categories, | |
n_qubits=n_qubits, | |
n_layers=n_layers)(x) | |
assert x.shape[-1] == n_qubits | |
x_out = layers.Dense(n_categories, activation='softmax', dtype=tf.float64)(x) | |
return keras.Model(inputs=text_in, outputs=x_out, name="QuantumPreprintClassifier") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment