def testComputation(self):
with self.test_session() as sess:
x = sess.run(snt.nets.identity_kernel_initializer([3, 3, 5, 5]))
# Iterate over elements. Assert that only the middle pixel is on when in
# and out channels are same.
it = np.nditer(x, flags=["multi_index"])
while not it.finished:
value, idx = it[0], it.multi_index
(filter_height, filter_width, in_channel, out_channel) = idx
if (filter_height == 1 and filter_width == 1 and
in_channel == out_channel):
self.assertEqual(value, 1)
else:
self.assertEqual(value, 0)
it.iternext()
评论列表
文章目录