The units for course with grade 'F' are included in GPA calculation even though there is no grade point earned for the course.
For students admitted in or after 2017/18, students may repeat courses with grade F, for a maximum of two times, to retrieve the failure. For a course taken for more than once, only the highest grade* will be included in the calculation of cumulative GPA with effect from the semester in which the highest grade is attained. The number of units gained for the repeated course will be counted once only. The repeated course must have the same course code of the failed course taken before in order to retrieve the failure.
* If the grades attained at different attempts are the same, it is the latest grade that is included in the cGPA calculation.
http://ar.hkbu.edu.hk/curr/ug_std/exam_grades/info_grades_gpa/