(1)若是tensor只有一个元素,而后转换成int或者float类型的时候直接用int()或者float()就能够了;float
(2)若是tensor含有多个元素,转换成ndarray时就要用x.detach().numpy()操做了(视状况使用,cpu());numpy