Inference device and inference method