A heat pump device comprising: a compressor including a compression mechanism configured to compress a refrigerant and a motor configured to drive the compression mechanism; heat exchangers (3,5); an inverter configured to apply a desired voltage to the motor; and an inverter control unit configured to generate PWM signals for driving the inverter, wherein the inverter control unit includes: a heating determining unit configured to determine whether heating of the compressor is necessary and notify a determination result; and a PWM-signal generating unit configured to shift to, upon receiving the notification indicating that the heating is necessary, a heating operation mode for heating the compressor and, in the heating operation mode, generate the PWM signals to provide, based on a heating time carrier signal, a period in which a reflux current circulating through the motor and the inverter flows, and characterised in that: the inverter control unit is configured to switch the heating time carrier signal among two or more predetermined frequencies and in that the PWM-signal generating unit is configured to operate such that in the heating operation mode, when switching elements configuring the inverter are divided into an upper side switching element group and a lower side switching element group, the heat pump device reduces a first period, which is a period in which all the switching elements of the upper side switching element group are turned on, from an immediately preceding first period by a predetermined time or reduces a second period, which is a period in which all the switching elements in the lower side switching element group are turned on, from an immediately preceding second period by the predetermined time and increases, by a half of the predetermined time, each of periods of other switching states before and after the period reduced by the predetermined time, so as to prevent positive and negative polarities of a current flowing to the motor from being unbalanced. a compressor including a compression mechanism configured to compress a refrigerant and a motor configured to drive the compression mechanism; heat exchangers (3,5); an inverter configured to apply a desired voltage to the motor; and an inverter control unit configured to generate PWM signals for driving the inverter, wherein a heating determining unit configured to determine whether heating of the compressor is necessary and notify a determination result; and a PWM-signal generating unit configured to shift to, upon receiving the notification indicating that the heating is necessary, a heating operation mode for heating the compressor and, in the heating operation mode, generate the PWM signals to provide, based on a heating time carrier signal, a period in which a reflux current circulating through the motor and the inverter flows, and characterised in that: the inverter control unit is configured to switch the heating time carrier signal among two or more predetermined frequencies and in that the PWM-signal generating unit is configured to operate such that in the heating operation mode, when switching elements configuring the inverter are divided into an upper side switching element group and a lower side switching element group, the heat pump device reduces a first period, which is a period in which all the switching elements of the upper side switching element group are turned on, from an immediately preceding first period by a predetermined time or reduces a second period, which is a period in which all the switching elements in the lower side switching element group are turned on, from an immediately preceding second period by the predetermined time and increases, by a half of the predetermined time, each of periods of other switching states before and after the period reduced by the predetermined time, so as to prevent positive and negative polarities of a current flowing to the motor from being unbalanced. the inverter control unit is configured to switch the heating time carrier signal among two or more predetermined frequencies and in that the PWM-signal generating unit is configured to operate such that in the heating operation mode, when switching elements configuring the inverter are divided into an upper side switching element group and a lower side switching element group, the heat pump device reduces a first period, which is a period in which all the switching elements of the upper side switching element group are turned on, from an immediately preceding first period by a predetermined time or reduces a second period, which is a period in which all the switching elements in the lower side switching element group are turned on, from an immediately preceding second period by the predetermined time and increases, by a half of the predetermined time, each of periods of other switching states before and after the period reduced by the predetermined time, so as to prevent positive and negative polarities of a current flowing to the motor from being unbalanced.