Created by: zhangting2020
fix VLOG.
- test code
import paddle.fluid as fluid
data1 = fluid.layers.fill_constant(shape=[1, 3, 8, 8], value=0.5, dtype='float32')
data2 = fluid.layers.fill_constant(shape=[1, 3, 5, 5], value=0.5, dtype='float32')
shape = fluid.layers.shape(data2)
with fluid.device_guard("cpu"):
shape = fluid.layers.slice(shape, axes=[0], starts=[0], ends=[4])
out = fluid.layers.crop_tensor(data1, shape=shape)
place = fluid.CUDAPlace(0)
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
result = exe.run(fetch_list=[out])
- before:place of
expected_kernel_key
forslice
op is CPUPlace,but VLOG gives CUDAPlace(0)
8 11:21:30.365912 20538 operator.cc:1066] expected_kernel_key:data_type[int]:data_layout[ANY_LAYOUT]:place[CPUPlace]:library_type[PLAIN]
I0408 11:21:30.366003 20538 operator.cc:180] CUDAPlace(0) Op(slice), inputs:{EndsTensor[], EndsTensorList[], Input[shape_0.tmp_0:int[4]({})], StartsTensor[], StartsTensorList[]}, outputs:{Out[slice_0.tmp_0:int[4]({})]}.
I0408 11:21:30.366035 20538 executor_gc_helper.cc:166] Erase variable shape_0.tmp_0
I0408 11:21:30.366080 20538 operator.cc:1066] expected_kernel_key:data_type[float]:data_layout[ANY_LAYOUT]:place[CUDAPlace(0)]:library_type[PLAIN]
I0408 11:21:30.366216 20538 operator.cc:180] CUDAPlace(0) Op(crop_tensor), inputs:{Offsets[], OffsetsTensor[], Shape[slice_0.tmp_0:int[4]({})], ShapeTensor[], X[fill_constant_0.tmp_0:float[1, 3, 8, 8]({})]}, outputs:{Out[crop_tensor_0.tmp_0:float[1, 3, 5, 5]({})]}.
- after:place of
expected_kernel_key
forslice
op is CPUPlace,and VLOG gives CPUPlace
8 11:21:30.365912 20538 operator.cc:1066] expected_kernel_key:data_type[int]:data_layout[ANY_LAYOUT]:place[CPUPlace]:library_type[PLAIN]
I0408 11:21:30.366003 20538 operator.cc:180] CPUPlace Op(slice), inputs:{EndsTensor[], EndsTensorList[], Input[shape_0.tmp_0:int[4]({})], StartsTensor[], StartsTensorList[]}, outputs:{Out[slice_0.tmp_0:int[4]({})]}.
I0408 11:21:30.366035 20538 executor_gc_helper.cc:166] Erase variable shape_0.tmp_0
I0408 11:21:30.366080 20538 operator.cc:1066] expected_kernel_key:data_type[float]:data_layout[ANY_LAYOUT]:place[CUDAPlace(0)]:library_type[PLAIN]
I0408 11:21:30.366216 20538 operator.cc:180] CUDAPlace(0) Op(crop_tensor), inputs:{Offsets[], OffsetsTensor[], Shape[slice_0.tmp_0:int[4]({})], ShapeTensor[], X[fill_constant_0.tmp_0:float[1, 3, 8, 8]({})]}, outputs:{Out[crop_tensor_0.tmp_0:float[1, 3, 5, 5]({})]}.