def testCreateConvNCHW(self):
height, width = 7, 9
with self.test_session():
images = np.random.uniform(size=(5, 4, height, width))
output = layers_lib.convolution2d(images, 32, [3, 3], data_format='NCHW')
self.assertEqual(output.op.name, 'Conv/Relu')
self.assertListEqual(output.get_shape().as_list(), [5, 32, height, width])
weights = variables.get_variables_by_name('weights')[0]
self.assertListEqual(weights.get_shape().as_list(), [3, 3, 4, 32])
biases = variables.get_variables_by_name('biases')[0]
self.assertListEqual(biases.get_shape().as_list(), [32])
layers_test.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录