using mean (a la average pooling) is the usual reduction method for unknown lengths. but by itself it is too simplistic, i.e. it is a linear interpolation invariant to reordering. one possibility is to apply an attention layer first.