<p>A hydraulic pump motor comprises a portion to be detected (52) formed on the outer circumferential surface of a cylinder block (14), and a rotation sensor (50) arranged opposite to the portion to be detected (52) and having a detecting portion (51) for detecting the portion to be detected (52). The detecting portion (51) of the rotation sensor (50) is arranged in a plane including both the central axis (13a) of a rotating shaft (13) and a line on the sliding surface (S) of a swash plate (17) intersecting the central axis (13a) perpendicularly. With such an arrangement, a substantially constant distance is maintained between the detecting portion (51) and the portion to be detected (52) regardless of whirling of the cylinder block (14), and therefore precision with which to detect the number of revolutions of the cylinder block can be enhanced.</p>