In [1]:
import numpy as np
import tensorflow as tf
from Erwin.models.tf_utils import initializers

In [2]:
shape = (3, 4)
init = initializers.get('glorot_normal_initializer')(shape)
with tf.variable_scope('layer1'):
    weights = tf.get_variable('weights', shape, initializer=init)

In [4]:
sess = tf.InteractiveSession()
init = tf.global_variables_initializer()
sess.run(init)

In [5]:
weights_numpy = weights.eval()

In [6]:
weights_numpy


Out[6]:
array([[ 0.12117469,  0.74624449, -0.19860895, -0.50875539],
       [ 0.23581439,  0.74175137, -0.6316011 , -0.36630407],
       [ 0.27373469,  0.21537092,  0.36157793, -0.44471809]], dtype=float32)

In [25]:
from tensorflow.python.ops import init_ops

In [32]:
init = init_ops.glorot_uniform_initializer()

In [36]:
with tf.variable_scope('layer3'):
    weights = tf.get_variable('weights', shape, initializer=init)
    weights.initializer.run()
    print(weights.eval())


[[ 0.81620979 -0.51413351  0.5693301  -0.31036454]
 [-0.74135774  0.51027513 -0.32406831  0.55197752]
 [ 0.62411094 -0.74446809 -0.56282979 -0.23619038]]

In [37]:
weights.eval()


Out[37]:
array([[ 0.81620979, -0.51413351,  0.5693301 , -0.31036454],
       [-0.74135774,  0.51027513, -0.32406831,  0.55197752],
       [ 0.62411094, -0.74446809, -0.56282979, -0.23619038]], dtype=float32)

$ output[b, x[0], ..., x[N-1], k] = sum_{z[0], ..., z[N-1], q} filter[z[0], ..., z[N-1], q, k] * padded_input[b, x[0]*strides[0] + dilation_rate[0]*z[0], ..., x[N-1]*strides[N-1] + dilation_rate[N-1]*z[N-1], q] $


In [38]:
from Erwin.datasets.featurizers import graph_featurizer

In [40]:
smiles = '[Cd+2]'
graph = graph_featurizer.graph_from_mol(smiles)


---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-40-3dc8fc0e6295> in <module>()
      1 smiles = '[Cd+2]'
----> 2 graph = graph_featurizer.graph_from_mol(smiles)

/home/xtalpi/bitbucket/Erwin/datasets/featurizers/graph_featurizer.pyc in graph_from_mol(pointer, sort, mol_utils)
    287     mol = mol_utils.load_mol(pointer)
    288     mol_size = mol_utils.mol_size(mol)
--> 289     assert mol_size >= 2, 'pointer with mol size: {0} received.'.format(mol_size)
    290 
    291     graph = MolGraph(mol_utils)

AssertionError: pointer with mol size: 1 received.

In [ ]: