Skip to content

Commit 459ff14

Browse files
authored
Fix TypeError: Tuple error
The error was occurring when the F.interpolate function was called with new_height and new_width as arguments for the size parameter. These variables were of type numpy.intc, while F.interpolate expected arguments of type int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int]. The fix involves converting new_height and new_width to Python's native int type before they are passed to F.interpolate. This ensures that the function receives arguments of the correct type, preventing the TypeError.
1 parent bdc4ed6 commit 459ff14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

midas/backbones/beit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _get_rel_pos_bias(self, window_size):
4444
old_sub_table = old_relative_position_bias_table[:old_num_relative_distance - 3]
4545

4646
old_sub_table = old_sub_table.reshape(1, old_width, old_height, -1).permute(0, 3, 1, 2)
47-
new_sub_table = F.interpolate(old_sub_table, size=(new_height, new_width), mode="bilinear")
47+
new_sub_table = F.interpolate(old_sub_table, size=(int(new_height), int(new_width)), mode="bilinear")
4848
new_sub_table = new_sub_table.permute(0, 2, 3, 1).reshape(new_num_relative_distance - 3, -1)
4949

5050
new_relative_position_bias_table = torch.cat(

0 commit comments

Comments
 (0)