Hi Roos,
Very likely, the Python inheritance of TorchScript shows, i.e. that functions pretending to be returning multiple values actually return a tuple.
So
import torch

@torch.jit.script
def d(x):
    return x,x

print(d.graph)

gives
graph(%x.1 : Tensor):
  %3 : (Tensor, Tensor) = prim::TupleConstruct(%x.1, %x.1)
  return (%3)

So a proper check would check whether auto tt = graph()->output()->type()->cast<TupleType>() and then check tt->elements().size() or somesuch. The elements() also has the types of the returns if it matters.
Best regards
Thomas