INNER CODE UNIT · Python
x
deepchem/deepchem · contrib/tensorflow_models/__init__.py:36
x = np.exp(x)
row_sum = np.sum(x, axis=1)
x /= row_sum.reshape((x.shape[0], 1))
# (n_samples, n_tasks, n_classes)
elif len(x.shape) == 3:
row_max = np.max(x, axis=2)
x -= row_max.reshape(x.shape[:2] + (1,))
x = np.exp(x)
row_sum = np.sum(x, axis=2)
x /= row_sum.reshape(x.shape[:2] + (1,))
return x
class TensorflowGraph(object):
"""Simple class that holds information needed to run Tensorflow graph."""
def __init__(self, graph, session, name_scopes, output, labels, weights,
loss):