image_ops_test.py 文件源码

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

项目:imperative 作者: yaroslavvb 项目源码 文件源码
def temp_testCropping(self):
    x_shape = [4, 8, 1]
    x_np = np.array([[1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8],
                     [1, 2, 3, 4, 5, 6, 7, 8], [1, 2, 3, 4, 5, 6, 7, 8]],
                    dtype=np.int32).reshape(x_shape)
    y_np = np.array([[3, 4, 5, 6], [3, 4, 5, 6]]).reshape([2, 4, 1])
    with self.test_session():
      x = constant_op.constant(x_np, shape=x_shape)
      try:
        y = image_ops.central_crop(x, 0.5)
      except:
        import pdb
        pdb.post_mortem()

      y_tf = y.eval()
      self.assertAllEqual(y_tf, y_np)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号