I was writing pytorch custom op with c++. Two at::Tensor with shape (1, 3) cannot be multiply or add because of the following error.
RuntimeError: expected type CPUFloatType but got Variable[CPUFloatType] (compute_types at /pytorch/aten/src/ATen/
native/TensorIterator.cpp:134)
frame #0: std::function<std::string ()>::operator()() const + 0x11 (0x7f8fcf5d3021 in /opt/conda/lib/python3.6/site-packages/torch/lib/libc10.so)
frame #1: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x2a (0x7f8fcf5d28ea in /opt/conda/lib/pyt
hon3.6/site-packages/torch/lib/libc10.so)
frame #2: at::TensorIterator::compute_types() + 0x36b (0x7f8fd016c89b in /opt/conda/lib/python3.6/site-packages/t
orch/lib/libcaffe2.so)
frame #3: at::TensorIterator::Builder::build() + 0x46 (0x7f8fd016e4f6 in /opt/conda/lib/python3.6/site-packages/t
orch/lib/libcaffe2.so)
frame #4: at::TensorIterator::binary_op(at::Tensor&, at::Tensor const&, at::Tensor const&) + 0x2c4 (0x7f8fd016ee6
4 in /opt/conda/lib/python3.6/site-packages/torch/lib/libcaffe2.so)
frame #5: at::native::add_out(at::Tensor&, at::Tensor const&, at::Tensor const&, c10::Scalar) + 0x71 (0x7f8fd004f
0d1 in /opt/conda/lib/python3.6/site-packages/torch/lib/libcaffe2.so)
frame #6: at::native::add(at::Tensor const&, at::Tensor const&, c10::Scalar) + 0x32 (0x7f8fd004f542 in /opt/conda
/lib/python3.6/site-packages/torch/lib/libcaffe2.so)

I print out the two tensor via cout and the result is
 0
 1
 0
[ CPUFloatType{3} ]
 0
 0
 0
[ Variable[CPUFloatType]{3} ]

I don’t get the reason why they have different type. If so, how can I turn the type Variable[CPUFloatType]{3} to CPUFloatType?