def forward(self, x):
        """Performs the forward pass.

    Args:
      x: 2-d array of size batch_size x image_size.

    Returns:
      A 2-d array of size batch_size x num_classes.
    """
        def sigmoid(x):
            return 1.0 / (1.0 + np.exp(-x))

        for w, b in zip(self.weights, self.biases):
            x = sigmoid(np.dot(w, x.T).T + b)
        return x
Esempio n. 2
0
 def foo(tree_arg):
     x, (y, z) = tree_arg
     return tf_np.dot(x, tf_np.dot(y, z))
Esempio n. 3
0
 def foo2(tree_arg):
     x, dct = tree_arg
     y, z = dct['a'], dct['b']
     return tf_np.dot(x, tf_np.dot(y, z))