Hey,
I’m trying to edit a graph representation (torch._C.Graph) via python API.
I want to add a node at the begging of the graph that returns a CUDA device.
this is what I did:
cuda_node = graph.create('prim::Constant[value="cuda:0"]')
cuda_value = next(cuda_node.outputs())
cuda_value.setType(torch._C.DeviceObjType.get())
graph.prependNode(cuda_node)

This code has been successfully ran, but I get this error when I run the graph function by torch._C._create_function_from_graph(...) :
RuntimeError: 0 INTERNAL ASSERT FAILED at "/pytorch/torch/csrc/jit/ir/alias_analysis.cpp":465, please report a bug to PyTorch. We don't have an op for prim::Constant[value="cuda:0"] but it isn't a special case.  Argument types: 

How can I create this kind of node without experience this issue ?
Thanks.