如何简单地打印Tensor内容
Created by: shaoshenchen
刚才看了一下最近邻上采样,如下: 1 2 3 4 变成 1 1 2 2 1 1 2 2 3 3 4 4 3 3 4 4 想用resize_nearest方法尝试做,并且输出。但是对于没有loss的网络在exe.run中不知道如何写参数
import numpy as np
import paddle.fluid as fluid
in_data = fluid.layers.data(name='input', shape=[1, 2, 2], dtype='float32')
up_sample = fluid.layers.resize_nearest(in_data, out_shape=[4, 4])
tensor = np.arange(4).reshape(1, 2, 2)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
# 下面这句话会报错,不知道怎么写
exe.run(feed={'input': tensor}, fetch_list=[up_sample])