IValue doesn’t have a .type() method since it’s a generic container for values (similar to Python’s PyObject). You should be able to just call .toTensor() to convert it to a tensor (make sure to guard it with a call to .isTensor() to make sure the IValue is what you expect).
You can find more details here. We are actively working on improving the JIT’s C++ API so issues like this will be more clear in the future.
Thanks a lot, @driazati.
I am using torch::jit::Value, not IValue .
I know how to convert IValue to tensor by toTensor. How about for for torch::jit::Value or torch::jit::Node?
Sorry for the confusion, you can think of torch::jit::Value as a variable in the graph (i.e. it has no concrete value until the graph is run), so there’s really no way to extract its value since it doesn’t have one. You can read more about it here. If you are trying to extract intermediate values from the graph, there’s no way to do that currently but you can follow along at this issue.