You are recreating tri_mat in the forward method, so this tensor is not part of the model but just a temporary tensor, so it won’t use any specific device.
Also note, that a module doesn’t necessarily belong to a single device, since you can use model sharding etc.