problem_unittests.py 文件源码

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

项目:deep-learning-nd 作者: RyanCCollins 项目源码 文件源码
def _assert_tensor_shape(tensor, shape, display_name):
    assert tf.assert_rank(tensor, len(shape), message='{} has wrong rank'.format(display_name))

    tensor_shape = tensor.get_shape().as_list() if len(shape) else []

    wrong_dimension = [ten_dim for ten_dim, cor_dim in zip(tensor_shape, shape)
                       if cor_dim is not None and ten_dim != cor_dim]
    assert not wrong_dimension, \
        '{} has wrong shape.  Found {}'.format(display_name, tensor_shape)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号