def testNNMultipleInputs(self): nn = blocks_std.NN(10, bias=blocks_std.Bias(0), act=tf.tanh) x = [tf.placeholder(dtype=tf.float32, shape=[5, 7]), tf.placeholder(dtype=tf.float32, shape=[5, 3]), tf.placeholder(dtype=tf.float32, shape=[5, 5])] y = nn(*x) xs = self.CheckNN(y, nn, 'Tanh') self.assertEqual(len(x), len(xs)) for u, v in zip(x, xs): self.assertIs(u, v)
def testConv2DBias(self): input_shape = [19, 14, 14, 64] filter_shape = [3, 7, 64, 128] strides = [1, 2, 2, 1] output_shape = [19, 6, 4, 128] conv = blocks_std.Conv2D(depth=filter_shape[-1], filter_size=filter_shape[0:2], strides=strides[1:3], padding='VALID', act=None, bias=blocks_std.Bias(1)) x = tf.placeholder(dtype=tf.float32, shape=input_shape) y = conv(x) self.CheckBiasAdd(y, conv._bias) self.assertEqual(output_shape, y.get_shape().as_list())
def testNNWithBiasWithAct(self): nn = blocks_std.NN(10, bias=blocks_std.Bias(0), act=tf.square) x = tf.placeholder(dtype=tf.float32, shape=[5, 7]) y = nn(x) self.assertIs(x, self.CheckNN(y, nn, 'Square')[0])