Thank you very much for your reply.
I tried printing value of “catnum” and here is my code.
def calc_weights(cat0_num, cat1_num, cat2_num, cat3_num, cat4_num):
    catnum = \
        np.array([cat0_num, cat1_num, cat2_num, cat3_num, cat4_num], 
                      dtype=np.float32)
    print(catnum) # -> Standard output A
    cat_sum = catnum.sum()
    catnum = catnum / cat_sum
    catnum = 1.0 / catnum
    catnum = np.round(catnum, decimals=5) # !!!decimals=5!!!
    catnum = torch.FloatTensor(catnum)
    print(catnum) # -> Standard output B
    return catnum

I run it two times and got same standard outputs.
This is the standard outputs of this code.
# Standard output A
[5.1066736e+07 1.0025117e+08 1.5670813e+07 8.5966000e+05 1.2038700e+05]

# Standard output B
tensor([   3.2892,    1.6755,   10.7186,  195.3898, 1395.2401])

If there is anything that you noticed about that please point them out for me.
Best regards,
Ryo．