I’m getting your code to run fine, although I changed one thing:
pool = Pool(processes = 3)
ret  = pool.map(self.f, range(self.K))
print(ret)

to
with Pool(processes = 3) as pool:
    ret  = pool.map(self.f, range(self.K))
print(ret)

Dont forget to close your pools if you dont use a with statement