Fix the issue of mismatch of params for FlashDeformAttnFunction.
This commit is contained in:
@@ -129,12 +129,16 @@ class FlashDeformAttn(nn.Module):
|
|||||||
"Last dim of reference_points must be 2 or 4, but get {} instead.".format(reference_points.shape[-1])
|
"Last dim of reference_points must be 2 or 4, but get {} instead.".format(reference_points.shape[-1])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Cat sampling_offsets and attention_weights, generate sampling_loc_attn:
|
||||||
|
sampling_locations = sampling_locations.flatten(-3).half()
|
||||||
|
attention_weights = attention_weights.flatten(-2)
|
||||||
|
sampling_loc_attn = torch.cat([sampling_locations, attention_weights], dim=-1)
|
||||||
|
|
||||||
output = FlashDeformAttnFunction.apply(
|
output = FlashDeformAttnFunction.apply(
|
||||||
value,
|
value,
|
||||||
input_spatial_shapes,
|
input_spatial_shapes,
|
||||||
input_level_start_index,
|
input_level_start_index,
|
||||||
sampling_locations,
|
sampling_loc_attn,
|
||||||
attention_weights,
|
|
||||||
self.im2col_step,
|
self.im2col_step,
|
||||||
self.n_points
|
self.n_points
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user