concat_op_test.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:complex_tf 作者: woodshop 项目源码 文件源码
def testShapeWithUnknownConcatDim(self):
    p1 = array_ops.placeholder(dtypes.complex64)
    c1 = constant_op.constant(np.complex64(10.0+0j), shape=[4, 4, 4, 4])
    p2 = array_ops.placeholder(dtypes.complex64)
    c2 = constant_op.constant(np.complex64(20.0+0j), shape=[4, 4, 4, 4])
    dim = array_ops.placeholder(dtypes.int32)
    concat = array_ops.concat([p1, c1, p2, c2], dim)
    self.assertEqual(4, concat.get_shape().ndims)

    # All dimensions unknown.
    concat2 = array_ops.concat([p1, p2], dim)
    self.assertEqual(None, concat2.get_shape())

    # Rank doesn't match.
    c3 = constant_op.constant(np.complex64(30.0+0j), shape=[4, 4, 4])
    with self.assertRaises(ValueError):
      array_ops.concat([p1, c1, p2, c3], dim)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号