executorch 1.1.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- executorch/backends/__init__.py +0 -0
- executorch/backends/aoti/aoti_backend.py +271 -0
- executorch/backends/aoti/aoti_partitioner.py +109 -0
- executorch/backends/aoti/passes/replace_view_copy_with_view.py +118 -0
- executorch/backends/apple/coreml/compiler/__init__.py +9 -0
- executorch/backends/apple/coreml/compiler/coreml_preprocess.py +588 -0
- executorch/backends/apple/coreml/compiler/enumerated_shape_utils.py +244 -0
- executorch/backends/apple/coreml/compiler/torch_ops.py +219 -0
- executorch/backends/apple/coreml/executorchcoreml.pyi +10 -0
- executorch/backends/apple/coreml/logging.py +24 -0
- executorch/backends/apple/coreml/partition/__init__.py +9 -0
- executorch/backends/apple/coreml/partition/coreml_partitioner.py +307 -0
- executorch/backends/apple/coreml/quantizer/__init__.py +9 -0
- executorch/backends/apple/coreml/quantizer/_annotation_config.py +130 -0
- executorch/backends/apple/coreml/quantizer/_coreml_quantizer.py +628 -0
- executorch/backends/apple/coreml/quantizer/_coreml_quantizer_utils.py +800 -0
- executorch/backends/apple/coreml/quantizer/coreml_quantizer.py +7 -0
- executorch/backends/apple/coreml/recipes/__init__.py +17 -0
- executorch/backends/apple/coreml/recipes/coreml_recipe_provider.py +413 -0
- executorch/backends/apple/coreml/recipes/coreml_recipe_types.py +53 -0
- executorch/backends/apple/coreml/runtime/test/export_stateful_model.py +77 -0
- executorch/backends/apple/coreml/test/test_coreml_partitioner.py +348 -0
- executorch/backends/apple/coreml/test/test_coreml_quantizer.py +172 -0
- executorch/backends/apple/coreml/test/test_coreml_recipes.py +552 -0
- executorch/backends/apple/coreml/test/test_coreml_utils.py +19 -0
- executorch/backends/apple/coreml/test/test_enumerated_shapes.py +112 -0
- executorch/backends/apple/coreml/test/test_torch_ops.py +333 -0
- executorch/backends/apple/coreml/test/tester.py +121 -0
- executorch/backends/apple/metal/metal_backend.py +67 -0
- executorch/backends/apple/metal/metal_partitioner.py +25 -0
- executorch/backends/apple/metal/tests/__init__.py +5 -0
- executorch/backends/apple/metal/tests/test_metal_backend.py +79 -0
- executorch/backends/apple/metal/tests/test_metal_partitioner.py +172 -0
- executorch/backends/apple/mps/__init__.py +10 -0
- executorch/backends/apple/mps/mps_preprocess.py +301 -0
- executorch/backends/apple/mps/operators/__init__.py +77 -0
- executorch/backends/apple/mps/operators/activation_ops.py +99 -0
- executorch/backends/apple/mps/operators/binary_ops.py +156 -0
- executorch/backends/apple/mps/operators/clamp_ops.py +60 -0
- executorch/backends/apple/mps/operators/constant_ops.py +128 -0
- executorch/backends/apple/mps/operators/convolution_ops.py +70 -0
- executorch/backends/apple/mps/operators/indexing_ops.py +225 -0
- executorch/backends/apple/mps/operators/linear_algebra_ops.py +52 -0
- executorch/backends/apple/mps/operators/node_visitor.py +473 -0
- executorch/backends/apple/mps/operators/normalization_ops.py +97 -0
- executorch/backends/apple/mps/operators/op_clone.py +54 -0
- executorch/backends/apple/mps/operators/op_getitem.py +29 -0
- executorch/backends/apple/mps/operators/op_quant_dequant.py +142 -0
- executorch/backends/apple/mps/operators/op_skip_ops.py +24 -0
- executorch/backends/apple/mps/operators/pad_ops.py +37 -0
- executorch/backends/apple/mps/operators/pooling_ops.py +142 -0
- executorch/backends/apple/mps/operators/range_ops.py +53 -0
- executorch/backends/apple/mps/operators/reduce_ops.py +39 -0
- executorch/backends/apple/mps/operators/shape_ops.py +263 -0
- executorch/backends/apple/mps/operators/unary_ops.py +130 -0
- executorch/backends/apple/mps/partition/__init__.py +10 -0
- executorch/backends/apple/mps/partition/mps_partitioner.py +133 -0
- executorch/backends/apple/mps/serialization/mps_graph_schema.py +817 -0
- executorch/backends/apple/mps/serialization/mps_graph_serialize.py +34 -0
- executorch/backends/apple/mps/serialization/schema.fbs +523 -0
- executorch/backends/apple/mps/test/test_mps.py +2507 -0
- executorch/backends/apple/mps/test/test_mps_binary_ops.py +296 -0
- executorch/backends/apple/mps/test/test_mps_indexing_ops.py +264 -0
- executorch/backends/apple/mps/test/test_mps_linear.py +523 -0
- executorch/backends/apple/mps/test/test_mps_models.py +416 -0
- executorch/backends/apple/mps/test/test_mps_unary_ops.py +26 -0
- executorch/backends/apple/mps/test/test_mps_utils.py +326 -0
- executorch/backends/apple/mps/utils/mps_utils.py +82 -0
- executorch/backends/apple/mps/utils/quant_utils.py +41 -0
- executorch/backends/arm/_passes/__init__.py +134 -0
- executorch/backends/arm/_passes/_debug_passes.py +58 -0
- executorch/backends/arm/_passes/annotate_decomposed_matmul.py +127 -0
- executorch/backends/arm/_passes/annotate_output_dim_order_pass.py +26 -0
- executorch/backends/arm/_passes/arm_pass.py +95 -0
- executorch/backends/arm/_passes/arm_pass_manager.py +462 -0
- executorch/backends/arm/_passes/arm_pass_utils.py +281 -0
- executorch/backends/arm/_passes/broadcast_args_pass.py +72 -0
- executorch/backends/arm/_passes/cast_int64_pass.py +70 -0
- executorch/backends/arm/_passes/cast_to_int32_pass.py +67 -0
- executorch/backends/arm/_passes/conv1d_unsqueeze_pass.py +98 -0
- executorch/backends/arm/_passes/convert_elu_params.py +67 -0
- executorch/backends/arm/_passes/convert_expand_copy_to_repeat.py +77 -0
- executorch/backends/arm/_passes/convert_full_like_to_full_pass.py +42 -0
- executorch/backends/arm/_passes/convert_int64_const_ops_to_int32.py +81 -0
- executorch/backends/arm/_passes/convert_int64_output_ops_to_int32.py +155 -0
- executorch/backends/arm/_passes/convert_minmax_pass.py +166 -0
- executorch/backends/arm/_passes/convert_permute_singleton_to_view_pass.py +64 -0
- executorch/backends/arm/_passes/convert_split_to_slice.py +132 -0
- executorch/backends/arm/_passes/convert_squeezes_to_view.py +36 -0
- executorch/backends/arm/_passes/convert_to_clamp_pass.py +45 -0
- executorch/backends/arm/_passes/decompose_acosh_pass.py +77 -0
- executorch/backends/arm/_passes/decompose_adaptive_avg_pool2d_pass.py +112 -0
- executorch/backends/arm/_passes/decompose_add_sub_alpha_pass.py +98 -0
- executorch/backends/arm/_passes/decompose_addmm_pass.py +72 -0
- executorch/backends/arm/_passes/decompose_any_pass.py +114 -0
- executorch/backends/arm/_passes/decompose_asin_and_acos_pass.py +236 -0
- executorch/backends/arm/_passes/decompose_asinh_pass.py +74 -0
- executorch/backends/arm/_passes/decompose_atan_pass.py +142 -0
- executorch/backends/arm/_passes/decompose_atanh_pass.py +86 -0
- executorch/backends/arm/_passes/decompose_avg_pool2d_pass.py +154 -0
- executorch/backends/arm/_passes/decompose_batch_norm_no_stats.py +233 -0
- executorch/backends/arm/_passes/decompose_cosh_pass.py +72 -0
- executorch/backends/arm/_passes/decompose_cosine_similarity_pass.py +92 -0
- executorch/backends/arm/_passes/decompose_cumsum_pass.py +167 -0
- executorch/backends/arm/_passes/decompose_div_pass.py +61 -0
- executorch/backends/arm/_passes/decompose_div_tensor_mode.py +94 -0
- executorch/backends/arm/_passes/decompose_elu_pass.py +107 -0
- executorch/backends/arm/_passes/decompose_embedding_pass.py +126 -0
- executorch/backends/arm/_passes/decompose_expm1_pass.py +163 -0
- executorch/backends/arm/_passes/decompose_floor_divide_pass.py +75 -0
- executorch/backends/arm/_passes/decompose_gelu_pass.py +172 -0
- executorch/backends/arm/_passes/decompose_glu_pass.py +81 -0
- executorch/backends/arm/_passes/decompose_grouped_conv_pass.py +185 -0
- executorch/backends/arm/_passes/decompose_groupnorm_pass.py +227 -0
- executorch/backends/arm/_passes/decompose_int16_activation_conv_pass.py +137 -0
- executorch/backends/arm/_passes/decompose_int_pow_pass.py +64 -0
- executorch/backends/arm/_passes/decompose_layernorm_pass.py +203 -0
- executorch/backends/arm/_passes/decompose_leaky_relu_pass.py +76 -0
- executorch/backends/arm/_passes/decompose_linalg_vector_norm_pass.py +92 -0
- executorch/backends/arm/_passes/decompose_linear_pass.py +109 -0
- executorch/backends/arm/_passes/decompose_log1p_pass.py +97 -0
- executorch/backends/arm/_passes/decompose_logit_pass.py +119 -0
- executorch/backends/arm/_passes/decompose_masked_fill_pass.py +58 -0
- executorch/backends/arm/_passes/decompose_maxpool2d_with_dilation_pass.py +218 -0
- executorch/backends/arm/_passes/decompose_meandim_pass.py +283 -0
- executorch/backends/arm/_passes/decompose_ne_pass.py +74 -0
- executorch/backends/arm/_passes/decompose_quant_nodes.py +156 -0
- executorch/backends/arm/_passes/decompose_remainder_pass.py +70 -0
- executorch/backends/arm/_passes/decompose_round_pass.py +96 -0
- executorch/backends/arm/_passes/decompose_sdpa_pass.py +36 -0
- executorch/backends/arm/_passes/decompose_select.py +75 -0
- executorch/backends/arm/_passes/decompose_select_scatter_pass.py +143 -0
- executorch/backends/arm/_passes/decompose_sign_pass.py +78 -0
- executorch/backends/arm/_passes/decompose_silu_pass.py +41 -0
- executorch/backends/arm/_passes/decompose_sinh_pass.py +77 -0
- executorch/backends/arm/_passes/decompose_softmax_pass.py +93 -0
- executorch/backends/arm/_passes/decompose_softmax_unstable_pass.py +86 -0
- executorch/backends/arm/_passes/decompose_sqrt_pass.py +53 -0
- executorch/backends/arm/_passes/decompose_sum_pass.py +93 -0
- executorch/backends/arm/_passes/decompose_tan_pass.py +51 -0
- executorch/backends/arm/_passes/decompose_tosa_unsupported_clamp_pass.py +97 -0
- executorch/backends/arm/_passes/decompose_var_pass.py +109 -0
- executorch/backends/arm/_passes/decorate_fp32_to_int32_casting_pass.py +88 -0
- executorch/backends/arm/_passes/fold_qdq_with_annotated_qparams_pass.py +394 -0
- executorch/backends/arm/_passes/fuse_batch_norm2d_pass.py +241 -0
- executorch/backends/arm/_passes/fuse_constant_ops_pass.py +272 -0
- executorch/backends/arm/_passes/fuse_duplicate_users_pass.py +165 -0
- executorch/backends/arm/_passes/fuse_equal_placeholders_pass.py +104 -0
- executorch/backends/arm/_passes/fuse_quantized_activation_pass.py +80 -0
- executorch/backends/arm/_passes/fuse_view_copy_transform_pass.py +14 -0
- executorch/backends/arm/_passes/insert_int32_casts_after_int64_placeholders.py +130 -0
- executorch/backends/arm/_passes/insert_rescales_pass.py +584 -0
- executorch/backends/arm/_passes/insert_table_ops.py +305 -0
- executorch/backends/arm/_passes/match_arg_dtype_pass.py +104 -0
- executorch/backends/arm/_passes/match_arg_ranks_pass.py +114 -0
- executorch/backends/arm/_passes/mm_to_bmm_pass.py +104 -0
- executorch/backends/arm/_passes/normalize_while_initial_args_pass.py +113 -0
- executorch/backends/arm/_passes/promote_bool_operands_pass.py +88 -0
- executorch/backends/arm/_passes/quant_args.py +125 -0
- executorch/backends/arm/_passes/remove_getitem_pass.py +14 -0
- executorch/backends/arm/_passes/remove_graph_asserts_pass.py +18 -0
- executorch/backends/arm/_passes/remove_noop_pass.py +40 -0
- executorch/backends/arm/_passes/replace_inf_and_limit_values_pass.py +73 -0
- executorch/backends/arm/_passes/replace_scalar_with_tensor_pass.py +121 -0
- executorch/backends/arm/_passes/rewrite_bool_bitwise_not_to_logical_not_pass.py +43 -0
- executorch/backends/arm/_passes/rewrite_bool_to_fp32_cast_via_int8_pass.py +77 -0
- executorch/backends/arm/_passes/rewrite_conv_pass.py +336 -0
- executorch/backends/arm/_passes/rewrite_matmul.py +98 -0
- executorch/backends/arm/_passes/rewrite_upsample.py +93 -0
- executorch/backends/arm/_passes/scalars_to_attribute_pass.py +97 -0
- executorch/backends/arm/_passes/size_adjust_input_pass.py +227 -0
- executorch/backends/arm/_passes/to_tosa_memory_format_pass.py +454 -0
- executorch/backends/arm/_passes/unsqueeze_before_repeat_pass.py +66 -0
- executorch/backends/arm/_passes/unsqueeze_scalar_placeholders_pass.py +85 -0
- executorch/backends/arm/arm_vela.py +137 -0
- executorch/backends/arm/common/__init__.py +4 -0
- executorch/backends/arm/common/annotation_meta.py +39 -0
- executorch/backends/arm/common/arm_compile_spec.py +271 -0
- executorch/backends/arm/common/debug.py +79 -0
- executorch/backends/arm/common/pipeline_config.py +59 -0
- executorch/backends/arm/common/type.py +28 -0
- executorch/backends/arm/constants.py +48 -0
- executorch/backends/arm/debug/__init__.py +4 -0
- executorch/backends/arm/debug/schema.py +145 -0
- executorch/backends/arm/ethosu/__init__.py +11 -0
- executorch/backends/arm/ethosu/backend.py +115 -0
- executorch/backends/arm/ethosu/compile_spec.py +117 -0
- executorch/backends/arm/ethosu/partitioner.py +35 -0
- executorch/backends/arm/operator_support/__init__.py +23 -0
- executorch/backends/arm/operator_support/clone_dim_order_support.py +82 -0
- executorch/backends/arm/operator_support/control_flow_support.py +162 -0
- executorch/backends/arm/operator_support/convolution_support.py +160 -0
- executorch/backends/arm/operator_support/embedding_support.py +61 -0
- executorch/backends/arm/operator_support/ethos_u55_support.py +598 -0
- executorch/backends/arm/operator_support/index_select_support.py +60 -0
- executorch/backends/arm/operator_support/index_tensor_support.py +160 -0
- executorch/backends/arm/operator_support/minmax_support.py +61 -0
- executorch/backends/arm/operator_support/pool_2d_support.py +214 -0
- executorch/backends/arm/operator_support/reduce_sum_support.py +76 -0
- executorch/backends/arm/operator_support/right_shift_support.py +52 -0
- executorch/backends/arm/operator_support/slice_copy_support.py +48 -0
- executorch/backends/arm/operator_support/to_dim_order_copy_support.py +200 -0
- executorch/backends/arm/operator_support/tosa_profile_supported_op_lists.py +251 -0
- executorch/backends/arm/operator_support/tosa_supported_operators.py +748 -0
- executorch/backends/arm/operator_support/where_support.py +77 -0
- executorch/backends/arm/operators/__init__.py +71 -0
- executorch/backends/arm/operators/node_visitor.py +177 -0
- executorch/backends/arm/operators/op_abs.py +59 -0
- executorch/backends/arm/operators/op_add.py +60 -0
- executorch/backends/arm/operators/op_amax.py +72 -0
- executorch/backends/arm/operators/op_amin.py +73 -0
- executorch/backends/arm/operators/op_any.py +61 -0
- executorch/backends/arm/operators/op_avg_pool2d.py +142 -0
- executorch/backends/arm/operators/op_bitwise_not.py +62 -0
- executorch/backends/arm/operators/op_cat.py +68 -0
- executorch/backends/arm/operators/op_ceil.py +56 -0
- executorch/backends/arm/operators/op_clamp.py +118 -0
- executorch/backends/arm/operators/op_cond_if.py +56 -0
- executorch/backends/arm/operators/op_constant_pad_nd.py +117 -0
- executorch/backends/arm/operators/op_cos.py +49 -0
- executorch/backends/arm/operators/op_eq.py +64 -0
- executorch/backends/arm/operators/op_erf.py +54 -0
- executorch/backends/arm/operators/op_exp.py +54 -0
- executorch/backends/arm/operators/op_floor.py +56 -0
- executorch/backends/arm/operators/op_ge.py +64 -0
- executorch/backends/arm/operators/op_gt.py +64 -0
- executorch/backends/arm/operators/op_index_select.py +109 -0
- executorch/backends/arm/operators/op_index_tensor.py +247 -0
- executorch/backends/arm/operators/op_le.py +64 -0
- executorch/backends/arm/operators/op_log.py +50 -0
- executorch/backends/arm/operators/op_logical_not.py +62 -0
- executorch/backends/arm/operators/op_lt.py +64 -0
- executorch/backends/arm/operators/op_max_pool2d.py +108 -0
- executorch/backends/arm/operators/op_maximum.py +66 -0
- executorch/backends/arm/operators/op_minimum.py +67 -0
- executorch/backends/arm/operators/op_mul.py +61 -0
- executorch/backends/arm/operators/op_neg.py +92 -0
- executorch/backends/arm/operators/op_permute.py +150 -0
- executorch/backends/arm/operators/op_pow.py +63 -0
- executorch/backends/arm/operators/op_reciprocal.py +51 -0
- executorch/backends/arm/operators/op_repeat.py +77 -0
- executorch/backends/arm/operators/op_rshift_tensor.py +62 -0
- executorch/backends/arm/operators/op_rsqrt.py +51 -0
- executorch/backends/arm/operators/op_sigmoid.py +50 -0
- executorch/backends/arm/operators/op_sin.py +49 -0
- executorch/backends/arm/operators/op_slice.py +151 -0
- executorch/backends/arm/operators/op_sub.py +63 -0
- executorch/backends/arm/operators/op_sum.py +64 -0
- executorch/backends/arm/operators/op_tanh.py +51 -0
- executorch/backends/arm/operators/op_to_dim_order_copy.py +49 -0
- executorch/backends/arm/operators/op_tosa_conv2d.py +139 -0
- executorch/backends/arm/operators/op_tosa_conv3d.py +24 -0
- executorch/backends/arm/operators/op_tosa_depthwise_conv2d.py +32 -0
- executorch/backends/arm/operators/op_tosa_matmul.py +102 -0
- executorch/backends/arm/operators/op_tosa_rescale.py +261 -0
- executorch/backends/arm/operators/op_tosa_resize.py +124 -0
- executorch/backends/arm/operators/op_tosa_table.py +72 -0
- executorch/backends/arm/operators/op_tosa_transpose.py +71 -0
- executorch/backends/arm/operators/op_view.py +81 -0
- executorch/backends/arm/operators/op_where.py +75 -0
- executorch/backends/arm/operators/op_while.py +103 -0
- executorch/backends/arm/operators/operator_validation_utils.py +201 -0
- executorch/backends/arm/operators/ops_binary.py +112 -0
- executorch/backends/arm/operators/ops_identity.py +80 -0
- executorch/backends/arm/process_node.py +230 -0
- executorch/backends/arm/quantizer/__init__.py +35 -0
- executorch/backends/arm/quantizer/arm_quantizer.py +710 -0
- executorch/backends/arm/quantizer/arm_quantizer_utils.py +76 -0
- executorch/backends/arm/quantizer/quantization_annotator.py +815 -0
- executorch/backends/arm/quantizer/quantization_config.py +228 -0
- executorch/backends/arm/scripts/collect_testname_resources.py +194 -0
- executorch/backends/arm/scripts/parse_test_names.py +271 -0
- executorch/backends/arm/test/common.py +302 -0
- executorch/backends/arm/test/conftest.py +134 -0
- executorch/backends/arm/test/misc/test_bn_relu_folding_qat.py +124 -0
- executorch/backends/arm/test/misc/test_call_operator_submodule.py +72 -0
- executorch/backends/arm/test/misc/test_compile_spec.py +55 -0
- executorch/backends/arm/test/misc/test_conv_relu_residual_add.py +108 -0
- executorch/backends/arm/test/misc/test_custom_partition.py +183 -0
- executorch/backends/arm/test/misc/test_debug_feats.py +316 -0
- executorch/backends/arm/test/misc/test_debug_hook.py +186 -0
- executorch/backends/arm/test/misc/test_dim_order.py +127 -0
- executorch/backends/arm/test/misc/test_dw_convs_with_shared_weights.py +46 -0
- executorch/backends/arm/test/misc/test_extract_io_params_tosa.py +92 -0
- executorch/backends/arm/test/misc/test_int64.py +112 -0
- executorch/backends/arm/test/misc/test_lifted_tensor.py +146 -0
- executorch/backends/arm/test/misc/test_mixed_type_lowering.py +83 -0
- executorch/backends/arm/test/misc/test_model_evaluator.py +58 -0
- executorch/backends/arm/test/misc/test_multiple_delegates.py +53 -0
- executorch/backends/arm/test/misc/test_multiple_outputs.py +70 -0
- executorch/backends/arm/test/misc/test_non_persistent_buffers.py +49 -0
- executorch/backends/arm/test/misc/test_outputs_order.py +122 -0
- executorch/backends/arm/test/misc/test_partition_decomposed_quantized_ops.py +181 -0
- executorch/backends/arm/test/misc/test_pass_pipeline_config.py +35 -0
- executorch/backends/arm/test/misc/test_pass_required_order.py +97 -0
- executorch/backends/arm/test/misc/test_qat_training_loop.py +100 -0
- executorch/backends/arm/test/misc/test_quant_custom_meta.py +105 -0
- executorch/backends/arm/test/misc/test_rescale_range.py +130 -0
- executorch/backends/arm/test/misc/test_save_exported_model.py +64 -0
- executorch/backends/arm/test/misc/test_tosa_dialect_conv2d.py +220 -0
- executorch/backends/arm/test/misc/test_tosa_dialect_dw_conv2d.py +227 -0
- executorch/backends/arm/test/misc/test_tosa_spec.py +169 -0
- executorch/backends/arm/test/models/stable_diffusion/stable_diffusion_module_test_configs.py +114 -0
- executorch/backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py +168 -0
- executorch/backends/arm/test/models/stable_diffusion/test_SD3Transformer2DModel.py +193 -0
- executorch/backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py +161 -0
- executorch/backends/arm/test/models/stable_diffusion/test_vae_AutoencoderKL.py +118 -0
- executorch/backends/arm/test/models/test_conformer.py +138 -0
- executorch/backends/arm/test/models/test_deit_tiny_arm.py +120 -0
- executorch/backends/arm/test/models/test_dl3_arm.py +118 -0
- executorch/backends/arm/test/models/test_inception_v3_arm.py +120 -0
- executorch/backends/arm/test/models/test_llama.py +227 -0
- executorch/backends/arm/test/models/test_lstm_arm.py +194 -0
- executorch/backends/arm/test/models/test_mobilenet_v2_arm.py +179 -0
- executorch/backends/arm/test/models/test_mobilenet_v3_arm.py +113 -0
- executorch/backends/arm/test/models/test_nn_functional.py +124 -0
- executorch/backends/arm/test/models/test_nn_modules.py +161 -0
- executorch/backends/arm/test/models/test_nss.py +146 -0
- executorch/backends/arm/test/models/test_resnet18.py +98 -0
- executorch/backends/arm/test/models/test_torch_functions.py +151 -0
- executorch/backends/arm/test/models/test_w2l_arm.py +136 -0
- executorch/backends/arm/test/ops/test_abs.py +101 -0
- executorch/backends/arm/test/ops/test_acos.py +121 -0
- executorch/backends/arm/test/ops/test_acosh.py +137 -0
- executorch/backends/arm/test/ops/test_adaptive_avg_pool2d.py +242 -0
- executorch/backends/arm/test/ops/test_add.py +291 -0
- executorch/backends/arm/test/ops/test_addmm.py +285 -0
- executorch/backends/arm/test/ops/test_alias_copy.py +114 -0
- executorch/backends/arm/test/ops/test_amax.py +191 -0
- executorch/backends/arm/test/ops/test_amin.py +205 -0
- executorch/backends/arm/test/ops/test_any.py +210 -0
- executorch/backends/arm/test/ops/test_arange.py +258 -0
- executorch/backends/arm/test/ops/test_asin.py +105 -0
- executorch/backends/arm/test/ops/test_asinh.py +104 -0
- executorch/backends/arm/test/ops/test_at.py +256 -0
- executorch/backends/arm/test/ops/test_atan.py +111 -0
- executorch/backends/arm/test/ops/test_atanh.py +112 -0
- executorch/backends/arm/test/ops/test_avg_pool2d.py +295 -0
- executorch/backends/arm/test/ops/test_batch_norm.py +385 -0
- executorch/backends/arm/test/ops/test_bitwise.py +672 -0
- executorch/backends/arm/test/ops/test_bitwise_not.py +115 -0
- executorch/backends/arm/test/ops/test_bmm.py +193 -0
- executorch/backends/arm/test/ops/test_cat.py +219 -0
- executorch/backends/arm/test/ops/test_ceil.py +125 -0
- executorch/backends/arm/test/ops/test_clamp.py +474 -0
- executorch/backends/arm/test/ops/test_clone.py +150 -0
- executorch/backends/arm/test/ops/test_cond.py +338 -0
- executorch/backends/arm/test/ops/test_constant_pad_nd.py +119 -0
- executorch/backends/arm/test/ops/test_conv1d.py +356 -0
- executorch/backends/arm/test/ops/test_conv2d.py +592 -0
- executorch/backends/arm/test/ops/test_conv3d.py +711 -0
- executorch/backends/arm/test/ops/test_conv_combos.py +668 -0
- executorch/backends/arm/test/ops/test_conv_constant_pad_nd.py +145 -0
- executorch/backends/arm/test/ops/test_copy.py +171 -0
- executorch/backends/arm/test/ops/test_cos.py +115 -0
- executorch/backends/arm/test/ops/test_cosh.py +111 -0
- executorch/backends/arm/test/ops/test_cumsum.py +122 -0
- executorch/backends/arm/test/ops/test_depthwise_conv.py +404 -0
- executorch/backends/arm/test/ops/test_div.py +151 -0
- executorch/backends/arm/test/ops/test_div_tensor_mode.py +151 -0
- executorch/backends/arm/test/ops/test_elu.py +133 -0
- executorch/backends/arm/test/ops/test_embedding.py +146 -0
- executorch/backends/arm/test/ops/test_eq.py +286 -0
- executorch/backends/arm/test/ops/test_erf.py +96 -0
- executorch/backends/arm/test/ops/test_exp.py +110 -0
- executorch/backends/arm/test/ops/test_expand.py +153 -0
- executorch/backends/arm/test/ops/test_expm1.py +113 -0
- executorch/backends/arm/test/ops/test_eye.py +156 -0
- executorch/backends/arm/test/ops/test_fill_scalar.py +108 -0
- executorch/backends/arm/test/ops/test_floor.py +125 -0
- executorch/backends/arm/test/ops/test_floor_div.py +156 -0
- executorch/backends/arm/test/ops/test_full.py +255 -0
- executorch/backends/arm/test/ops/test_ge.py +292 -0
- executorch/backends/arm/test/ops/test_gelu.py +156 -0
- executorch/backends/arm/test/ops/test_glu.py +130 -0
- executorch/backends/arm/test/ops/test_group_norm.py +200 -0
- executorch/backends/arm/test/ops/test_gt.py +293 -0
- executorch/backends/arm/test/ops/test_hardsigmoid.py +114 -0
- executorch/backends/arm/test/ops/test_hardswish.py +104 -0
- executorch/backends/arm/test/ops/test_hardtanh.py +113 -0
- executorch/backends/arm/test/ops/test_index_select.py +177 -0
- executorch/backends/arm/test/ops/test_index_tensor.py +467 -0
- executorch/backends/arm/test/ops/test_layer_norm.py +186 -0
- executorch/backends/arm/test/ops/test_le.py +296 -0
- executorch/backends/arm/test/ops/test_leaky_relu.py +125 -0
- executorch/backends/arm/test/ops/test_linalg_vector_norm.py +160 -0
- executorch/backends/arm/test/ops/test_linear.py +389 -0
- executorch/backends/arm/test/ops/test_log.py +100 -0
- executorch/backends/arm/test/ops/test_log1p.py +78 -0
- executorch/backends/arm/test/ops/test_logical.py +429 -0
- executorch/backends/arm/test/ops/test_logit.py +119 -0
- executorch/backends/arm/test/ops/test_logsoftmax.py +124 -0
- executorch/backends/arm/test/ops/test_lshift.py +220 -0
- executorch/backends/arm/test/ops/test_lt.py +293 -0
- executorch/backends/arm/test/ops/test_masked_fill.py +171 -0
- executorch/backends/arm/test/ops/test_matmul.py +289 -0
- executorch/backends/arm/test/ops/test_max_pool.py +329 -0
- executorch/backends/arm/test/ops/test_maximum.py +98 -0
- executorch/backends/arm/test/ops/test_mean_dim.py +388 -0
- executorch/backends/arm/test/ops/test_minimum.py +98 -0
- executorch/backends/arm/test/ops/test_mm.py +93 -0
- executorch/backends/arm/test/ops/test_mul.py +376 -0
- executorch/backends/arm/test/ops/test_multihead_attention.py +138 -0
- executorch/backends/arm/test/ops/test_ne.py +243 -0
- executorch/backends/arm/test/ops/test_neg.py +99 -0
- executorch/backends/arm/test/ops/test_ones.py +152 -0
- executorch/backends/arm/test/ops/test_permute.py +256 -0
- executorch/backends/arm/test/ops/test_pixel_shuffling.py +237 -0
- executorch/backends/arm/test/ops/test_pow.py +204 -0
- executorch/backends/arm/test/ops/test_reciprocal.py +112 -0
- executorch/backends/arm/test/ops/test_relu.py +166 -0
- executorch/backends/arm/test/ops/test_remainder.py +199 -0
- executorch/backends/arm/test/ops/test_repeat.py +162 -0
- executorch/backends/arm/test/ops/test_round.py +111 -0
- executorch/backends/arm/test/ops/test_rshift.py +226 -0
- executorch/backends/arm/test/ops/test_rsqrt.py +153 -0
- executorch/backends/arm/test/ops/test_rsub.py +126 -0
- executorch/backends/arm/test/ops/test_scalar_tensor.py +135 -0
- executorch/backends/arm/test/ops/test_scalars.py +438 -0
- executorch/backends/arm/test/ops/test_sdpa.py +73 -0
- executorch/backends/arm/test/ops/test_select.py +219 -0
- executorch/backends/arm/test/ops/test_select_scatter.py +173 -0
- executorch/backends/arm/test/ops/test_sigmoid.py +357 -0
- executorch/backends/arm/test/ops/test_sigmoid_32bit.py +177 -0
- executorch/backends/arm/test/ops/test_sign.py +113 -0
- executorch/backends/arm/test/ops/test_silu.py +174 -0
- executorch/backends/arm/test/ops/test_sin.py +108 -0
- executorch/backends/arm/test/ops/test_sinh.py +103 -0
- executorch/backends/arm/test/ops/test_slice.py +217 -0
- executorch/backends/arm/test/ops/test_softmax.py +121 -0
- executorch/backends/arm/test/ops/test_split.py +312 -0
- executorch/backends/arm/test/ops/test_sqrt.py +112 -0
- executorch/backends/arm/test/ops/test_squeeze.py +291 -0
- executorch/backends/arm/test/ops/test_stack.py +150 -0
- executorch/backends/arm/test/ops/test_sub.py +366 -0
- executorch/backends/arm/test/ops/test_sum.py +161 -0
- executorch/backends/arm/test/ops/test_t_copy.py +115 -0
- executorch/backends/arm/test/ops/test_tan.py +146 -0
- executorch/backends/arm/test/ops/test_tanh.py +169 -0
- executorch/backends/arm/test/ops/test_to_copy.py +296 -0
- executorch/backends/arm/test/ops/test_transpose_copy.py +114 -0
- executorch/backends/arm/test/ops/test_unary_combos.py +144 -0
- executorch/backends/arm/test/ops/test_unbind.py +82 -0
- executorch/backends/arm/test/ops/test_unflatten.py +107 -0
- executorch/backends/arm/test/ops/test_unsqueeze.py +107 -0
- executorch/backends/arm/test/ops/test_upsample_bilinear2d.py +443 -0
- executorch/backends/arm/test/ops/test_upsample_nearest2d.py +520 -0
- executorch/backends/arm/test/ops/test_var.py +394 -0
- executorch/backends/arm/test/ops/test_view.py +253 -0
- executorch/backends/arm/test/ops/test_where.py +285 -0
- executorch/backends/arm/test/ops/test_while.py +264 -0
- executorch/backends/arm/test/ops/test_zeros.py +158 -0
- executorch/backends/arm/test/passes/test_broadcast_args_pass.py +57 -0
- executorch/backends/arm/test/passes/test_cast_int64_pass.py +49 -0
- executorch/backends/arm/test/passes/test_convert_expand_copy_to_repeat.py +51 -0
- executorch/backends/arm/test/passes/test_convert_int64_const_ops_to_int32.py +529 -0
- executorch/backends/arm/test/passes/test_convert_int64_output_ops_to_int32.py +129 -0
- executorch/backends/arm/test/passes/test_convert_permute_singleton_to_view_pass.py +100 -0
- executorch/backends/arm/test/passes/test_convert_split_to_slice.py +75 -0
- executorch/backends/arm/test/passes/test_convert_to_clamp.py +92 -0
- executorch/backends/arm/test/passes/test_decompose_avg_pool2d_pass.py +82 -0
- executorch/backends/arm/test/passes/test_decompose_cosine_similarity_pass.py +58 -0
- executorch/backends/arm/test/passes/test_decompose_div_pass.py +70 -0
- executorch/backends/arm/test/passes/test_decompose_int_pow_pass.py +80 -0
- executorch/backends/arm/test/passes/test_decompose_layernorm_pass.py +69 -0
- executorch/backends/arm/test/passes/test_decompose_linalg_vector_norm_pass.py +107 -0
- executorch/backends/arm/test/passes/test_decompose_meandim_pass.py +137 -0
- executorch/backends/arm/test/passes/test_decompose_quant_nodes.py +44 -0
- executorch/backends/arm/test/passes/test_decompose_softmax_pass.py +103 -0
- executorch/backends/arm/test/passes/test_decompose_tosa_unsupported_clamp_pass.py +73 -0
- executorch/backends/arm/test/passes/test_decompose_var_pass.py +89 -0
- executorch/backends/arm/test/passes/test_decorate_fp32_to_int32_casting_pass.py +85 -0
- executorch/backends/arm/test/passes/test_fold_qdq_pass.py +51 -0
- executorch/backends/arm/test/passes/test_fuse_batchnorm_pass.py +164 -0
- executorch/backends/arm/test/passes/test_fuse_constant_ops_pass.py +177 -0
- executorch/backends/arm/test/passes/test_fuse_duplicate_users_pass.py +70 -0
- executorch/backends/arm/test/passes/test_fuse_equal_placeholders_ops_pass.py +170 -0
- executorch/backends/arm/test/passes/test_fuse_view_copy.py +82 -0
- executorch/backends/arm/test/passes/test_insert_int32_casts_after_int64_placeholders_pass.py +114 -0
- executorch/backends/arm/test/passes/test_insert_rescale_i32_pass.py +107 -0
- executorch/backends/arm/test/passes/test_insert_table_ops_pass.py +47 -0
- executorch/backends/arm/test/passes/test_int32_cast_embedding_pass.py +46 -0
- executorch/backends/arm/test/passes/test_ioquantization_pass.py +48 -0
- executorch/backends/arm/test/passes/test_promote_bool_operands_pass.py +103 -0
- executorch/backends/arm/test/passes/test_remove_clone_pass.py +45 -0
- executorch/backends/arm/test/passes/test_replace_inf_values_pass.py +96 -0
- executorch/backends/arm/test/passes/test_rescale_pass.py +81 -0
- executorch/backends/arm/test/passes/test_rewrite_conv_pass.py +20 -0
- executorch/backends/arm/test/passes/test_to_tosa_memory_format.py +213 -0
- executorch/backends/arm/test/passes/test_unsqueeze_before_repeat_pass.py +62 -0
- executorch/backends/arm/test/quantizer/test_conv_relu_fusing.py +118 -0
- executorch/backends/arm/test/quantizer/test_generic_annotater.py +109 -0
- executorch/backends/arm/test/quantizer/test_partial_quantization.py +104 -0
- executorch/backends/arm/test/quantizer/test_selective_quantization.py +212 -0
- executorch/backends/arm/test/quantizer/test_set_module_name.py +158 -0
- executorch/backends/arm/test/quantizer/test_tosa_quantizer_validate.py +55 -0
- executorch/backends/arm/test/runner_utils.py +840 -0
- executorch/backends/arm/test/test_memory_allocator_log.py +170 -0
- executorch/backends/arm/test/test_model.py +345 -0
- executorch/backends/arm/test/tester/__init__.py +6 -0
- executorch/backends/arm/test/tester/analyze_output_utils.py +346 -0
- executorch/backends/arm/test/tester/arm_tester.py +1149 -0
- executorch/backends/arm/test/tester/quantize.py +43 -0
- executorch/backends/arm/test/tester/serialize.py +78 -0
- executorch/backends/arm/test/tester/test_pipeline.py +1190 -0
- executorch/backends/arm/tosa/__init__.py +9 -0
- executorch/backends/arm/tosa/backend.py +443 -0
- executorch/backends/arm/tosa/compile_spec.py +48 -0
- executorch/backends/arm/tosa/dialect/__init__.py +15 -0
- executorch/backends/arm/tosa/dialect/lib.py +85 -0
- executorch/backends/arm/tosa/dialect/ops/conv2d.py +111 -0
- executorch/backends/arm/tosa/dialect/ops/conv3d.py +74 -0
- executorch/backends/arm/tosa/dialect/ops/depthwise_conv2d.py +56 -0
- executorch/backends/arm/tosa/dialect/ops/matmul.py +56 -0
- executorch/backends/arm/tosa/dialect/ops/rescale.py +53 -0
- executorch/backends/arm/tosa/dialect/ops/resize.py +66 -0
- executorch/backends/arm/tosa/dialect/ops/table.py +53 -0
- executorch/backends/arm/tosa/dialect/ops/transpose.py +35 -0
- executorch/backends/arm/tosa/dialect/ops_registration.py +68 -0
- executorch/backends/arm/tosa/mapping.py +309 -0
- executorch/backends/arm/tosa/partitioner.py +486 -0
- executorch/backends/arm/tosa/schemas/__init__.py +4 -0
- executorch/backends/arm/tosa/schemas/tosa_1.0.fbs +559 -0
- executorch/backends/arm/tosa/specification.py +406 -0
- executorch/backends/arm/tosa/utils.py +304 -0
- executorch/backends/arm/util/_factory.py +59 -0
- executorch/backends/arm/util/arm_model_evaluator.py +388 -0
- executorch/backends/arm/vgf/__init__.py +11 -0
- executorch/backends/arm/vgf/backend.py +172 -0
- executorch/backends/arm/vgf/compile_spec.py +73 -0
- executorch/backends/arm/vgf/model_converter.py +34 -0
- executorch/backends/arm/vgf/partitioner.py +35 -0
- executorch/backends/cadence/aot/__init__.py +5 -0
- executorch/backends/cadence/aot/compiler.py +484 -0
- executorch/backends/cadence/aot/compiler_funcs.py +203 -0
- executorch/backends/cadence/aot/compiler_utils.py +293 -0
- executorch/backends/cadence/aot/decompose_ops.py +120 -0
- executorch/backends/cadence/aot/export_example.py +117 -0
- executorch/backends/cadence/aot/functions.yaml +470 -0
- executorch/backends/cadence/aot/functions_fusion_g3.yaml +191 -0
- executorch/backends/cadence/aot/functions_hifi.yaml +565 -0
- executorch/backends/cadence/aot/functions_vision.yaml +275 -0
- executorch/backends/cadence/aot/fuse_ops.py +1138 -0
- executorch/backends/cadence/aot/graph_builder.py +142 -0
- executorch/backends/cadence/aot/memory_constraints.py +731 -0
- executorch/backends/cadence/aot/memory_planning.py +469 -0
- executorch/backends/cadence/aot/memory_planning_algo.py +341 -0
- executorch/backends/cadence/aot/ops_registrations.py +2841 -0
- executorch/backends/cadence/aot/pass_utils.py +274 -0
- executorch/backends/cadence/aot/passes.py +132 -0
- executorch/backends/cadence/aot/program_builder.py +138 -0
- executorch/backends/cadence/aot/quantizer/fusion_pass.py +743 -0
- executorch/backends/cadence/aot/quantizer/patterns.py +738 -0
- executorch/backends/cadence/aot/quantizer/quantizer.py +409 -0
- executorch/backends/cadence/aot/quantizer/utils.py +288 -0
- executorch/backends/cadence/aot/ref_implementations.py +2210 -0
- executorch/backends/cadence/aot/remove_ops.py +936 -0
- executorch/backends/cadence/aot/reorder_ops.py +843 -0
- executorch/backends/cadence/aot/replace_ops.py +2526 -0
- executorch/backends/cadence/aot/simplify_ops.py +221 -0
- executorch/backends/cadence/aot/tests/test_decompose_ops_passes.py +80 -0
- executorch/backends/cadence/aot/tests/test_fusion_ops_passes.py +1023 -0
- executorch/backends/cadence/aot/tests/test_graph_builder.py +104 -0
- executorch/backends/cadence/aot/tests/test_idma_ops.py +31 -0
- executorch/backends/cadence/aot/tests/test_memory_passes.py +1367 -0
- executorch/backends/cadence/aot/tests/test_pass_filter.py +167 -0
- executorch/backends/cadence/aot/tests/test_program_builder.py +222 -0
- executorch/backends/cadence/aot/tests/test_quantizer_ops.py +649 -0
- executorch/backends/cadence/aot/tests/test_ref_implementations.py +3151 -0
- executorch/backends/cadence/aot/tests/test_remove_ops_passes.py +977 -0
- executorch/backends/cadence/aot/tests/test_reorder_ops_passes.py +635 -0
- executorch/backends/cadence/aot/tests/test_replace_ops_passes.py +2777 -0
- executorch/backends/cadence/aot/tests/test_simplify_ops_passes.py +160 -0
- executorch/backends/cadence/aot/tests/test_type_dispatch_passes.py +481 -0
- executorch/backends/cadence/aot/type_dispatch.py +190 -0
- executorch/backends/cadence/aot/typing_stubs.py +22 -0
- executorch/backends/cadence/aot/utils.py +363 -0
- executorch/backends/cadence/runtime/__init__.py +13 -0
- executorch/backends/cadence/runtime/etdump.py +173 -0
- executorch/backends/cadence/runtime/executor.py +202 -0
- executorch/backends/cadence/runtime/runtime.py +156 -0
- executorch/backends/cadence/runtime/utils.py +100 -0
- executorch/backends/cadence/utils/FACTO/calibrator/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/calibrator/runner.py +190 -0
- executorch/backends/cadence/utils/FACTO/examples/example.py +59 -0
- executorch/backends/cadence/utils/FACTO/examples/minimal_example.py +21 -0
- executorch/backends/cadence/utils/FACTO/examples/random_seed.py +35 -0
- executorch/backends/cadence/utils/FACTO/facto/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argtuple/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argtuple/engine.py +129 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argtuple/gen.py +47 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/engine.py +291 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/gen.py +139 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/type.py +134 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/engine.py +54 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/model.py +133 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/solve.py +125 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/specs/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/specs/model.py +149 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/utils/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/utils/random_manager.py +33 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/constants.py +9 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/gen.py +283 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/solve.py +142 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/space.py +450 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/type.py +105 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/utils.py +30 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/db.py +4361 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/default.py +36 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/dtypes.py +25 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/function.py +537 -0
- executorch/backends/cadence/utils/FACTO/setup.py +19 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argtuple_engine.py +53 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argtuple_generator.py +58 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argument_attributes.py +78 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argument_generator.py +98 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argument_types.py +28 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_attribute_engine.py +62 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_attribute_solver.py +83 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_constraints.py +27 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_meta_arg_engine.py +70 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_specs.py +48 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_structural_engine.py +32 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_generation.py +80 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_solving.py +193 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_space.py +231 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_types.py +71 -0
- executorch/backends/cadence/utils/facto_util.py +611 -0
- executorch/backends/cadence/utils/gen_header.py +49 -0
- executorch/backends/cadence/utils/post_compilation.py +173 -0
- executorch/backends/cortex_m/ops/operators.py +890 -0
- executorch/backends/cortex_m/ops/operators.yaml +78 -0
- executorch/backends/cortex_m/passes/__init__.py +12 -0
- executorch/backends/cortex_m/passes/activation_fusion_pass.py +181 -0
- executorch/backends/cortex_m/passes/clamp_hardswish_pass.py +37 -0
- executorch/backends/cortex_m/passes/convert_to_cortex_m_pass.py +318 -0
- executorch/backends/cortex_m/passes/cortex_m_pass_manager.py +73 -0
- executorch/backends/cortex_m/passes/decompose_hardswish_pass.py +127 -0
- executorch/backends/cortex_m/passes/passes_utils.py +226 -0
- executorch/backends/cortex_m/passes/quantized_op_fusion_pass.py +255 -0
- executorch/backends/cortex_m/passes/replace_quant_nodes_pass.py +67 -0
- executorch/backends/cortex_m/quantizer/__init__.py +18 -0
- executorch/backends/cortex_m/quantizer/operator_configs.py +74 -0
- executorch/backends/cortex_m/quantizer/quantization_configs.py +121 -0
- executorch/backends/cortex_m/quantizer/quantizer.py +500 -0
- executorch/backends/cortex_m/test/misc/test_quantization.py +359 -0
- executorch/backends/cortex_m/test/models/__init__.py +4 -0
- executorch/backends/cortex_m/test/models/test_mobilenet_v3.py +74 -0
- executorch/backends/cortex_m/test/ops/__init__.py +4 -0
- executorch/backends/cortex_m/test/ops/test_activation.py +528 -0
- executorch/backends/cortex_m/test/ops/test_add.py +182 -0
- executorch/backends/cortex_m/test/ops/test_avg_pool2d.py +99 -0
- executorch/backends/cortex_m/test/ops/test_conv.py +342 -0
- executorch/backends/cortex_m/test/ops/test_linear.py +130 -0
- executorch/backends/cortex_m/test/ops/test_lstm.py +98 -0
- executorch/backends/cortex_m/test/ops/test_maximum.py +83 -0
- executorch/backends/cortex_m/test/ops/test_minimum.py +104 -0
- executorch/backends/cortex_m/test/ops/test_mul.py +156 -0
- executorch/backends/cortex_m/test/ops/test_softmax.py +84 -0
- executorch/backends/cortex_m/test/ops/test_transpose.py +102 -0
- executorch/backends/cortex_m/test/test_helpers_passes_utils.py +103 -0
- executorch/backends/cortex_m/test/test_replace_quant_nodes.py +134 -0
- executorch/backends/cortex_m/test/tester.py +113 -0
- executorch/backends/cuda/__init__.py +5 -0
- executorch/backends/cuda/cuda_backend.py +250 -0
- executorch/backends/cuda/cuda_partitioner.py +25 -0
- executorch/backends/cuda/passes/__init__.py +0 -0
- executorch/backends/cuda/passes/move_cond_predicate_to_cpu.py +90 -0
- executorch/backends/cuda/passes/tests/__init__.py +0 -0
- executorch/backends/cuda/passes/tests/test_move_cond_predicate_to_cpu.py +553 -0
- executorch/backends/cuda/tests/__init__.py +5 -0
- executorch/backends/cuda/tests/test_cuda_export.py +327 -0
- executorch/backends/cuda/tests/test_cuda_partitioner.py +224 -0
- executorch/backends/cuda/triton/__init__.py +17 -0
- executorch/backends/cuda/triton/kernels/__init__.py +11 -0
- executorch/backends/cuda/triton/kernels/sdpa.py +827 -0
- executorch/backends/cuda/triton/replacement_pass.py +130 -0
- executorch/backends/example/example_backend.py +41 -0
- executorch/backends/example/example_backend_delegate_passes/merge_to_dim_pass.py +83 -0
- executorch/backends/example/example_backend_delegate_passes/permute_memory_formats_pass.py +143 -0
- executorch/backends/example/example_operators/adaptive_avg_pool2d.py +47 -0
- executorch/backends/example/example_operators/add.py +44 -0
- executorch/backends/example/example_operators/conv2d.py +52 -0
- executorch/backends/example/example_operators/conv_relu.py +49 -0
- executorch/backends/example/example_operators/dropout.py +44 -0
- executorch/backends/example/example_operators/flatten.py +40 -0
- executorch/backends/example/example_operators/linear.py +62 -0
- executorch/backends/example/example_operators/op_base.py +15 -0
- executorch/backends/example/example_operators/ops.py +32 -0
- executorch/backends/example/example_operators/utils.py +34 -0
- executorch/backends/example/example_partitioner.py +88 -0
- executorch/backends/example/example_quantizer.py +108 -0
- executorch/backends/example/test_example_delegate.py +112 -0
- executorch/backends/mediatek/__init__.py +5 -0
- executorch/backends/mediatek/_passes/__init__.py +0 -0
- executorch/backends/mediatek/_passes/decompose_scaled_dot_product_attention.py +79 -0
- executorch/backends/mediatek/partitioner.py +107 -0
- executorch/backends/mediatek/preprocess.py +214 -0
- executorch/backends/mediatek/quantizer/__init__.py +4 -0
- executorch/backends/mediatek/quantizer/annotator.py +263 -0
- executorch/backends/mediatek/quantizer/qconfig.py +174 -0
- executorch/backends/mediatek/quantizer/quantizer.py +45 -0
- executorch/backends/nxp/_passes/remove_getitem_pass.py +105 -0
- executorch/backends/nxp/aten_passes/convert_unsqueeze_to_view.py +79 -0
- executorch/backends/nxp/aten_passes/decompose_split_to_slices_pass.py +193 -0
- executorch/backends/nxp/aten_passes/fuse_batch_norm_with_conv_pass.py +146 -0
- executorch/backends/nxp/aten_passes/fuse_batch_norm_with_linear_pass.py +150 -0
- executorch/backends/nxp/aten_passes/fuse_linear_and_add_pass.py +204 -0
- executorch/backends/nxp/aten_passes/move_activation_before_concat.py +102 -0
- executorch/backends/nxp/aten_passes/neutron_aten_pass_manager.py +80 -0
- executorch/backends/nxp/aten_passes/remove_nodes_with_known_outputs.py +196 -0
- executorch/backends/nxp/aten_passes/split_group_convolution.py +281 -0
- executorch/backends/nxp/aten_passes/split_gru_based_on_num_layers.py +307 -0
- executorch/backends/nxp/backend/custom_delegation_options.py +19 -0
- executorch/backends/nxp/backend/edge_helper.py +222 -0
- executorch/backends/nxp/backend/edge_program_converter.py +247 -0
- executorch/backends/nxp/backend/ir/conversion_config.py +54 -0
- executorch/backends/nxp/backend/ir/conversion_context.py +38 -0
- executorch/backends/nxp/backend/ir/converter/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/builder/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/builder/aten_model_builder_director.py +142 -0
- executorch/backends/nxp/backend/ir/converter/builder/model_builder.py +1720 -0
- executorch/backends/nxp/backend/ir/converter/builder/quantization_verification.py +377 -0
- executorch/backends/nxp/backend/ir/converter/conversion/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/conversion/aten_translator.py +71 -0
- executorch/backends/nxp/backend/ir/converter/conversion/common.py +207 -0
- executorch/backends/nxp/backend/ir/converter/conversion/translator.py +689 -0
- executorch/backends/nxp/backend/ir/converter/node_converter.py +234 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/__init__.py +4 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/__init__.py +101 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/abs_converter.py +35 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/adaptive_avg_pool_2d_converter.py +68 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/add_tensor_converter.py +57 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/addmm_converter.py +62 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/avg_pool_2d_converter.py +101 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/cat_converter.py +209 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/clone_converter.py +118 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/constant_pad_nd_converter.py +160 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/convolution_converter.py +535 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/hardtanh_converter.py +47 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/max_pool_2d_converter.py +104 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/mean_dim_converter.py +112 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/mm_converter.py +59 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/mul_tensor_converter.py +61 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/permute_copy_converter.py +468 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/qdq_dequantize_converter.py +116 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/qdq_quantize_converter.py +46 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/relu_converter.py +33 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/sigmoid_converter.py +35 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/slice_tensor_converter.py +158 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/softmax_converter.py +62 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/sub_tensor_converter.py +59 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/tanh_converter.py +33 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/view_copy_converter.py +220 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/conv_utils.py +105 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/recurrent_utils.py +64 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/reduce_utils.py +97 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/reshape_transposition.py +233 -0
- executorch/backends/nxp/backend/ir/converter/quantization_utils.py +149 -0
- executorch/backends/nxp/backend/ir/converter/tensor_utils.py +50 -0
- executorch/backends/nxp/backend/ir/lib/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ATan2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AbsOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ActivationFunctionType.py +12 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AddNOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AddOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ArgMaxOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ArgMinOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AssignVariableOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BatchMatMulOptions.py +101 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BatchToSpaceNDOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BidirectionalSequenceLSTMOptions.py +160 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BidirectionalSequenceRNNOptions.py +126 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BitcastOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BitwiseXorOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BroadcastToOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BucketizeOptions.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Buffer.py +132 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BuiltinOperator.py +212 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BuiltinOptions.py +133 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BuiltinOptions2.py +27 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CallOnceOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CallOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CastOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CombinerType.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ConcatEmbeddingsOptions.py +163 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ConcatenationOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Conv2DOptions.py +155 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Conv3DOptions.py +170 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CosOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CumsumOptions.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CustomOptionsFormat.py +7 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CustomQuantization.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DensifyOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DepthToSpaceOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DepthwiseConv2DOptions.py +157 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DequantizeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DilateOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DimensionMetadata.py +152 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DimensionType.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DivOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DynamicUpdateSliceOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/EmbeddingLookupSparseOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/EqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ExpOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ExpandDimsOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FakeQuantOptions.py +116 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FillOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FloorDivOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FloorModOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FullyConnectedOptions.py +129 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FullyConnectedOptionsWeightsFormat.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GatherNdOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GatherOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GeluOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GreaterEqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GreaterOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HardSwishOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableFindOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableImportOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableOptions.py +95 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableSizeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/IfOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Int32Vector.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/L2NormOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSHProjectionOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSHProjectionType.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSTMKernelType.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSTMOptions.py +131 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LeakyReluOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LessEqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LessOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LocalResponseNormalizationOptions.py +118 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogSoftmaxOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogicalAndOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogicalNotOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogicalOrOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MatrixDiagOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MatrixSetDiagOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MaximumMinimumOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Metadata.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MirrorPadMode.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MirrorPadOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Model.py +352 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MulOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NegOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NonMaxSuppressionV4Options.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NonMaxSuppressionV5Options.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NotEqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/OneHotOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Operator.py +428 -0
- executorch/backends/nxp/backend/ir/lib/tflite/OperatorCode.py +112 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PackOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PadOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PadV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Padding.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Pool2DOptions.py +140 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PowOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/QuantizationDetails.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/QuantizationParameters.py +295 -0
- executorch/backends/nxp/backend/ir/lib/tflite/QuantizeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RNNOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RandomOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RangeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RankOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReadVariableOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReduceWindowFunction.py +13 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReduceWindowOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReducerOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReshapeOptions.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ResizeBilinearOptions.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ResizeNearestNeighborOptions.py +86 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReverseSequenceOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReverseV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Rfft2dOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RightShiftOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RngAlgorithm.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SVDFOptions.py +97 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ScatterNdOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SegmentSumOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SelectOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SelectV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SequenceRNNOptions.py +99 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ShapeOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SignOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SignatureDef.py +172 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SkipGramOptions.py +97 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SliceOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SoftmaxOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SpaceToBatchNDOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SpaceToDepthOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SparseIndexVector.py +10 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SparseToDenseOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SparsityParameters.py +190 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SplitOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SplitVOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SquareOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SquaredDifferenceOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SqueezeOptions.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloBroadcastInDimOptions.py +102 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloCompareOptions.py +86 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloComparisonDirection.py +12 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloComparisonType.py +11 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloConcatenateOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloConvolutionOptions.py +634 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloCustomCallOptions.py +214 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloDotGeneralOptions.py +304 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloDynamicSliceOptions.py +100 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloGatherOptions.py +276 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloIotaOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloPadOptions.py +194 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloPrecisionConfig.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloReduceOptions.py +115 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloReduceWindowOptions.py +307 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloRngBitGeneratorOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloScatterOptions.py +268 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloSliceOptions.py +194 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloSortOptions.py +97 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloTransposeOptions.py +100 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloWhileOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StridedSliceOptions.py +142 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SubGraph.py +251 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SubOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Tensor.py +317 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TensorMap.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TensorType.py +24 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TileOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TopKV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TransposeConvOptions.py +125 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TransposeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Uint16Vector.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Uint8Vector.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnidirectionalSequenceLSTMOptions.py +164 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UniqueOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnpackOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentMaxOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentMinOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentProdOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentSumOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/VarHandleOptions.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/VariantSubType.py +130 -0
- executorch/backends/nxp/backend/ir/lib/tflite/WhereOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/WhileOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ZerosLikeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/logger.py +341 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/graph_utils.py +115 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/operator_rules.py +102 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/base_optimization.py +41 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/permute_fully_connected_weights_after_reshape.py +121 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/prune_transpose_operators.py +174 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizer.py +127 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/pattern_matcher.py +925 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/tensor_rules.py +710 -0
- executorch/backends/nxp/backend/ir/tensor_formatting.py +69 -0
- executorch/backends/nxp/backend/ir/tflite_generator/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/abs_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/add_n_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/add_options.py +46 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/arg_max_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/arg_min_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/average_pool_2d_options.py +63 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/batch_mat_mul_options.py +45 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/bidirectional_sequence_lstm_options.py +65 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/bidirectional_sequence_rnn_options.py +53 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/bitwise_xor_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/broadcast_to_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/cast_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/concatenation_options.py +38 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/conv_2d_options.py +59 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/conv_3d_options.py +67 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/cum_sum_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/depth_to_space_options.py +29 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/depthwise_conv_2d_options.py +69 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/dequantize_options.py +24 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/div_options.py +43 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/equal_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/exp_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/floor_mod_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/fully_connected_options.py +57 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/gather_nd_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/gather_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/gelu_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/greater_equal_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/greater_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/hard_swish_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/leaky_relu_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/less_equal_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/less_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/log_softmax_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/logical_and_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/logical_not_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/logical_or_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/lrn_options.py +45 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/lstm_options.py +60 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/max_pool_2d_options.py +63 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/maximum_options.py +21 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/mean_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/minimum_options.py +21 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/mirror_pad_options.py +60 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/mul_options.py +36 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/multinomial_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/neg_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/not_equal_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/one_hot_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/pad_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/pad_v2_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/pow_options.py +24 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/quantize_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/range_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reduce_max_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reduce_min_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reduce_prod_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reshape_options.py +53 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/resize_bilinear_options.py +34 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/resize_nearest_neighbor_options.py +37 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reverse_sequence_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/scatter_nd_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/select_v2_options.py +24 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/shape_options.py +34 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/sign_options.py +22 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/slice_options.py +29 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/softmax_options.py +36 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/space_to_depth_options.py +29 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/split_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/split_v_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/square_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/squared_difference_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/squeeze_options.py +42 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/strided_slice_options.py +35 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/sub_options.py +46 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/sum_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/tile_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/transpose_conv_options.py +50 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/transpose_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/unidirectional_sequence_lstm_options.py +67 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/unidirectional_sequence_rnn_options.py +49 -0
- executorch/backends/nxp/backend/ir/tflite_generator/custom_options/flex_transpose_options.py +78 -0
- executorch/backends/nxp/backend/ir/tflite_generator/meta/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/tflite_generator/meta/meta.py +255 -0
- executorch/backends/nxp/backend/ir/tflite_generator/meta/types.py +198 -0
- executorch/backends/nxp/backend/ir/tflite_generator/tflite_model.py +814 -0
- executorch/backends/nxp/backend/neutron_converter_manager.py +117 -0
- executorch/backends/nxp/backend/neutron_operator_support.py +79 -0
- executorch/backends/nxp/backend/neutron_target_spec.py +143 -0
- executorch/backends/nxp/backend/node_format.py +26 -0
- executorch/backends/nxp/backend/node_format_inference.py +294 -0
- executorch/backends/nxp/edge_passes/move_auxiliary_operator_into_separate_qdq_cluster_pass.py +254 -0
- executorch/backends/nxp/edge_passes/neutron_edge_pass.py +55 -0
- executorch/backends/nxp/edge_passes/neutron_edge_pass_manager.py +29 -0
- executorch/backends/nxp/edge_passes/remove_additional_quantize_dequantize_nodes_pass.py +111 -0
- executorch/backends/nxp/edge_passes/remove_as_strided_copy_nodes.py +66 -0
- executorch/backends/nxp/edge_passes/remove_io_quant_ops_pass.py +79 -0
- executorch/backends/nxp/neutron_node_extraction.py +152 -0
- executorch/backends/nxp/neutron_partitioner.py +421 -0
- executorch/backends/nxp/neutron_pass_manager.py +50 -0
- executorch/backends/nxp/nxp_backend.py +391 -0
- executorch/backends/nxp/quantizer/neutron_quantizer.py +353 -0
- executorch/backends/nxp/quantizer/patterns.py +1089 -0
- executorch/backends/nxp/quantizer/utils.py +195 -0
- executorch/backends/nxp/tests/executorch_pipeline.py +184 -0
- executorch/backends/nxp/tests/executors.py +401 -0
- executorch/backends/nxp/tests/ir/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/converter/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_abs_converter.py +91 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_adaptive_avg_pool2d_converter.py +148 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_add_tensor_converter.py +161 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_addmm_converter.py +96 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_avg_pool2d_converter.py +221 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_cat_converter.py +495 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_clone_converter.py +344 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_constant_pad_nd_converter.py +188 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_conv_converter.py +680 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_hardtanh_converter.py +107 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_max_pool_2d_converter.py +132 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_mean_dim_converter.py +280 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_mm_converter.py +96 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_mul_tensor_converter.py +212 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_permute_copy_converter.py +426 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_relu_converter.py +114 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_sigmoid_converter.py +78 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_slice_tensor_converter.py +244 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_softmax_converter.py +115 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_sub_tensor_converter.py +181 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_tanh_converter.py +90 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_view_copy_converter.py +509 -0
- executorch/backends/nxp/tests/ir/edge_passes/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/edge_passes/test_remove_io_quant_ops_pass.py +127 -0
- executorch/backends/nxp/tests/models.py +737 -0
- executorch/backends/nxp/tests/test_batch_norm_fusion.py +233 -0
- executorch/backends/nxp/tests/test_context_sensitive_delegation.py +71 -0
- executorch/backends/nxp/tests/test_convert_unsqueeze_to_view.py +143 -0
- executorch/backends/nxp/tests/test_decompose_split_to_slices.py +315 -0
- executorch/backends/nxp/tests/test_edge_passes.py +382 -0
- executorch/backends/nxp/tests/test_gru_splitting.py +267 -0
- executorch/backends/nxp/tests/test_integration.py +53 -0
- executorch/backends/nxp/tests/test_linear_and_add_fusion.py +653 -0
- executorch/backends/nxp/tests/test_move_activation_before_concatenation.py +905 -0
- executorch/backends/nxp/tests/test_neutron_backend.py +63 -0
- executorch/backends/nxp/tests/test_neutron_backend_executor.py +327 -0
- executorch/backends/nxp/tests/test_neutron_converter_manager.py +59 -0
- executorch/backends/nxp/tests/test_node_format_inference.py +91 -0
- executorch/backends/nxp/tests/test_operator_selector.py +24 -0
- executorch/backends/nxp/tests/test_per_channel_conversion.py +182 -0
- executorch/backends/nxp/tests/test_qdq_clustering_conv.py +31 -0
- executorch/backends/nxp/tests/test_quantizer.py +703 -0
- executorch/backends/nxp/tests/test_removing_dead_code.py +65 -0
- executorch/backends/nxp/tests/test_removing_nodes_with_known_outputs.py +116 -0
- executorch/backends/nxp/tests/test_split_group_convolution.py +291 -0
- executorch/backends/nxp/tests/use_qat.py +11 -0
- executorch/backends/openvino/__init__.py +5 -0
- executorch/backends/openvino/partitioner.py +238 -0
- executorch/backends/openvino/preprocess.py +62 -0
- executorch/backends/openvino/quantizer/__init__.py +3 -0
- executorch/backends/openvino/quantizer/observers.py +186 -0
- executorch/backends/openvino/quantizer/quantizer.py +595 -0
- executorch/backends/openvino/tests/models/test_classification.py +38 -0
- executorch/backends/openvino/tests/ops/base_openvino_op_test.py +86 -0
- executorch/backends/openvino/tests/ops/test_add.py +22 -0
- executorch/backends/openvino/tests/ops/test_addmm.py +28 -0
- executorch/backends/openvino/tests/ops/test_arange.py +23 -0
- executorch/backends/openvino/tests/ops/test_batch_norm.py +61 -0
- executorch/backends/openvino/tests/ops/test_convolution.py +296 -0
- executorch/backends/openvino/tests/ops/test_mean.py +90 -0
- executorch/backends/openvino/tests/ops/test_permute.py +33 -0
- executorch/backends/openvino/tests/ops/test_pooling.py +91 -0
- executorch/backends/openvino/tests/ops/test_unary_ops.py +37 -0
- executorch/backends/openvino/tests/ops/test_view.py +35 -0
- executorch/backends/openvino/tests/test_runner.py +76 -0
- executorch/backends/qualcomm/__init__.py +13 -0
- executorch/backends/qualcomm/_passes/__init__.py +101 -0
- executorch/backends/qualcomm/_passes/annotate_adaptive_avg_pool1d.py +43 -0
- executorch/backends/qualcomm/_passes/annotate_quant_attrs.py +145 -0
- executorch/backends/qualcomm/_passes/annotate_stack.py +44 -0
- executorch/backends/qualcomm/_passes/annotate_unbind.py +42 -0
- executorch/backends/qualcomm/_passes/build_quant_io.py +49 -0
- executorch/backends/qualcomm/_passes/canonicalize_conv.py +204 -0
- executorch/backends/qualcomm/_passes/convert_bmm_to_matmul.py +83 -0
- executorch/backends/qualcomm/_passes/convert_linear_to_conv2d.py +232 -0
- executorch/backends/qualcomm/_passes/convert_mha_to_sha.py +626 -0
- executorch/backends/qualcomm/_passes/convert_square_to_pow.py +38 -0
- executorch/backends/qualcomm/_passes/decompose_any.py +64 -0
- executorch/backends/qualcomm/_passes/decompose_binary_alpha.py +61 -0
- executorch/backends/qualcomm/_passes/decompose_cdist.py +69 -0
- executorch/backends/qualcomm/_passes/decompose_col_im.py +121 -0
- executorch/backends/qualcomm/_passes/decompose_einsum.py +51 -0
- executorch/backends/qualcomm/_passes/decompose_expm1.py +46 -0
- executorch/backends/qualcomm/_passes/decompose_floor_divide.py +62 -0
- executorch/backends/qualcomm/_passes/decompose_glu.py +55 -0
- executorch/backends/qualcomm/_passes/decompose_linalg_vector_norm.py +75 -0
- executorch/backends/qualcomm/_passes/decompose_maxpool3d.py +133 -0
- executorch/backends/qualcomm/_passes/decompose_minmaxdim.py +109 -0
- executorch/backends/qualcomm/_passes/decompose_roll.py +78 -0
- executorch/backends/qualcomm/_passes/decompose_silu.py +45 -0
- executorch/backends/qualcomm/_passes/decompose_threshold.py +61 -0
- executorch/backends/qualcomm/_passes/decompose_triu.py +71 -0
- executorch/backends/qualcomm/_passes/decompose_wrap_with_autocast.py +79 -0
- executorch/backends/qualcomm/_passes/expand_broadcast_tensor_shape.py +67 -0
- executorch/backends/qualcomm/_passes/fixed_linear_keep_dim.py +95 -0
- executorch/backends/qualcomm/_passes/fold_qdq.py +80 -0
- executorch/backends/qualcomm/_passes/fuse_consecutive_cast.py +116 -0
- executorch/backends/qualcomm/_passes/fuse_consecutive_transpose.py +109 -0
- executorch/backends/qualcomm/_passes/i64_to_i32.py +184 -0
- executorch/backends/qualcomm/_passes/insert_io_qdq.py +154 -0
- executorch/backends/qualcomm/_passes/insert_requantize.py +111 -0
- executorch/backends/qualcomm/_passes/insert_reshape_for_reduce_ops.py +59 -0
- executorch/backends/qualcomm/_passes/layout_transform.py +355 -0
- executorch/backends/qualcomm/_passes/lift_constant_scalar_operands.py +186 -0
- executorch/backends/qualcomm/_passes/qnn_pass_manager.py +271 -0
- executorch/backends/qualcomm/_passes/recompose_pad_maxpool2d.py +147 -0
- executorch/backends/qualcomm/_passes/recompose_pixel_unshuffle.py +81 -0
- executorch/backends/qualcomm/_passes/recompose_rms_norm.py +155 -0
- executorch/backends/qualcomm/_passes/reduce_dynamic_range.py +60 -0
- executorch/backends/qualcomm/_passes/remove_0d_tensor.py +36 -0
- executorch/backends/qualcomm/_passes/remove_redundancy.py +73 -0
- executorch/backends/qualcomm/_passes/replace_arange_args.py +48 -0
- executorch/backends/qualcomm/_passes/replace_inf_values.py +60 -0
- executorch/backends/qualcomm/_passes/seq_mse.py +224 -0
- executorch/backends/qualcomm/_passes/tag_quant_io.py +45 -0
- executorch/backends/qualcomm/_passes/utils.py +283 -0
- executorch/backends/qualcomm/builders/__init__.py +221 -0
- executorch/backends/qualcomm/builders/node_visitor.py +518 -0
- executorch/backends/qualcomm/builders/node_visitor_manager.py +79 -0
- executorch/backends/qualcomm/builders/op_abs.py +57 -0
- executorch/backends/qualcomm/builders/op_adaptive_avg_pool2d.py +126 -0
- executorch/backends/qualcomm/builders/op_adaptive_max_pool2d.py +151 -0
- executorch/backends/qualcomm/builders/op_add.py +62 -0
- executorch/backends/qualcomm/builders/op_amax.py +90 -0
- executorch/backends/qualcomm/builders/op_amin.py +90 -0
- executorch/backends/qualcomm/builders/op_and.py +60 -0
- executorch/backends/qualcomm/builders/op_arange.py +41 -0
- executorch/backends/qualcomm/builders/op_argmax.py +78 -0
- executorch/backends/qualcomm/builders/op_argmin.py +78 -0
- executorch/backends/qualcomm/builders/op_asin.py +56 -0
- executorch/backends/qualcomm/builders/op_atan.py +55 -0
- executorch/backends/qualcomm/builders/op_avg_pool2d.py +168 -0
- executorch/backends/qualcomm/builders/op_avg_pool3d.py +299 -0
- executorch/backends/qualcomm/builders/op_batch_norm.py +151 -0
- executorch/backends/qualcomm/builders/op_binary.py +84 -0
- executorch/backends/qualcomm/builders/op_bmm.py +59 -0
- executorch/backends/qualcomm/builders/op_cat.py +89 -0
- executorch/backends/qualcomm/builders/op_ceil.py +56 -0
- executorch/backends/qualcomm/builders/op_clamp.py +80 -0
- executorch/backends/qualcomm/builders/op_conv.py +263 -0
- executorch/backends/qualcomm/builders/op_copy.py +112 -0
- executorch/backends/qualcomm/builders/op_cos.py +56 -0
- executorch/backends/qualcomm/builders/op_cum_sum.py +87 -0
- executorch/backends/qualcomm/builders/op_custom_op.py +93 -0
- executorch/backends/qualcomm/builders/op_depth_to_space.py +78 -0
- executorch/backends/qualcomm/builders/op_dequantize.py +72 -0
- executorch/backends/qualcomm/builders/op_div.py +62 -0
- executorch/backends/qualcomm/builders/op_elu.py +68 -0
- executorch/backends/qualcomm/builders/op_embedding.py +79 -0
- executorch/backends/qualcomm/builders/op_eq.py +62 -0
- executorch/backends/qualcomm/builders/op_exp.py +60 -0
- executorch/backends/qualcomm/builders/op_expand.py +84 -0
- executorch/backends/qualcomm/builders/op_flip.py +81 -0
- executorch/backends/qualcomm/builders/op_floor.py +56 -0
- executorch/backends/qualcomm/builders/op_full.py +41 -0
- executorch/backends/qualcomm/builders/op_full_like.py +41 -0
- executorch/backends/qualcomm/builders/op_gather.py +76 -0
- executorch/backends/qualcomm/builders/op_ge.py +62 -0
- executorch/backends/qualcomm/builders/op_gelu.py +57 -0
- executorch/backends/qualcomm/builders/op_grid_sampler_2d.py +162 -0
- executorch/backends/qualcomm/builders/op_group_norm.py +94 -0
- executorch/backends/qualcomm/builders/op_gt.py +62 -0
- executorch/backends/qualcomm/builders/op_hardsigmoid.py +78 -0
- executorch/backends/qualcomm/builders/op_hardswish.py +57 -0
- executorch/backends/qualcomm/builders/op_hardtanh.py +79 -0
- executorch/backends/qualcomm/builders/op_index.py +85 -0
- executorch/backends/qualcomm/builders/op_index_put.py +481 -0
- executorch/backends/qualcomm/builders/op_index_select.py +81 -0
- executorch/backends/qualcomm/builders/op_instance_norm.py +112 -0
- executorch/backends/qualcomm/builders/op_layer_norm.py +113 -0
- executorch/backends/qualcomm/builders/op_le.py +62 -0
- executorch/backends/qualcomm/builders/op_linear.py +98 -0
- executorch/backends/qualcomm/builders/op_log.py +58 -0
- executorch/backends/qualcomm/builders/op_log_softmax.py +81 -0
- executorch/backends/qualcomm/builders/op_logical_not.py +56 -0
- executorch/backends/qualcomm/builders/op_lt.py +62 -0
- executorch/backends/qualcomm/builders/op_matmul.py +59 -0
- executorch/backends/qualcomm/builders/op_max.py +62 -0
- executorch/backends/qualcomm/builders/op_max_dim.py +89 -0
- executorch/backends/qualcomm/builders/op_max_pool2d.py +145 -0
- executorch/backends/qualcomm/builders/op_mean_dim.py +100 -0
- executorch/backends/qualcomm/builders/op_min.py +62 -0
- executorch/backends/qualcomm/builders/op_min_dim.py +89 -0
- executorch/backends/qualcomm/builders/op_mul.py +62 -0
- executorch/backends/qualcomm/builders/op_ne.py +62 -0
- executorch/backends/qualcomm/builders/op_neg.py +54 -0
- executorch/backends/qualcomm/builders/op_or.py +60 -0
- executorch/backends/qualcomm/builders/op_pad.py +97 -0
- executorch/backends/qualcomm/builders/op_pow.py +75 -0
- executorch/backends/qualcomm/builders/op_prelu.py +81 -0
- executorch/backends/qualcomm/builders/op_quantize.py +73 -0
- executorch/backends/qualcomm/builders/op_relu.py +58 -0
- executorch/backends/qualcomm/builders/op_repeat.py +68 -0
- executorch/backends/qualcomm/builders/op_reshape.py +55 -0
- executorch/backends/qualcomm/builders/op_resize.py +85 -0
- executorch/backends/qualcomm/builders/op_rms_norm.py +132 -0
- executorch/backends/qualcomm/builders/op_round.py +58 -0
- executorch/backends/qualcomm/builders/op_rsqrt.py +58 -0
- executorch/backends/qualcomm/builders/op_scalar_tensor.py +51 -0
- executorch/backends/qualcomm/builders/op_select_copy.py +89 -0
- executorch/backends/qualcomm/builders/op_sigmoid.py +58 -0
- executorch/backends/qualcomm/builders/op_sign.py +56 -0
- executorch/backends/qualcomm/builders/op_sin.py +56 -0
- executorch/backends/qualcomm/builders/op_skip_ops.py +55 -0
- executorch/backends/qualcomm/builders/op_slice_copy.py +95 -0
- executorch/backends/qualcomm/builders/op_slice_scatter.py +122 -0
- executorch/backends/qualcomm/builders/op_softmax.py +79 -0
- executorch/backends/qualcomm/builders/op_space_to_depth.py +78 -0
- executorch/backends/qualcomm/builders/op_split_with_sizes.py +99 -0
- executorch/backends/qualcomm/builders/op_sqrt.py +60 -0
- executorch/backends/qualcomm/builders/op_squeeze.py +57 -0
- executorch/backends/qualcomm/builders/op_stack.py +71 -0
- executorch/backends/qualcomm/builders/op_sub.py +62 -0
- executorch/backends/qualcomm/builders/op_sum_int_list.py +84 -0
- executorch/backends/qualcomm/builders/op_tanh.py +57 -0
- executorch/backends/qualcomm/builders/op_to.py +149 -0
- executorch/backends/qualcomm/builders/op_topk.py +112 -0
- executorch/backends/qualcomm/builders/op_transpose.py +76 -0
- executorch/backends/qualcomm/builders/op_unbind.py +73 -0
- executorch/backends/qualcomm/builders/op_unsqueeze.py +57 -0
- executorch/backends/qualcomm/builders/op_upsample_bilinear2d.py +68 -0
- executorch/backends/qualcomm/builders/op_upsample_nearest2d.py +68 -0
- executorch/backends/qualcomm/builders/op_where.py +82 -0
- executorch/backends/qualcomm/builders/op_xor.py +60 -0
- executorch/backends/qualcomm/builders/qnn_constants.py +630 -0
- executorch/backends/qualcomm/builders/utils.py +160 -0
- executorch/backends/qualcomm/debugger/format_outputs.py +221 -0
- executorch/backends/qualcomm/debugger/metrics_evaluator.py +90 -0
- executorch/backends/qualcomm/debugger/qnn_intermediate_debugger.py +328 -0
- executorch/backends/qualcomm/debugger/utils.py +435 -0
- executorch/backends/qualcomm/partition/common_defs.py +44 -0
- executorch/backends/qualcomm/partition/qnn_partitioner.py +225 -0
- executorch/backends/qualcomm/partition/utils.py +75 -0
- executorch/backends/qualcomm/qnn_preprocess.py +218 -0
- executorch/backends/qualcomm/quantizer/annotators.py +1501 -0
- executorch/backends/qualcomm/quantizer/custom_annotation.py +499 -0
- executorch/backends/qualcomm/quantizer/observers/concat_observer.py +74 -0
- executorch/backends/qualcomm/quantizer/observers/per_block_param_observer.py +145 -0
- executorch/backends/qualcomm/quantizer/observers/per_channel_param_observer.py +113 -0
- executorch/backends/qualcomm/quantizer/qconfig.py +802 -0
- executorch/backends/qualcomm/quantizer/quant_recipe.py +402 -0
- executorch/backends/qualcomm/quantizer/quantizer.py +507 -0
- executorch/backends/qualcomm/recipes/__init__.py +16 -0
- executorch/backends/qualcomm/recipes/qnn_recipe_provider.py +179 -0
- executorch/backends/qualcomm/recipes/qnn_recipe_types.py +28 -0
- executorch/backends/qualcomm/scripts/download_qnn_sdk.py +642 -0
- executorch/backends/qualcomm/serialization/qc_compiler_spec.fbs +299 -0
- executorch/backends/qualcomm/serialization/qc_schema.py +240 -0
- executorch/backends/qualcomm/serialization/qc_schema_serialize.py +59 -0
- executorch/backends/qualcomm/tests/models.py +2393 -0
- executorch/backends/qualcomm/tests/test_passes.py +154 -0
- executorch/backends/qualcomm/tests/test_qnn_delegate.py +8454 -0
- executorch/backends/qualcomm/tests/tester.py +113 -0
- executorch/backends/qualcomm/tests/utils.py +770 -0
- executorch/backends/qualcomm/utils/constants.py +49 -0
- executorch/backends/qualcomm/utils/qnn_manager_lifecycle.py +88 -0
- executorch/backends/qualcomm/utils/utils.py +1302 -0
- executorch/backends/samsung/_passes/annotate_qparams.py +201 -0
- executorch/backends/samsung/_passes/annotate_scalar_parameters.py +65 -0
- executorch/backends/samsung/_passes/conv1d_to_conv2d.py +97 -0
- executorch/backends/samsung/_passes/customized_constant_prop.py +40 -0
- executorch/backends/samsung/_passes/fold_qdq.py +36 -0
- executorch/backends/samsung/_passes/fuse_conv_act.py +77 -0
- executorch/backends/samsung/_passes/insert_qdq.py +164 -0
- executorch/backends/samsung/_passes/remove_useless_ops.py +87 -0
- executorch/backends/samsung/_passes/replace_scalar_ops.py +46 -0
- executorch/backends/samsung/_passes/utils.py +15 -0
- executorch/backends/samsung/builders/__init__.py +97 -0
- executorch/backends/samsung/builders/node_visitor.py +116 -0
- executorch/backends/samsung/builders/op_add.py +41 -0
- executorch/backends/samsung/builders/op_avg_pool2d.py +70 -0
- executorch/backends/samsung/builders/op_batch_norm.py +56 -0
- executorch/backends/samsung/builders/op_bmm.py +43 -0
- executorch/backends/samsung/builders/op_cat.py +50 -0
- executorch/backends/samsung/builders/op_clamp.py +47 -0
- executorch/backends/samsung/builders/op_constant_pad_nd.py +56 -0
- executorch/backends/samsung/builders/op_conv2d.py +89 -0
- executorch/backends/samsung/builders/op_dequantize.py +19 -0
- executorch/backends/samsung/builders/op_div.py +42 -0
- executorch/backends/samsung/builders/op_embedding.py +41 -0
- executorch/backends/samsung/builders/op_expand_copy.py +77 -0
- executorch/backends/samsung/builders/op_gelu.py +40 -0
- executorch/backends/samsung/builders/op_getitem.py +32 -0
- executorch/backends/samsung/builders/op_hardsigmoid.py +35 -0
- executorch/backends/samsung/builders/op_hardswish.py +35 -0
- executorch/backends/samsung/builders/op_hardtanh.py +42 -0
- executorch/backends/samsung/builders/op_layer_norm.py +53 -0
- executorch/backends/samsung/builders/op_leaky_relu.py +58 -0
- executorch/backends/samsung/builders/op_linear.py +51 -0
- executorch/backends/samsung/builders/op_log_softmax.py +39 -0
- executorch/backends/samsung/builders/op_max_pool2d.py +96 -0
- executorch/backends/samsung/builders/op_maximum.py +37 -0
- executorch/backends/samsung/builders/op_mean_dim.py +49 -0
- executorch/backends/samsung/builders/op_minimum.py +39 -0
- executorch/backends/samsung/builders/op_mul.py +43 -0
- executorch/backends/samsung/builders/op_permute.py +37 -0
- executorch/backends/samsung/builders/op_pixel_shuffle.py +38 -0
- executorch/backends/samsung/builders/op_quantize.py +60 -0
- executorch/backends/samsung/builders/op_relu.py +37 -0
- executorch/backends/samsung/builders/op_reshape.py +34 -0
- executorch/backends/samsung/builders/op_rsqrt.py +35 -0
- executorch/backends/samsung/builders/op_select.py +52 -0
- executorch/backends/samsung/builders/op_slice_copy.py +59 -0
- executorch/backends/samsung/builders/op_softmax.py +39 -0
- executorch/backends/samsung/builders/op_sqrt.py +35 -0
- executorch/backends/samsung/builders/op_squeeze.py +37 -0
- executorch/backends/samsung/builders/op_sub.py +39 -0
- executorch/backends/samsung/builders/op_to_copy.py +44 -0
- executorch/backends/samsung/builders/op_unsqueeze.py +35 -0
- executorch/backends/samsung/builders/op_upsample_bilinear2d.py +53 -0
- executorch/backends/samsung/builders/op_upsample_nearest2d.py +52 -0
- executorch/backends/samsung/builders/utils.py +64 -0
- executorch/backends/samsung/enn_preprocess.py +110 -0
- executorch/backends/samsung/partition/enn_partitioner.py +134 -0
- executorch/backends/samsung/quantizer/__init__.py +10 -0
- executorch/backends/samsung/quantizer/annotator.py +871 -0
- executorch/backends/samsung/quantizer/qconfig.py +174 -0
- executorch/backends/samsung/quantizer/quantizer.py +65 -0
- executorch/backends/samsung/serialization/compile_options.py +77 -0
- executorch/backends/samsung/serialization/compile_options_def.fbs +23 -0
- executorch/backends/samsung/serialization/enn_graph_schema.py +141 -0
- executorch/backends/samsung/test/models/test_deeplab_v3.py +28 -0
- executorch/backends/samsung/test/models/test_edsr.py +30 -0
- executorch/backends/samsung/test/models/test_inception_v3.py +30 -0
- executorch/backends/samsung/test/models/test_inception_v4.py +30 -0
- executorch/backends/samsung/test/models/test_mobilenet_v2.py +28 -0
- executorch/backends/samsung/test/models/test_mobilenet_v3.py +33 -0
- executorch/backends/samsung/test/models/test_resnet18.py +30 -0
- executorch/backends/samsung/test/models/test_resnet50.py +30 -0
- executorch/backends/samsung/test/models/test_torchvision_vit.py +32 -0
- executorch/backends/samsung/test/models/test_wav2letter.py +28 -0
- executorch/backends/samsung/test/ops/test_add.py +63 -0
- executorch/backends/samsung/test/ops/test_avg_pool2d.py +66 -0
- executorch/backends/samsung/test/ops/test_batch_norm.py +52 -0
- executorch/backends/samsung/test/ops/test_bmm.py +50 -0
- executorch/backends/samsung/test/ops/test_cat.py +49 -0
- executorch/backends/samsung/test/ops/test_clamp.py +50 -0
- executorch/backends/samsung/test/ops/test_constant_pad_nd.py +46 -0
- executorch/backends/samsung/test/ops/test_conv2d.py +95 -0
- executorch/backends/samsung/test/ops/test_div.py +50 -0
- executorch/backends/samsung/test/ops/test_embedding.py +46 -0
- executorch/backends/samsung/test/ops/test_expand_copy.py +46 -0
- executorch/backends/samsung/test/ops/test_gelu.py +65 -0
- executorch/backends/samsung/test/ops/test_leaky_relu.py +47 -0
- executorch/backends/samsung/test/ops/test_linear.py +48 -0
- executorch/backends/samsung/test/ops/test_log_softmax.py +46 -0
- executorch/backends/samsung/test/ops/test_max_pool2d.py +72 -0
- executorch/backends/samsung/test/ops/test_mean_dim.py +51 -0
- executorch/backends/samsung/test/ops/test_minimum.py +45 -0
- executorch/backends/samsung/test/ops/test_mul.py +63 -0
- executorch/backends/samsung/test/ops/test_permute.py +55 -0
- executorch/backends/samsung/test/ops/test_pixel_shuffle.py +49 -0
- executorch/backends/samsung/test/ops/test_relu.py +65 -0
- executorch/backends/samsung/test/ops/test_reshape.py +46 -0
- executorch/backends/samsung/test/ops/test_rsqrt.py +46 -0
- executorch/backends/samsung/test/ops/test_select.py +52 -0
- executorch/backends/samsung/test/ops/test_slice_copy.py +46 -0
- executorch/backends/samsung/test/ops/test_softmax.py +46 -0
- executorch/backends/samsung/test/ops/test_sqrt.py +46 -0
- executorch/backends/samsung/test/ops/test_squeeze.py +47 -0
- executorch/backends/samsung/test/ops/test_sub.py +63 -0
- executorch/backends/samsung/test/ops/test_to_copy.py +49 -0
- executorch/backends/samsung/test/ops/test_unsqueeze.py +47 -0
- executorch/backends/samsung/test/ops/test_upsample_bilinear2d.py +54 -0
- executorch/backends/samsung/test/ops/test_upsample_nearest2d.py +53 -0
- executorch/backends/samsung/test/tester/__init__.py +11 -0
- executorch/backends/samsung/test/tester/samsung_tester.py +125 -0
- executorch/backends/samsung/test/utils/__init__.py +11 -0
- executorch/backends/samsung/test/utils/runtime_executor.py +186 -0
- executorch/backends/samsung/utils/constants.py +45 -0
- executorch/backends/samsung/utils/export_utils.py +93 -0
- executorch/backends/samsung/utils/utils.py +125 -0
- executorch/backends/test/facto/__init__.py +0 -0
- executorch/backends/test/facto/facto_specs.py +59 -0
- executorch/backends/test/facto/test_facto.py +301 -0
- executorch/backends/test/harness/__init__.py +3 -0
- executorch/backends/test/harness/error_statistics.py +99 -0
- executorch/backends/test/harness/stages/__init__.py +23 -0
- executorch/backends/test/harness/stages/export.py +32 -0
- executorch/backends/test/harness/stages/partition.py +26 -0
- executorch/backends/test/harness/stages/quantize.py +128 -0
- executorch/backends/test/harness/stages/run_passes.py +66 -0
- executorch/backends/test/harness/stages/serialize.py +59 -0
- executorch/backends/test/harness/stages/stage.py +91 -0
- executorch/backends/test/harness/stages/to_edge.py +27 -0
- executorch/backends/test/harness/stages/to_edge_transform_and_lower.py +50 -0
- executorch/backends/test/harness/stages/to_executorch.py +54 -0
- executorch/backends/test/harness/tester.py +478 -0
- executorch/backends/test/harness/tests/test_error_statistics.py +67 -0
- executorch/backends/test/suite/__init__.py +74 -0
- executorch/backends/test/suite/conftest.py +182 -0
- executorch/backends/test/suite/context.py +34 -0
- executorch/backends/test/suite/discovery.py +100 -0
- executorch/backends/test/suite/flow.py +150 -0
- executorch/backends/test/suite/flows/__init__.py +7 -0
- executorch/backends/test/suite/flows/arm.py +92 -0
- executorch/backends/test/suite/flows/coreml.py +31 -0
- executorch/backends/test/suite/flows/portable.py +19 -0
- executorch/backends/test/suite/flows/qualcomm.py +61 -0
- executorch/backends/test/suite/flows/vulkan.py +44 -0
- executorch/backends/test/suite/flows/xnnpack.py +79 -0
- executorch/backends/test/suite/generate_markdown_summary.py +249 -0
- executorch/backends/test/suite/generate_markdown_summary_json.py +229 -0
- executorch/backends/test/suite/models/__init__.py +7 -0
- executorch/backends/test/suite/models/test_torchaudio.py +110 -0
- executorch/backends/test/suite/models/test_torchvision.py +194 -0
- executorch/backends/test/suite/operators/__init__.py +108 -0
- executorch/backends/test/suite/operators/test_abs.py +60 -0
- executorch/backends/test/suite/operators/test_adaptive_avgpool1d.py +102 -0
- executorch/backends/test/suite/operators/test_adaptive_avgpool2d.py +112 -0
- executorch/backends/test/suite/operators/test_adaptive_avgpool3d.py +112 -0
- executorch/backends/test/suite/operators/test_adaptive_maxpool1d.py +125 -0
- executorch/backends/test/suite/operators/test_adaptive_maxpool2d.py +135 -0
- executorch/backends/test/suite/operators/test_adaptive_maxpool3d.py +135 -0
- executorch/backends/test/suite/operators/test_add.py +76 -0
- executorch/backends/test/suite/operators/test_amax.py +257 -0
- executorch/backends/test/suite/operators/test_amin.py +259 -0
- executorch/backends/test/suite/operators/test_argmax.py +201 -0
- executorch/backends/test/suite/operators/test_argmin.py +201 -0
- executorch/backends/test/suite/operators/test_avgpool1d.py +155 -0
- executorch/backends/test/suite/operators/test_avgpool2d.py +168 -0
- executorch/backends/test/suite/operators/test_avgpool3d.py +163 -0
- executorch/backends/test/suite/operators/test_cat.py +176 -0
- executorch/backends/test/suite/operators/test_ceil.py +60 -0
- executorch/backends/test/suite/operators/test_clamp.py +86 -0
- executorch/backends/test/suite/operators/test_conv1d.py +144 -0
- executorch/backends/test/suite/operators/test_conv2d.py +167 -0
- executorch/backends/test/suite/operators/test_conv3d.py +162 -0
- executorch/backends/test/suite/operators/test_convtranspose1d.py +144 -0
- executorch/backends/test/suite/operators/test_convtranspose2d.py +171 -0
- executorch/backends/test/suite/operators/test_convtranspose3d.py +166 -0
- executorch/backends/test/suite/operators/test_div.py +110 -0
- executorch/backends/test/suite/operators/test_elu.py +49 -0
- executorch/backends/test/suite/operators/test_embedding.py +89 -0
- executorch/backends/test/suite/operators/test_embedding_bag.py +118 -0
- executorch/backends/test/suite/operators/test_exp.py +65 -0
- executorch/backends/test/suite/operators/test_expand.py +122 -0
- executorch/backends/test/suite/operators/test_floor.py +57 -0
- executorch/backends/test/suite/operators/test_floor_divide.py +216 -0
- executorch/backends/test/suite/operators/test_gelu.py +52 -0
- executorch/backends/test/suite/operators/test_glu.py +52 -0
- executorch/backends/test/suite/operators/test_hardsigmoid.py +50 -0
- executorch/backends/test/suite/operators/test_hardswish.py +50 -0
- executorch/backends/test/suite/operators/test_hardtanh.py +57 -0
- executorch/backends/test/suite/operators/test_index_put.py +455 -0
- executorch/backends/test/suite/operators/test_index_select.py +128 -0
- executorch/backends/test/suite/operators/test_leaky_relu.py +56 -0
- executorch/backends/test/suite/operators/test_linear.py +124 -0
- executorch/backends/test/suite/operators/test_log.py +80 -0
- executorch/backends/test/suite/operators/test_log10.py +60 -0
- executorch/backends/test/suite/operators/test_log1p.py +60 -0
- executorch/backends/test/suite/operators/test_log2.py +60 -0
- executorch/backends/test/suite/operators/test_logsigmoid.py +40 -0
- executorch/backends/test/suite/operators/test_lstm.py +247 -0
- executorch/backends/test/suite/operators/test_masked_fill.py +101 -0
- executorch/backends/test/suite/operators/test_maxpool1d.py +185 -0
- executorch/backends/test/suite/operators/test_maxpool2d.py +191 -0
- executorch/backends/test/suite/operators/test_maxpool3d.py +189 -0
- executorch/backends/test/suite/operators/test_mean.py +305 -0
- executorch/backends/test/suite/operators/test_median.py +188 -0
- executorch/backends/test/suite/operators/test_mul.py +66 -0
- executorch/backends/test/suite/operators/test_neg.py +70 -0
- executorch/backends/test/suite/operators/test_permute.py +109 -0
- executorch/backends/test/suite/operators/test_pow.py +149 -0
- executorch/backends/test/suite/operators/test_prelu.py +55 -0
- executorch/backends/test/suite/operators/test_relu.py +45 -0
- executorch/backends/test/suite/operators/test_reshape.py +82 -0
- executorch/backends/test/suite/operators/test_round.py +129 -0
- executorch/backends/test/suite/operators/test_rsqrt.py +76 -0
- executorch/backends/test/suite/operators/test_select.py +89 -0
- executorch/backends/test/suite/operators/test_sigmoid.py +40 -0
- executorch/backends/test/suite/operators/test_silu.py +50 -0
- executorch/backends/test/suite/operators/test_slice.py +146 -0
- executorch/backends/test/suite/operators/test_split.py +119 -0
- executorch/backends/test/suite/operators/test_sqrt.py +71 -0
- executorch/backends/test/suite/operators/test_square.py +67 -0
- executorch/backends/test/suite/operators/test_squeeze.py +86 -0
- executorch/backends/test/suite/operators/test_stack.py +114 -0
- executorch/backends/test/suite/operators/test_sub.py +84 -0
- executorch/backends/test/suite/operators/test_tanh.py +40 -0
- executorch/backends/test/suite/operators/test_threshold.py +71 -0
- executorch/backends/test/suite/operators/test_transpose.py +143 -0
- executorch/backends/test/suite/operators/test_trunc.py +73 -0
- executorch/backends/test/suite/operators/test_unsqueeze.py +110 -0
- executorch/backends/test/suite/operators/test_upsample_bilinear2d.py +273 -0
- executorch/backends/test/suite/operators/test_upsample_nearest2d.py +137 -0
- executorch/backends/test/suite/operators/test_view.py +82 -0
- executorch/backends/test/suite/reporting.py +421 -0
- executorch/backends/test/suite/runner.py +328 -0
- executorch/backends/test/suite/tests/__init__.py +0 -0
- executorch/backends/test/suite/tests/test_reporting.py +144 -0
- executorch/backends/transforms/__init__.py +12 -0
- executorch/backends/transforms/addmm_mm_to_linear.py +170 -0
- executorch/backends/transforms/convert_dtype_pass.py +103 -0
- executorch/backends/transforms/decompose_sdpa.py +120 -0
- executorch/backends/transforms/duplicate_dynamic_quant_chain.py +195 -0
- executorch/backends/transforms/fuse_batch_norm_with_conv.py +161 -0
- executorch/backends/transforms/fuse_conv_with_clamp.py +77 -0
- executorch/backends/transforms/fuse_view_copy.py +116 -0
- executorch/backends/transforms/mean_to_sum_div.py +41 -0
- executorch/backends/transforms/rank_0_to_rank_1.py +18 -0
- executorch/backends/transforms/remove_clone_ops.py +109 -0
- executorch/backends/transforms/remove_getitem_op.py +109 -0
- executorch/backends/transforms/replace_scalar_with_tensor.py +93 -0
- executorch/backends/transforms/test/test_create_delete_constant_placeholder.py +122 -0
- executorch/backends/transforms/test/test_create_mutable_buffer.py +503 -0
- executorch/backends/transforms/test/test_duplicate_dynamic_quant_chain.py +184 -0
- executorch/backends/transforms/test/test_rank_0_to_rank_1.py +32 -0
- executorch/backends/transforms/test/test_remove_clone_ops.py +197 -0
- executorch/backends/transforms/utils.py +377 -0
- executorch/backends/transforms/view_copy_to_squeeze_unsqueeze.py +135 -0
- executorch/backends/vulkan/__init__.py +14 -0
- executorch/backends/vulkan/_passes/__init__.py +37 -0
- executorch/backends/vulkan/_passes/fold_qdq.py +40 -0
- executorch/backends/vulkan/_passes/fuse_patterns.py +34 -0
- executorch/backends/vulkan/_passes/fuse_quantized_ops.py +236 -0
- executorch/backends/vulkan/_passes/insert_prepack_nodes.py +83 -0
- executorch/backends/vulkan/_passes/remove_asserts.py +52 -0
- executorch/backends/vulkan/_passes/remove_redundant_ops.py +72 -0
- executorch/backends/vulkan/_passes/squeeze_unsqueeze_inputs.py +93 -0
- executorch/backends/vulkan/_passes/tag_memory_meta_pass.py +485 -0
- executorch/backends/vulkan/custom_ops_lib.py +597 -0
- executorch/backends/vulkan/op_registry.py +885 -0
- executorch/backends/vulkan/partitioner/vulkan_partitioner.py +401 -0
- executorch/backends/vulkan/patterns/__init__.py +139 -0
- executorch/backends/vulkan/patterns/pattern_registry.py +116 -0
- executorch/backends/vulkan/patterns/quantized_binary.py +161 -0
- executorch/backends/vulkan/patterns/quantized_convolution.py +260 -0
- executorch/backends/vulkan/patterns/quantized_linear.py +500 -0
- executorch/backends/vulkan/patterns/rope.py +173 -0
- executorch/backends/vulkan/patterns/sdpa.py +155 -0
- executorch/backends/vulkan/patterns/select_as_symint.py +104 -0
- executorch/backends/vulkan/quantizer/vulkan_quantizer.py +183 -0
- executorch/backends/vulkan/quantizer/vulkan_quantizer_utils.py +223 -0
- executorch/backends/vulkan/runtime/gen_vulkan_spv.py +1517 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_naive_buffer.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_naive_texture3d.yaml +24 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_optimized.yaml +43 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/arange.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/avg_pool2d.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/batchnorm.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_op.yaml +118 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_q8ta_q8ta_q8to.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_scalar_buffer.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_scalar_texture.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/bitw8_image_to_nchw_nobitw8buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/buffer_to_buffer.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/buffer_to_nchw.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/choose_qparams_per_row.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/clone.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/col2im.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/concat_buffer.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/concat_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv1d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_output_tile.yaml +27 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_prepack_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_q8ta_q8csw_q8to.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_sned_output_tile.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_prepack_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_pw.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_pw_q8ta_q8csw_q8to_tiled.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_pw_s1p0.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8csw_linear_tiled.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8ta_q8csw_linear_tiled.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8ta_q8csw_q8to.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8ta_q8csw_q8to_linear_tiled.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv_transpose2d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv_transpose2d_prepack_weights.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/embedding_buffer.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/embedding_legacy.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/embedding_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/expand_buffer.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/flip.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/full.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/gather_buffer.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/gather_texture.yaml +17 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/grid_priors.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/group_norm_reduce_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/group_norm_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/im2col.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/im2col_packed_int8.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/image_to_nchw.yaml +38 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/index_select.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/index_select_channel.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_dq8ca_q4gsw_tiled.yaml +29 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q4gsw_coop.yaml +43 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q4gsw_tiled.yaml +28 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q8csw_tiled.yaml +28 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q8ta_q8csw_tiled.yaml +24 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_coop.yaml +38 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_tiled.yaml +54 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/max_pool2d.yaml +17 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/native_layer_norm.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/nchw_to_bitw8_image_nobitw8buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/nchw_to_buffer.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/nchw_to_image.yaml +37 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/no_op.yaml +24 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_int4_linear_weight_transposed_interleaved.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q4_linear_weight.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q8_conv2d_dw_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q8_conv2d_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q8_linear_weight.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pad_channel.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pad_height_width.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/permute_buffer.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/permute_texture.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_4h4w.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_4h4w_with_group_sums.yaml +30 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_4w4c.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_im2col.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/reduce.yaml +29 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/reduce2d.yaml +29 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/reduce_per_row_buffer.yaml +42 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/repeat.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/repeat_channel.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/repeat_interleave.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/rotary_embedding.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/scalar_tensor.yaml +27 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_attn_weights_softmax.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_attn_weights_coop.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_attn_weights_tiled.yaml +26 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_out_coop.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_out_tiled.yaml +26 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_kv_cache_update.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/set_zero.yaml +8 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/softmax.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/split_buffer.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/split_texture.yaml +17 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/tan.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/transfer_buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/transfer_texture.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/unary_op.yaml +48 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/unpack_4w4c_and_dequantize.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/update_concat_offset.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/upsample_2d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/var_buffer.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/var_texture3d.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/view.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/view_buffer.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/view_convert_buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/where.yaml +12 -0
- executorch/backends/vulkan/serialization/schema.fbs +158 -0
- executorch/backends/vulkan/serialization/vulkan_graph_builder.py +505 -0
- executorch/backends/vulkan/serialization/vulkan_graph_schema.py +161 -0
- executorch/backends/vulkan/serialization/vulkan_graph_serialize.py +274 -0
- executorch/backends/vulkan/test/custom_ops/glsl/add.yaml +29 -0
- executorch/backends/vulkan/test/glsl/all_shaders.yaml +68 -0
- executorch/backends/vulkan/test/glsl/dynamic_dispatch_test.yaml +7 -0
- executorch/backends/vulkan/test/glsl/reference_matmul_common.yaml +9 -0
- executorch/backends/vulkan/test/op_tests/cases.py +2026 -0
- executorch/backends/vulkan/test/op_tests/generate_op_benchmarks.py +88 -0
- executorch/backends/vulkan/test/op_tests/generate_op_correctness_tests.py +90 -0
- executorch/backends/vulkan/test/op_tests/utils/aten_types.py +31 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_benchmark_vk.py +350 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_computegraph.py +788 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_correctness_base.py +421 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_correctness_vk.py +164 -0
- executorch/backends/vulkan/test/op_tests/utils/test_suite.py +53 -0
- executorch/backends/vulkan/test/test_serialization.py +135 -0
- executorch/backends/vulkan/test/test_vulkan_delegate.py +2696 -0
- executorch/backends/vulkan/test/test_vulkan_delegate_header.py +104 -0
- executorch/backends/vulkan/test/test_vulkan_passes.py +193 -0
- executorch/backends/vulkan/test/tester.py +91 -0
- executorch/backends/vulkan/test/utils.py +1111 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/apiconventions.py +21 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/base_generator.py +937 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/cgenerator.py +549 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/generator.py +1424 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/parse_dependency.py +404 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/reg.py +1885 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/spec_tools/conventions.py +562 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/spec_tools/util.py +58 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/stripAPI.py +42 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/vkconventions.py +314 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/vulkan_object.py +484 -0
- executorch/backends/vulkan/third-party/VulkanMemoryAllocator/tools/GpuMemDumpVis/GpuMemDumpVis.py +333 -0
- executorch/backends/vulkan/third-party/volk/generate.py +212 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/buf_bandwidth.yaml +18 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/buf_cacheline_size.yaml +12 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/reg_count.yaml +16 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/tex_bandwidth.yaml +15 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/tex_cacheline_concurr.yaml +14 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/warp_size.yaml +16 -0
- executorch/backends/vulkan/utils.py +1474 -0
- executorch/backends/vulkan/vulkan_preprocess.py +249 -0
- executorch/backends/xnnpack/__init__.py +34 -0
- executorch/backends/xnnpack/_passes/__init__.py +109 -0
- executorch/backends/xnnpack/_passes/channels_last_tagged_reshape_pass.py +561 -0
- executorch/backends/xnnpack/_passes/conv1d_unsqueeze_pass.py +203 -0
- executorch/backends/xnnpack/_passes/convert_to_linear.py +198 -0
- executorch/backends/xnnpack/_passes/convert_to_sdpa.py +114 -0
- executorch/backends/xnnpack/_passes/convert_to_upsample_bilinear2d.py +65 -0
- executorch/backends/xnnpack/_passes/decompose_cat.py +105 -0
- executorch/backends/xnnpack/_passes/fuse_activation_pass.py +87 -0
- executorch/backends/xnnpack/_passes/fuse_batch_norm.py +261 -0
- executorch/backends/xnnpack/_passes/prelu_reshape_pass.py +75 -0
- executorch/backends/xnnpack/_passes/propagate_custom_meta_pass.py +44 -0
- executorch/backends/xnnpack/_passes/remove_redundant_copy_pass.py +158 -0
- executorch/backends/xnnpack/_passes/xnnpack_pass.py +22 -0
- executorch/backends/xnnpack/operators/__init__.py +61 -0
- executorch/backends/xnnpack/operators/node_visitor.py +758 -0
- executorch/backends/xnnpack/operators/op_abs.py +52 -0
- executorch/backends/xnnpack/operators/op_add.py +77 -0
- executorch/backends/xnnpack/operators/op_addmm.py +70 -0
- executorch/backends/xnnpack/operators/op_avg_pooling2d.py +75 -0
- executorch/backends/xnnpack/operators/op_bmm.py +54 -0
- executorch/backends/xnnpack/operators/op_cat.py +121 -0
- executorch/backends/xnnpack/operators/op_ceiling.py +52 -0
- executorch/backends/xnnpack/operators/op_clamp.py +64 -0
- executorch/backends/xnnpack/operators/op_clone.py +60 -0
- executorch/backends/xnnpack/operators/op_conv2d.py +186 -0
- executorch/backends/xnnpack/operators/op_cos.py +52 -0
- executorch/backends/xnnpack/operators/op_div.py +56 -0
- executorch/backends/xnnpack/operators/op_dynamic_dequantize_ops.py +114 -0
- executorch/backends/xnnpack/operators/op_dynamic_quantize_ops.py +179 -0
- executorch/backends/xnnpack/operators/op_elu.py +56 -0
- executorch/backends/xnnpack/operators/op_exp.py +52 -0
- executorch/backends/xnnpack/operators/op_floor.py +48 -0
- executorch/backends/xnnpack/operators/op_gelu.py +52 -0
- executorch/backends/xnnpack/operators/op_hardswish.py +52 -0
- executorch/backends/xnnpack/operators/op_hardtanh.py +67 -0
- executorch/backends/xnnpack/operators/op_leaky_relu.py +65 -0
- executorch/backends/xnnpack/operators/op_linear.py +110 -0
- executorch/backends/xnnpack/operators/op_log.py +52 -0
- executorch/backends/xnnpack/operators/op_matrix_multiplication.py +66 -0
- executorch/backends/xnnpack/operators/op_max_dim.py +206 -0
- executorch/backends/xnnpack/operators/op_max_pool2d.py +136 -0
- executorch/backends/xnnpack/operators/op_maximum.py +55 -0
- executorch/backends/xnnpack/operators/op_mean_dim.py +78 -0
- executorch/backends/xnnpack/operators/op_minimum.py +54 -0
- executorch/backends/xnnpack/operators/op_multiply.py +84 -0
- executorch/backends/xnnpack/operators/op_negate.py +51 -0
- executorch/backends/xnnpack/operators/op_permute.py +87 -0
- executorch/backends/xnnpack/operators/op_prelu.py +56 -0
- executorch/backends/xnnpack/operators/op_quant_dequant.py +196 -0
- executorch/backends/xnnpack/operators/op_relu.py +61 -0
- executorch/backends/xnnpack/operators/op_rsqrt.py +52 -0
- executorch/backends/xnnpack/operators/op_sigmoid.py +48 -0
- executorch/backends/xnnpack/operators/op_sin.py +52 -0
- executorch/backends/xnnpack/operators/op_skip_ops.py +89 -0
- executorch/backends/xnnpack/operators/op_slice_copy.py +100 -0
- executorch/backends/xnnpack/operators/op_softmax.py +58 -0
- executorch/backends/xnnpack/operators/op_square.py +52 -0
- executorch/backends/xnnpack/operators/op_square_root.py +52 -0
- executorch/backends/xnnpack/operators/op_squeeze.py +145 -0
- executorch/backends/xnnpack/operators/op_static_constant_pad.py +145 -0
- executorch/backends/xnnpack/operators/op_static_resize_bilinear_2d.py +61 -0
- executorch/backends/xnnpack/operators/op_sub.py +77 -0
- executorch/backends/xnnpack/operators/op_tanh.py +52 -0
- executorch/backends/xnnpack/operators/op_to_copy.py +91 -0
- executorch/backends/xnnpack/operators/op_view_copy.py +96 -0
- executorch/backends/xnnpack/operators/quant_params.py +412 -0
- executorch/backends/xnnpack/partition/config/__init__.py +127 -0
- executorch/backends/xnnpack/partition/config/gemm_configs.py +575 -0
- executorch/backends/xnnpack/partition/config/generic_node_configs.py +711 -0
- executorch/backends/xnnpack/partition/config/node_configs.py +148 -0
- executorch/backends/xnnpack/partition/config/quant_affine_configs.py +56 -0
- executorch/backends/xnnpack/partition/config/xnnpack_config.py +252 -0
- executorch/backends/xnnpack/partition/graphs/bilinear_2d.py +55 -0
- executorch/backends/xnnpack/partition/graphs/sdpa.py +86 -0
- executorch/backends/xnnpack/partition/xnnpack_partitioner.py +160 -0
- executorch/backends/xnnpack/quantizer/xnnpack_quantizer.py +462 -0
- executorch/backends/xnnpack/quantizer/xnnpack_quantizer_utils.py +1121 -0
- executorch/backends/xnnpack/recipes/__init__.py +19 -0
- executorch/backends/xnnpack/recipes/xnnpack_recipe_provider.py +200 -0
- executorch/backends/xnnpack/recipes/xnnpack_recipe_types.py +37 -0
- executorch/backends/xnnpack/serialization/runtime_schema.fbs +389 -0
- executorch/backends/xnnpack/serialization/schema.fbs +381 -0
- executorch/backends/xnnpack/serialization/xnnpack_graph_schema.py +542 -0
- executorch/backends/xnnpack/serialization/xnnpack_graph_serialize.py +373 -0
- executorch/backends/xnnpack/test/__init__.py +0 -0
- executorch/backends/xnnpack/test/models/deeplab_v3.py +42 -0
- executorch/backends/xnnpack/test/models/edsr.py +55 -0
- executorch/backends/xnnpack/test/models/emformer_rnnt.py +98 -0
- executorch/backends/xnnpack/test/models/inception_v3.py +84 -0
- executorch/backends/xnnpack/test/models/inception_v4.py +62 -0
- executorch/backends/xnnpack/test/models/llama2_et_example.py +49 -0
- executorch/backends/xnnpack/test/models/mobilebert.py +55 -0
- executorch/backends/xnnpack/test/models/mobilenet_v2.py +103 -0
- executorch/backends/xnnpack/test/models/mobilenet_v3.py +84 -0
- executorch/backends/xnnpack/test/models/resnet.py +90 -0
- executorch/backends/xnnpack/test/models/torchvision_vit.py +105 -0
- executorch/backends/xnnpack/test/models/very_big_model.py +45 -0
- executorch/backends/xnnpack/test/models/w2l.py +60 -0
- executorch/backends/xnnpack/test/ops/test_abs.py +87 -0
- executorch/backends/xnnpack/test/ops/test_add.py +266 -0
- executorch/backends/xnnpack/test/ops/test_avgpool2d.py +92 -0
- executorch/backends/xnnpack/test/ops/test_bilinear2d.py +152 -0
- executorch/backends/xnnpack/test/ops/test_bmm.py +49 -0
- executorch/backends/xnnpack/test/ops/test_cat.py +254 -0
- executorch/backends/xnnpack/test/ops/test_ceil.py +63 -0
- executorch/backends/xnnpack/test/ops/test_check_quant_params.py +107 -0
- executorch/backends/xnnpack/test/ops/test_clamp.py +79 -0
- executorch/backends/xnnpack/test/ops/test_clone.py +137 -0
- executorch/backends/xnnpack/test/ops/test_conv1d.py +190 -0
- executorch/backends/xnnpack/test/ops/test_conv2d.py +747 -0
- executorch/backends/xnnpack/test/ops/test_cos.py +87 -0
- executorch/backends/xnnpack/test/ops/test_div.py +78 -0
- executorch/backends/xnnpack/test/ops/test_elu.py +98 -0
- executorch/backends/xnnpack/test/ops/test_exp.py +70 -0
- executorch/backends/xnnpack/test/ops/test_floor.py +58 -0
- executorch/backends/xnnpack/test/ops/test_gelu.py +71 -0
- executorch/backends/xnnpack/test/ops/test_hardswish.py +70 -0
- executorch/backends/xnnpack/test/ops/test_hardtanh.py +83 -0
- executorch/backends/xnnpack/test/ops/test_leaky_relu.py +131 -0
- executorch/backends/xnnpack/test/ops/test_linear.py +1059 -0
- executorch/backends/xnnpack/test/ops/test_log.py +45 -0
- executorch/backends/xnnpack/test/ops/test_lstm.py +67 -0
- executorch/backends/xnnpack/test/ops/test_max_dim.py +66 -0
- executorch/backends/xnnpack/test/ops/test_maximum.py +66 -0
- executorch/backends/xnnpack/test/ops/test_maxpool2d.py +221 -0
- executorch/backends/xnnpack/test/ops/test_mean_dim.py +98 -0
- executorch/backends/xnnpack/test/ops/test_minimum.py +49 -0
- executorch/backends/xnnpack/test/ops/test_multiply.py +149 -0
- executorch/backends/xnnpack/test/ops/test_negate.py +58 -0
- executorch/backends/xnnpack/test/ops/test_permute.py +134 -0
- executorch/backends/xnnpack/test/ops/test_pow.py +62 -0
- executorch/backends/xnnpack/test/ops/test_prelu.py +50 -0
- executorch/backends/xnnpack/test/ops/test_quantize_per_tensor.py +70 -0
- executorch/backends/xnnpack/test/ops/test_relu.py +38 -0
- executorch/backends/xnnpack/test/ops/test_rsqrt.py +45 -0
- executorch/backends/xnnpack/test/ops/test_sigmoid.py +45 -0
- executorch/backends/xnnpack/test/ops/test_sin.py +87 -0
- executorch/backends/xnnpack/test/ops/test_slice_copy.py +170 -0
- executorch/backends/xnnpack/test/ops/test_softmax.py +73 -0
- executorch/backends/xnnpack/test/ops/test_sqrt.py +45 -0
- executorch/backends/xnnpack/test/ops/test_square.py +48 -0
- executorch/backends/xnnpack/test/ops/test_static_constant_pad.py +294 -0
- executorch/backends/xnnpack/test/ops/test_sub.py +178 -0
- executorch/backends/xnnpack/test/ops/test_tanh.py +43 -0
- executorch/backends/xnnpack/test/ops/test_to_copy.py +113 -0
- executorch/backends/xnnpack/test/passes/__init__.py +0 -0
- executorch/backends/xnnpack/test/passes/test_activation_fusion.py +232 -0
- executorch/backends/xnnpack/test/passes/test_batch_norm_fusion.py +179 -0
- executorch/backends/xnnpack/test/passes/test_channels_last_tagged_reshape.py +635 -0
- executorch/backends/xnnpack/test/passes/test_convert_to_linear.py +43 -0
- executorch/backends/xnnpack/test/passes/test_decompose_cat_pass.py +112 -0
- executorch/backends/xnnpack/test/passes/test_propagate_custom_meta_pass.py +185 -0
- executorch/backends/xnnpack/test/passes/test_remove_get_item_pass.py +99 -0
- executorch/backends/xnnpack/test/passes/test_remove_redundant_copy_pass.py +182 -0
- executorch/backends/xnnpack/test/quantizer/test_pt2e_quantization.py +818 -0
- executorch/backends/xnnpack/test/quantizer/test_representation.py +308 -0
- executorch/backends/xnnpack/test/quantizer/test_xnnpack_quantizer.py +1217 -0
- executorch/backends/xnnpack/test/recipes/test_xnnpack_recipes.py +320 -0
- executorch/backends/xnnpack/test/serialization/test_serialization.py +50 -0
- executorch/backends/xnnpack/test/serialization/test_xnnheader.py +104 -0
- executorch/backends/xnnpack/test/test_xnnpack_partitioner.py +163 -0
- executorch/backends/xnnpack/test/test_xnnpack_utils.py +532 -0
- executorch/backends/xnnpack/test/test_xnnpack_utils_classes.py +44 -0
- executorch/backends/xnnpack/test/tester/__init__.py +29 -0
- executorch/backends/xnnpack/test/tester/tester.py +130 -0
- executorch/backends/xnnpack/third-party/FP16/configure.py +65 -0
- executorch/backends/xnnpack/third-party/FP16/confu.yaml +8 -0
- executorch/backends/xnnpack/third-party/FP16/include/fp16/__init__.py +0 -0
- executorch/backends/xnnpack/third-party/FP16/include/fp16/avx.py +50 -0
- executorch/backends/xnnpack/third-party/FP16/include/fp16/avx2.py +53 -0
- executorch/backends/xnnpack/third-party/FP16/test/peachpy/stubs.py +38 -0
- executorch/backends/xnnpack/third-party/FXdiv/configure.py +30 -0
- executorch/backends/xnnpack/third-party/FXdiv/confu.yaml +6 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/aarch32_template.py +361 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/aarch64_template.py +347 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/arm_template.py +78 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/avx512bf16_template.py +81 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/avx512f_template.py +390 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/avx512vnni_template.py +703 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/base_architecture.py +276 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/fma3_template.py +260 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate.py +71 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_bf16_f32_gemm_microkernels.py +39 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_f32_gemm_microkernels.py +104 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_gemm_microkernels_main.py +29 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qd8_f32_qc4w_gemm_microkernels.py +69 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qd8_f32_qc8w_gemm_microkernels.py +93 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qs8_qc4w_gemm_microkernels.py +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qs8_qc8w_gemm_microkernels.py +43 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/neondot_template.py +463 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/neonfma_template.py +248 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/neonmlal_aarch32_template.py +394 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/x64_template.py +512 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/check_config.py +152 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/check_files_changed.py +53 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/generate-build-identifier.py +106 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/sort-filenames.py +134 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/bf16-f32-gemm-minmax.yaml +121 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/bf16-gemm-minmax.yaml +106 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-conv-hwc2chw.yaml +8 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-dwconv2d-chw.yaml +88 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32acc-gemm-minmax.yaml +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32acc-igemm-minmax.yaml +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-gemm-minmax.yaml +219 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-ibilinear-chw.yaml +9 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-ibilinear.yaml +12 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-igemm-minmax.yaml +165 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-raddstoreexpminusmax.yaml +52 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-argmaxpool.yaml +15 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-conv-hwc2chw.yaml +32 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-dwconv2d-chw.yaml +712 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-minmax.yaml +1572 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-relu.yaml +123 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm.yaml +127 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ibilinear-chw.yaml +22 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ibilinear.yaml +23 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm-minmax.yaml +1001 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm-relu.yaml +123 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm.yaml +123 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ppmm-minmax.yaml +122 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc4w-gemm-minmax.yaml +277 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm-minmax.yaml +757 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm-relu.yaml +67 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm.yaml +115 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-raddexpminusmax.yaml +38 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-raddstoreexpminusmax.yaml +88 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/pf16-gemm-minmax.yaml +20 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/pf32-gemm-minmax.yaml +34 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/pqs8-qc8w-gemm-minmax.yaml +20 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qb4w-gemm-minmax.yaml +260 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc4w-gemm-minmax.yaml +678 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc8w-gemm-minmax.yaml +412 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc8w-igemm-minmax.yaml +360 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qb4w-gemm-minmax.yaml +537 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc4w-gemm-minmax.yaml +2176 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc8w-gemm-minmax.yaml +1564 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc8w-igemm-minmax.yaml +1035 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qp8-f32-qb4w-gemm-minmax.yaml +54 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qp8-f32-qc4w-gemm-minmax.yaml +66 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qp8-f32-qc8w-gemm-minmax.yaml +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc4w-gemm-minmax-fp32.yaml +345 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-gemm-minmax-fp32.yaml +2029 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-igemm-minmax-fp32.yaml +1831 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gemm-minmax-fp32.yaml +584 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gemm-minmax-rndnu.yaml +148 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-igemm-minmax-fp32.yaml +581 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-igemm-minmax-rndnu.yaml +110 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/s8-ibilinear.yaml +22 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/u8-ibilinear.yaml +22 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/x8-lut.yaml +47 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-argmaxpool-test.py +692 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-conv-hwc-test.py +543 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-conv-hwc2chw-test.py +591 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-dwconv-test.py +339 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-dwconv2d-chw-test.py +463 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-gemm-test.py +1150 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-ibilinear-chw-test.py +236 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-ibilinear-test.py +237 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-lut-test.py +164 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-raddexpminusmax-test.py +159 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-raddstoreexpminusmax-test.py +210 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-reduce-discontiguous-test.py +495 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-reduce-test.py +289 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-spmm-test.py +554 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vbinary-test.py +179 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vunary-test.py +280 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/parse-microkernel-bench.py +189 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/primes.py +1015 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/update-microkernels.py +567 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/xngen.py +159 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/xnncommon.py +275 -0
- executorch/backends/xnnpack/third-party/cpuinfo/configure.py +110 -0
- executorch/backends/xnnpack/third-party/cpuinfo/confu.yaml +9 -0
- executorch/backends/xnnpack/third-party/cpuinfo/deps/clog/configure.py +26 -0
- executorch/backends/xnnpack/third-party/cpuinfo/deps/clog/confu.yaml +5 -0
- executorch/backends/xnnpack/third-party/cpuinfo/scripts/android-device-dump.py +400 -0
- executorch/backends/xnnpack/third-party/cpuinfo/scripts/arm-linux-filesystem-dump.py +107 -0
- executorch/backends/xnnpack/third-party/cpuinfo/scripts/parse-x86-cpuid-dump.py +47 -0
- executorch/backends/xnnpack/third-party/generate-cpuinfo-wrappers.py +93 -0
- executorch/backends/xnnpack/third-party/pthreadpool/configure.py +38 -0
- executorch/backends/xnnpack/third-party/pthreadpool/confu.yaml +8 -0
- executorch/backends/xnnpack/utils/configs.py +49 -0
- executorch/backends/xnnpack/utils/quant_utils.py +301 -0
- executorch/backends/xnnpack/utils/utils.py +221 -0
- executorch/backends/xnnpack/utils/xnnpack_constants.py +37 -0
- executorch/backends/xnnpack/xnnpack_preprocess.py +194 -0
- executorch/codegen/__init__.py +0 -0
- executorch/codegen/api/__init__.py +0 -0
- executorch/codegen/api/custom_ops.py +151 -0
- executorch/codegen/api/et_cpp.py +368 -0
- executorch/codegen/api/types/__init__.py +5 -0
- executorch/codegen/api/types/signatures.py +77 -0
- executorch/codegen/api/types/types.py +77 -0
- executorch/codegen/api/unboxing.py +232 -0
- executorch/codegen/gen.py +1049 -0
- executorch/codegen/model.py +220 -0
- executorch/codegen/parse.py +158 -0
- executorch/codegen/test/test_executorch_custom_ops.py +153 -0
- executorch/codegen/test/test_executorch_gen.py +698 -0
- executorch/codegen/test/test_executorch_signatures.py +65 -0
- executorch/codegen/test/test_executorch_types.py +121 -0
- executorch/codegen/test/test_executorch_unboxing.py +165 -0
- executorch/codegen/test/test_selective_build.py +51 -0
- executorch/codegen/tools/__init__.py +0 -0
- executorch/codegen/tools/combine_prim_ops_headers.py +164 -0
- executorch/codegen/tools/gen_all_oplist.py +252 -0
- executorch/codegen/tools/gen_oplist.py +369 -0
- executorch/codegen/tools/gen_ops_def.py +96 -0
- executorch/codegen/tools/gen_selected_op_variants.py +133 -0
- executorch/codegen/tools/gen_selected_prim_ops.py +96 -0
- executorch/codegen/tools/merge_yaml.py +125 -0
- executorch/codegen/tools/selective_build.cp313-win_amd64.pyd +0 -0
- executorch/codegen/tools/selective_build.pyi +23 -0
- executorch/codegen/tools/test/test_gen_all_oplist.py +122 -0
- executorch/codegen/tools/test/test_gen_oplist.py +263 -0
- executorch/codegen/tools/test/test_gen_oplist_real_model.py +50 -0
- executorch/codegen/tools/test/test_gen_selected_op_variants.py +204 -0
- executorch/codegen/tools/test/test_tools_selective_build.py +129 -0
- executorch/codegen/tools/yaml_util.py +15 -0
- executorch/data/bin/__init__.py +44 -0
- executorch/data/bin/flatc.exe +0 -0
- executorch/data/lib/aoti_cuda_shims.lib +0 -0
- executorch/devtools/__init__.py +19 -0
- executorch/devtools/backend_debug/__init__.py +13 -0
- executorch/devtools/backend_debug/delegation_info.py +183 -0
- executorch/devtools/backend_debug/tests/test_delegation_info.py +79 -0
- executorch/devtools/bundled_program/config.py +120 -0
- executorch/devtools/bundled_program/core.py +395 -0
- executorch/devtools/bundled_program/schema/__init__.py +9 -0
- executorch/devtools/bundled_program/schema/bundled_program_schema.fbs +97 -0
- executorch/devtools/bundled_program/schema/bundled_program_schema.py +99 -0
- executorch/devtools/bundled_program/schema/scalar_type.fbs +43 -0
- executorch/devtools/bundled_program/schema/test/test_schema.py +27 -0
- executorch/devtools/bundled_program/serialize/__init__.py +122 -0
- executorch/devtools/bundled_program/serialize/bundled_program_schema.fbs +97 -0
- executorch/devtools/bundled_program/serialize/scalar_type.fbs +43 -0
- executorch/devtools/bundled_program/serialize/test/test_serialize.py +37 -0
- executorch/devtools/bundled_program/test/test_bundle_data.py +168 -0
- executorch/devtools/bundled_program/test/test_config.py +131 -0
- executorch/devtools/bundled_program/test/test_end2end.py +64 -0
- executorch/devtools/bundled_program/util/test_util.py +289 -0
- executorch/devtools/bundled_program/version.py +13 -0
- executorch/devtools/debug_format/base_schema.py +61 -0
- executorch/devtools/debug_format/et_schema.py +432 -0
- executorch/devtools/etdump/etdump_schema_flatcc.fbs +181 -0
- executorch/devtools/etdump/scalar_type.fbs +43 -0
- executorch/devtools/etdump/schema_flatcc.py +154 -0
- executorch/devtools/etdump/serialize.py +108 -0
- executorch/devtools/etdump/tests/serialize_test.py +142 -0
- executorch/devtools/etrecord/__init__.py +13 -0
- executorch/devtools/etrecord/_etrecord.py +776 -0
- executorch/devtools/etrecord/tests/etrecord_test.py +1748 -0
- executorch/devtools/inspector/__init__.py +24 -0
- executorch/devtools/inspector/_inspector.py +1495 -0
- executorch/devtools/inspector/_inspector_utils.py +1286 -0
- executorch/devtools/inspector/_intermediate_output_capturer.py +62 -0
- executorch/devtools/inspector/inspector_cli.py +76 -0
- executorch/devtools/inspector/numerical_comparator/__init__.py +25 -0
- executorch/devtools/inspector/numerical_comparator/l1_numerical_comparator.py +27 -0
- executorch/devtools/inspector/numerical_comparator/mse_numerical_comparator.py +29 -0
- executorch/devtools/inspector/numerical_comparator/numerical_comparator_base.py +26 -0
- executorch/devtools/inspector/numerical_comparator/snr_numerical_comparator.py +39 -0
- executorch/devtools/inspector/tests/event_blocks_test.py +657 -0
- executorch/devtools/inspector/tests/inspector_test.py +1263 -0
- executorch/devtools/inspector/tests/inspector_test_utils.py +189 -0
- executorch/devtools/inspector/tests/inspector_utils_test.py +896 -0
- executorch/devtools/inspector/tests/intermediate_output_capturer_test.py +101 -0
- executorch/devtools/inspector/tests/l1_comparator_test.py +49 -0
- executorch/devtools/inspector/tests/mse_comparator_test.py +49 -0
- executorch/devtools/inspector/tests/snr_comparator_test.py +52 -0
- executorch/devtools/scripts/generate_profiling_csv.py +62 -0
- executorch/devtools/size_analysis_tool/size_analysis_tool.py +180 -0
- executorch/devtools/size_analysis_tool/size_analysis_tool_test.py +101 -0
- executorch/devtools/visualization/__init__.py +13 -0
- executorch/devtools/visualization/visualization_utils.py +301 -0
- executorch/devtools/visualization/visualization_utils_test.py +177 -0
- executorch/examples/apple/coreml/llama/export.py +224 -0
- executorch/examples/apple/coreml/llama/export_static_llm_coreml.py +504 -0
- executorch/examples/apple/coreml/llama/llama_transformer.py +958 -0
- executorch/examples/apple/coreml/llama/run.py +206 -0
- executorch/examples/apple/coreml/llama/run_lookahead.py +284 -0
- executorch/examples/apple/coreml/llama/run_static_llm.py +293 -0
- executorch/examples/apple/coreml/llama/test.py +48 -0
- executorch/examples/apple/coreml/llama/utils.py +116 -0
- executorch/examples/apple/coreml/scripts/debugger_cli.py +181 -0
- executorch/examples/apple/coreml/scripts/export.py +280 -0
- executorch/examples/apple/coreml/scripts/extract_coreml_models.py +77 -0
- executorch/examples/apple/coreml/scripts/inspector_cli.py +64 -0
- executorch/examples/apple/coreml/scripts/inspector_utils.py +425 -0
- executorch/examples/apple/mps/scripts/bench_utils.py +108 -0
- executorch/examples/apple/mps/scripts/mps_example.py +230 -0
- executorch/examples/cuda/scripts/__init__.py +0 -0
- executorch/examples/cuda/scripts/export.py +107 -0
- executorch/examples/llm_pte_finetuning/__init__.py +19 -0
- executorch/examples/llm_pte_finetuning/llama3_config.yaml +96 -0
- executorch/examples/llm_pte_finetuning/model_exporter.py +87 -0
- executorch/examples/llm_pte_finetuning/model_loading_lib.py +143 -0
- executorch/examples/llm_pte_finetuning/phi3_alpaca_code_config.yaml +44 -0
- executorch/examples/llm_pte_finetuning/phi3_config.yaml +42 -0
- executorch/examples/llm_pte_finetuning/qwen_05b_config.yaml +43 -0
- executorch/examples/llm_pte_finetuning/runner.py +135 -0
- executorch/examples/llm_pte_finetuning/training_lib.py +157 -0
- executorch/examples/models/__init__.py +98 -0
- executorch/examples/models/checkpoint.py +114 -0
- executorch/examples/models/codegen/__init__.py +16 -0
- executorch/examples/models/codegen/convert_weight.py +93 -0
- executorch/examples/models/deeplab_v3/__init__.py +9 -0
- executorch/examples/models/deeplab_v3/model.py +50 -0
- executorch/examples/models/deepseek-r1-distill-llama-8B/config/deepseek_xnnpack_q8da4w.yaml +16 -0
- executorch/examples/models/deit_tiny/__init__.py +8 -0
- executorch/examples/models/deit_tiny/model.py +36 -0
- executorch/examples/models/edsr/__init__.py +11 -0
- executorch/examples/models/edsr/model.py +28 -0
- executorch/examples/models/efficient_sam/__init__.py +11 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/build_efficient_sam.py +25 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/efficient_sam.py +316 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/efficient_sam_decoder.py +373 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/efficient_sam_encoder.py +261 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/mlp.py +31 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/two_way_transformer.py +268 -0
- executorch/examples/models/efficient_sam/model.py +34 -0
- executorch/examples/models/emformer_rnnt/__init__.py +17 -0
- executorch/examples/models/emformer_rnnt/model.py +132 -0
- executorch/examples/models/gemma/__init__.py +16 -0
- executorch/examples/models/gemma/convert_weights.py +104 -0
- executorch/examples/models/gemma2/__init__.py +19 -0
- executorch/examples/models/gemma2/convert_weights.py +113 -0
- executorch/examples/models/gemma3/__init__.py +16 -0
- executorch/examples/models/gemma3/convert_weights.py +110 -0
- executorch/examples/models/glm/__init__.py +16 -0
- executorch/examples/models/glm/convert_weights.py +79 -0
- executorch/examples/models/granite/__init__.py +16 -0
- executorch/examples/models/granite/convert_weights.py +106 -0
- executorch/examples/models/inception_v3/__init__.py +11 -0
- executorch/examples/models/inception_v3/model.py +28 -0
- executorch/examples/models/inception_v4/__init__.py +11 -0
- executorch/examples/models/inception_v4/model.py +26 -0
- executorch/examples/models/internvl3/__init__.py +16 -0
- executorch/examples/models/internvl3/convert_weights.py +82 -0
- executorch/examples/models/lfm2/__init__.py +10 -0
- executorch/examples/models/lfm2/config/lfm2_xnnpack_fp32.yaml +12 -0
- executorch/examples/models/lfm2/config/lfm2_xnnpack_q8da4w.yaml +15 -0
- executorch/examples/models/lfm2/convert_weights.py +74 -0
- executorch/examples/models/lfm2/short_conv.py +112 -0
- executorch/examples/models/llama/__init__.py +11 -0
- executorch/examples/models/llama/attention.py +536 -0
- executorch/examples/models/llama/config/llama_bf16.yaml +7 -0
- executorch/examples/models/llama/config/llama_q8da4w.yaml +11 -0
- executorch/examples/models/llama/config/llama_xnnpack.yaml +17 -0
- executorch/examples/models/llama/config/llama_xnnpack_qat.yaml +23 -0
- executorch/examples/models/llama/config/llama_xnnpack_spinquant.yaml +22 -0
- executorch/examples/models/llama/config/test_llm_config.py +104 -0
- executorch/examples/models/llama/convert_weights.py +61 -0
- executorch/examples/models/llama/eval_llama.py +38 -0
- executorch/examples/models/llama/eval_llama_lib.py +395 -0
- executorch/examples/models/llama/evaluate/__init__.py +11 -0
- executorch/examples/models/llama/evaluate/eager_eval.py +87 -0
- executorch/examples/models/llama/experimental/__init__.py +0 -0
- executorch/examples/models/llama/experimental/generate.py +190 -0
- executorch/examples/models/llama/experimental/load_gguf_q4_0.py +184 -0
- executorch/examples/models/llama/experimental/subclass.py +413 -0
- executorch/examples/models/llama/experimental/test_subclass.py +28 -0
- executorch/examples/models/llama/export_llama.py +56 -0
- executorch/examples/models/llama/export_llama_lib.py +1560 -0
- executorch/examples/models/llama/fairseq2.py +63 -0
- executorch/examples/models/llama/feed_forward.py +68 -0
- executorch/examples/models/llama/hf_download.py +50 -0
- executorch/examples/models/llama/install_requirement_helper.py +29 -0
- executorch/examples/models/llama/llama_transformer.py +289 -0
- executorch/examples/models/llama/lora.py +48 -0
- executorch/examples/models/llama/model.py +378 -0
- executorch/examples/models/llama/model_args.py +173 -0
- executorch/examples/models/llama/norm.py +55 -0
- executorch/examples/models/llama/rope.py +327 -0
- executorch/examples/models/llama/runner/eager.py +142 -0
- executorch/examples/models/llama/runner/generation.py +234 -0
- executorch/examples/models/llama/runner/native.py +145 -0
- executorch/examples/models/llama/source_transformation/__init__.py +0 -0
- executorch/examples/models/llama/source_transformation/apply_spin_quant_r1_r2.py +202 -0
- executorch/examples/models/llama/source_transformation/attention.py +223 -0
- executorch/examples/models/llama/source_transformation/attention_sink.py +312 -0
- executorch/examples/models/llama/source_transformation/custom_kv_cache.py +598 -0
- executorch/examples/models/llama/source_transformation/lora.py +153 -0
- executorch/examples/models/llama/source_transformation/pre_quantization.py +204 -0
- executorch/examples/models/llama/source_transformation/prune_vocab.py +119 -0
- executorch/examples/models/llama/source_transformation/quantize.py +910 -0
- executorch/examples/models/llama/source_transformation/rms_norm.py +23 -0
- executorch/examples/models/llama/source_transformation/rope.py +39 -0
- executorch/examples/models/llama/source_transformation/sdpa.py +550 -0
- executorch/examples/models/llama/source_transformation/spin_quant.py +88 -0
- executorch/examples/models/llama/source_transformation/test_attention_sink.py +514 -0
- executorch/examples/models/llama/source_transformation/test_quantized_kv_cache.py +126 -0
- executorch/examples/models/llama/source_transformation/test_quantized_sdpa.py +167 -0
- executorch/examples/models/llama/source_transformation/test_sdpa_with_quantized_kv_cache.py +97 -0
- executorch/examples/models/llama/static_attention.py +1257 -0
- executorch/examples/models/llama/tests/test_export_llama_lib.py +50 -0
- executorch/examples/models/llama/tests/test_pre_quantization_transforms.py +188 -0
- executorch/examples/models/llama/tests/test_replace_kv_cache.py +158 -0
- executorch/examples/models/llama/tests/test_ring_attention.py +359 -0
- executorch/examples/models/llama/tests/test_ring_kv_cache.py +492 -0
- executorch/examples/models/llama/tests/test_simple_sdpa.py +66 -0
- executorch/examples/models/llama/tests/test_static_attention.py +363 -0
- executorch/examples/models/llama/tokenizer/tiktoken.py +224 -0
- executorch/examples/models/llama3_2_vision/__init__.py +14 -0
- executorch/examples/models/llama3_2_vision/preprocess/__init__.py +0 -0
- executorch/examples/models/llama3_2_vision/preprocess/export_preprocess.py +45 -0
- executorch/examples/models/llama3_2_vision/preprocess/model.py +72 -0
- executorch/examples/models/llama3_2_vision/preprocess/test_preprocess.py +338 -0
- executorch/examples/models/llama3_2_vision/runner/eager.py +59 -0
- executorch/examples/models/llama3_2_vision/runner/exported.py +94 -0
- executorch/examples/models/llama3_2_vision/runner/generation.py +102 -0
- executorch/examples/models/llama3_2_vision/runner/native.py +143 -0
- executorch/examples/models/llama3_2_vision/text_decoder/model.py +199 -0
- executorch/examples/models/llama3_2_vision/text_decoder/test/__init__.py +0 -0
- executorch/examples/models/llama3_2_vision/text_decoder/test/test_text_decoder.py +89 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/__init__.py +12 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/model.py +96 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/test/__init__.py +0 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/test/test_vision_encoder.py +46 -0
- executorch/examples/models/llava/__init__.py +11 -0
- executorch/examples/models/llava/export_llava.py +365 -0
- executorch/examples/models/llava/model.py +415 -0
- executorch/examples/models/llava/test/test_llava.py +151 -0
- executorch/examples/models/llava/test/test_pte.py +106 -0
- executorch/examples/models/lstm/__init__.py +12 -0
- executorch/examples/models/lstm/model.py +31 -0
- executorch/examples/models/mobilebert/__init__.py +11 -0
- executorch/examples/models/mobilebert/model.py +31 -0
- executorch/examples/models/mobilenet_v2/__init__.py +12 -0
- executorch/examples/models/mobilenet_v2/model.py +73 -0
- executorch/examples/models/mobilenet_v3/__init__.py +11 -0
- executorch/examples/models/mobilenet_v3/model.py +30 -0
- executorch/examples/models/model_base.py +47 -0
- executorch/examples/models/model_factory.py +60 -0
- executorch/examples/models/moshi/mimi/test_mimi.py +245 -0
- executorch/examples/models/parakeet/export_parakeet_tdt.py +591 -0
- executorch/examples/models/phi-3-mini/__init__.py +11 -0
- executorch/examples/models/phi-3-mini-lora/export_model.py +144 -0
- executorch/examples/models/phi_4_mini/__init__.py +16 -0
- executorch/examples/models/phi_4_mini/config/phi_4_mini_xnnpack.yaml +12 -0
- executorch/examples/models/phi_4_mini/convert_weights.py +151 -0
- executorch/examples/models/qwen2_5/__init__.py +16 -0
- executorch/examples/models/qwen2_5/config/qwen2_5_xnnpack_q8da4w.yaml +14 -0
- executorch/examples/models/qwen2_5/convert_weights.py +90 -0
- executorch/examples/models/qwen3/__init__.py +16 -0
- executorch/examples/models/qwen3/config/qwen3_xnnpack.yaml +18 -0
- executorch/examples/models/qwen3/config/qwen3_xnnpack_q8da4w.yaml +20 -0
- executorch/examples/models/qwen3/convert_weights.py +140 -0
- executorch/examples/models/resnet/__init__.py +12 -0
- executorch/examples/models/resnet/model.py +48 -0
- executorch/examples/models/smollm2/__init__.py +16 -0
- executorch/examples/models/smollm2/convert_weights.py +84 -0
- executorch/examples/models/smollm3/__init__.py +16 -0
- executorch/examples/models/smollm3/convert_weights.py +112 -0
- executorch/examples/models/smolvlm/__init__.py +16 -0
- executorch/examples/models/smolvlm/convert_weights.py +77 -0
- executorch/examples/models/stable_diffusion/__init__.py +9 -0
- executorch/examples/models/stable_diffusion/model.py +193 -0
- executorch/examples/models/test/__init__.py +0 -0
- executorch/examples/models/test/test_export.py +161 -0
- executorch/examples/models/torchvision_vit/__init__.py +11 -0
- executorch/examples/models/torchvision_vit/model.py +28 -0
- executorch/examples/models/toy_model/__init__.py +25 -0
- executorch/examples/models/toy_model/model.py +143 -0
- executorch/examples/models/wav2letter/__init__.py +11 -0
- executorch/examples/models/wav2letter/model.py +29 -0
- executorch/examples/models/yolo12/export_and_validate.py +397 -0
- executorch/examples/nxp/experimental/cifar_net/cifar_net.py +270 -0
- executorch/examples/xnnpack/__init__.py +51 -0
- executorch/examples/xnnpack/aot_compiler.py +148 -0
- executorch/examples/xnnpack/quantization/example.py +205 -0
- executorch/examples/xnnpack/quantization/utils.py +42 -0
- executorch/exir/__init__.py +57 -0
- executorch/exir/_serialize/__init__.py +20 -0
- executorch/exir/_serialize/_cord.py +49 -0
- executorch/exir/_serialize/_dataclass.py +145 -0
- executorch/exir/_serialize/_flatbuffer.py +357 -0
- executorch/exir/_serialize/_named_data_store.py +222 -0
- executorch/exir/_serialize/_program.py +767 -0
- executorch/exir/_serialize/_serialize.py +123 -0
- executorch/exir/_serialize/data_serializer.py +80 -0
- executorch/exir/_serialize/padding.py +39 -0
- executorch/exir/_serialize/program.fbs +489 -0
- executorch/exir/_serialize/scalar_type.fbs +43 -0
- executorch/exir/_serialize/test/__init__.py +0 -0
- executorch/exir/_serialize/test/test_cord.py +63 -0
- executorch/exir/_serialize/test/test_flatbuffer.py +331 -0
- executorch/exir/_serialize/test/test_named_data_store.py +212 -0
- executorch/exir/_serialize/test/test_program.py +1265 -0
- executorch/exir/_serialize/test/test_serialize.py +289 -0
- executorch/exir/_warnings.py +44 -0
- executorch/exir/backend/backend_api.py +794 -0
- executorch/exir/backend/backend_details.py +150 -0
- executorch/exir/backend/canonical_partitioners/all_node_partitioner.py +55 -0
- executorch/exir/backend/canonical_partitioners/config_partitioner.py +262 -0
- executorch/exir/backend/canonical_partitioners/duplicate_constant_node_pass.py +156 -0
- executorch/exir/backend/canonical_partitioners/duplicate_dequant_node_pass.py +111 -0
- executorch/exir/backend/canonical_partitioners/group_partitioner.py +371 -0
- executorch/exir/backend/canonical_partitioners/pattern_op_partitioner.py +185 -0
- executorch/exir/backend/compile_spec_schema.py +17 -0
- executorch/exir/backend/operator_support.py +127 -0
- executorch/exir/backend/partitioner.py +114 -0
- executorch/exir/backend/test/backend_with_compiler_demo.py +142 -0
- executorch/exir/backend/test/backend_with_delegate_mapping_demo.py +210 -0
- executorch/exir/backend/test/backend_with_named_data_map.py +115 -0
- executorch/exir/backend/test/backend_with_preprocess_all_demo.py +297 -0
- executorch/exir/backend/test/demo_backend.py +35 -0
- executorch/exir/backend/test/demos/rpc/executor_backend_partitioner.py +77 -0
- executorch/exir/backend/test/demos/rpc/executor_backend_preprocess.py +39 -0
- executorch/exir/backend/test/demos/rpc/test_rpc.py +189 -0
- executorch/exir/backend/test/demos/test_delegate_aten_mode.py +72 -0
- executorch/exir/backend/test/hta_partitioner_demo.py +288 -0
- executorch/exir/backend/test/op_partitioner_demo.py +266 -0
- executorch/exir/backend/test/test_backend_with_named_data_map.py +85 -0
- executorch/exir/backend/test/test_backends.py +1463 -0
- executorch/exir/backend/test/test_backends_lifted.py +1326 -0
- executorch/exir/backend/test/test_backends_nested.py +258 -0
- executorch/exir/backend/test/test_compatibility.py +118 -0
- executorch/exir/backend/test/test_debug_handle_map.py +143 -0
- executorch/exir/backend/test/test_delegate_map_builder.py +257 -0
- executorch/exir/backend/test/test_graph_partition.py +248 -0
- executorch/exir/backend/test/test_group_partitioner.py +1674 -0
- executorch/exir/backend/test/test_lowered_backend_module.py +207 -0
- executorch/exir/backend/test/test_partitioner.py +731 -0
- executorch/exir/backend/test/test_passes.py +48 -0
- executorch/exir/backend/test/test_to_backend_multi_method.py +595 -0
- executorch/exir/backend/test/test_utils.py +264 -0
- executorch/exir/backend/utils.py +661 -0
- executorch/exir/capture/__init__.py +28 -0
- executorch/exir/capture/_capture.py +381 -0
- executorch/exir/capture/_config.py +119 -0
- executorch/exir/capture/_unlift.py +159 -0
- executorch/exir/common.py +140 -0
- executorch/exir/control_flow.py +204 -0
- executorch/exir/debug_handle_utils.py +29 -0
- executorch/exir/delegate.py +171 -0
- executorch/exir/delegate.pyi +21 -0
- executorch/exir/dialects/__init__.py +0 -0
- executorch/exir/dialects/_ops.py +166 -0
- executorch/exir/dialects/backend/_ops.py +123 -0
- executorch/exir/dialects/backend/test/test_backend_ops.py +88 -0
- executorch/exir/dialects/edge/_ops.py +405 -0
- executorch/exir/dialects/edge/arg/model.py +238 -0
- executorch/exir/dialects/edge/arg/type.py +46 -0
- executorch/exir/dialects/edge/dtype/runner.py +122 -0
- executorch/exir/dialects/edge/dtype/supported.py +47 -0
- executorch/exir/dialects/edge/dtype/utils.py +36 -0
- executorch/exir/dialects/edge/edge.yaml +8388 -0
- executorch/exir/dialects/edge/op/api.py +86 -0
- executorch/exir/dialects/edge/op/sample_input.py +1283 -0
- executorch/exir/dialects/edge/op/test/test_api.py +51 -0
- executorch/exir/dialects/edge/spec/gen.py +523 -0
- executorch/exir/dialects/edge/spec/utils.py +328 -0
- executorch/exir/dialects/edge/test/test_edge_ops.py +443 -0
- executorch/exir/dialects/edge/test/test_edge_yaml.py +225 -0
- executorch/exir/dialects/test/test_exir_dialect_ops.py +22 -0
- executorch/exir/dim_order_utils.py +85 -0
- executorch/exir/dynamic_shape.py +12 -0
- executorch/exir/emit/__init__.py +11 -0
- executorch/exir/emit/_emit_program.py +216 -0
- executorch/exir/emit/_emitter.py +2071 -0
- executorch/exir/emit/test/test_emit.py +2405 -0
- executorch/exir/error.py +55 -0
- executorch/exir/graph.py +86 -0
- executorch/exir/graph_module.py +153 -0
- executorch/exir/lowered_backend_module.py +966 -0
- executorch/exir/memory.py +50 -0
- executorch/exir/memory_planning.py +1250 -0
- executorch/exir/operator/convert.py +307 -0
- executorch/exir/operator/manip.py +89 -0
- executorch/exir/operator/test/test_operator.py +84 -0
- executorch/exir/operator/util.py +68 -0
- executorch/exir/pass_base.py +808 -0
- executorch/exir/pass_manager.py +78 -0
- executorch/exir/passes/__init__.py +528 -0
- executorch/exir/passes/_quant_patterns_and_replacements.py +1563 -0
- executorch/exir/passes/const_prop_pass.py +84 -0
- executorch/exir/passes/constant_prop_pass.py +402 -0
- executorch/exir/passes/debug_handle_generator_pass.py +81 -0
- executorch/exir/passes/dim_order_ops_registry.py +90 -0
- executorch/exir/passes/dynamic_shape_prop_pass.py +301 -0
- executorch/exir/passes/executorch_prim_ops_registry.py +166 -0
- executorch/exir/passes/external_constants_pass.py +113 -0
- executorch/exir/passes/init_mutable_pass.py +32 -0
- executorch/exir/passes/insert_write_back_for_buffers_pass.py +185 -0
- executorch/exir/passes/memory_format_ops_pass.py +119 -0
- executorch/exir/passes/memory_planning_pass.py +315 -0
- executorch/exir/passes/normalize_transpose_pass.py +24 -0
- executorch/exir/passes/normalize_view_copy_base_pass.py +62 -0
- executorch/exir/passes/pass_registry.py +89 -0
- executorch/exir/passes/prune_empty_tensors_pass.py +67 -0
- executorch/exir/passes/quant_fusion_pass.py +174 -0
- executorch/exir/passes/quantize_io_pass.py +414 -0
- executorch/exir/passes/reinplace.py +103 -0
- executorch/exir/passes/remove_graph_asserts_pass.py +62 -0
- executorch/exir/passes/remove_mixed_type_operators.py +95 -0
- executorch/exir/passes/remove_noop_pass.py +123 -0
- executorch/exir/passes/remove_unused_parameters_pass.py +55 -0
- executorch/exir/passes/replace_aten_with_edge_pass.py +59 -0
- executorch/exir/passes/replace_broken_ops_with_function_ops_pass.py +42 -0
- executorch/exir/passes/replace_edge_with_backend_pass.py +56 -0
- executorch/exir/passes/replace_sym_size_op_pass.py +35 -0
- executorch/exir/passes/replace_view_copy_with_view_pass.py +325 -0
- executorch/exir/passes/scalar_to_tensor_pass.py +32 -0
- executorch/exir/passes/spec_prop_pass.py +123 -0
- executorch/exir/passes/sym_shape_eval_pass.py +289 -0
- executorch/exir/passes/sym_to_tensor_pass.py +64 -0
- executorch/exir/passes/weights_to_outputs_pass.py +88 -0
- executorch/exir/print_program.py +420 -0
- executorch/exir/program/__init__.py +32 -0
- executorch/exir/program/_fake_program.py +67 -0
- executorch/exir/program/_program.py +1995 -0
- executorch/exir/program/test/__init__.py +0 -0
- executorch/exir/program/test/test_fake_program.py +78 -0
- executorch/exir/program/test/test_program.py +922 -0
- executorch/exir/scalar_type.py +38 -0
- executorch/exir/schema.py +308 -0
- executorch/exir/serde/__init__.py +0 -0
- executorch/exir/serde/export_serialize.py +2872 -0
- executorch/exir/serde/schema.py +406 -0
- executorch/exir/serde/schema_check.py +293 -0
- executorch/exir/serde/serialize.py +838 -0
- executorch/exir/serde/union.py +77 -0
- executorch/exir/sym_util.py +95 -0
- executorch/exir/tensor.py +392 -0
- executorch/exir/tensor_layout.py +39 -0
- executorch/exir/tests/asr_joiner.py +82 -0
- executorch/exir/tests/common.py +96 -0
- executorch/exir/tests/control_flow_models.py +105 -0
- executorch/exir/tests/dynamic_shape_models.py +51 -0
- executorch/exir/tests/models.py +576 -0
- executorch/exir/tests/test_arg_validator.py +72 -0
- executorch/exir/tests/test_capture.py +29 -0
- executorch/exir/tests/test_common.py +81 -0
- executorch/exir/tests/test_delegate.py +308 -0
- executorch/exir/tests/test_dim_order_utils.py +49 -0
- executorch/exir/tests/test_dynamic_shape_propagation.py +174 -0
- executorch/exir/tests/test_error.py +19 -0
- executorch/exir/tests/test_extract_io_quant_params.py +93 -0
- executorch/exir/tests/test_joint_graph.py +124 -0
- executorch/exir/tests/test_memory_format_ops_pass.py +443 -0
- executorch/exir/tests/test_memory_format_ops_pass_aten.py +142 -0
- executorch/exir/tests/test_memory_format_ops_pass_utils.py +266 -0
- executorch/exir/tests/test_memory_planning.py +1135 -0
- executorch/exir/tests/test_op_convert.py +88 -0
- executorch/exir/tests/test_pass_infra.py +179 -0
- executorch/exir/tests/test_passes.py +2332 -0
- executorch/exir/tests/test_print_program.py +54 -0
- executorch/exir/tests/test_prune_empty_tensors_pass.py +77 -0
- executorch/exir/tests/test_quant_fusion_pass.py +528 -0
- executorch/exir/tests/test_quantization.py +120 -0
- executorch/exir/tests/test_quantize_io_pass.py +156 -0
- executorch/exir/tests/test_reinplace_pass.py +124 -0
- executorch/exir/tests/test_remove_unused_parameters_pass.py +205 -0
- executorch/exir/tests/test_remove_view_copy.py +234 -0
- executorch/exir/tests/test_serde.py +352 -0
- executorch/exir/tests/test_tensor.py +341 -0
- executorch/exir/tests/test_tracer.py +497 -0
- executorch/exir/tests/test_verification.py +275 -0
- executorch/exir/tests/test_warnings.py +169 -0
- executorch/exir/tests/transformer.py +122 -0
- executorch/exir/tracer.py +803 -0
- executorch/exir/types.py +18 -0
- executorch/exir/verification/arg_validator.py +140 -0
- executorch/exir/verification/dev_html.py +68 -0
- executorch/exir/verification/interpreter.py +425 -0
- executorch/exir/verification/test/test_verifier.py +177 -0
- executorch/exir/verification/verifier.py +352 -0
- executorch/exir/version.py +9 -0
- executorch/exir/wrap.py +32 -0
- executorch/export/__init__.py +40 -0
- executorch/export/export.py +696 -0
- executorch/export/recipe.py +328 -0
- executorch/export/recipe_provider.py +60 -0
- executorch/export/recipe_registry.py +86 -0
- executorch/export/stages.py +686 -0
- executorch/export/target_recipes.py +185 -0
- executorch/export/tests/test_executorch_export.py +34 -0
- executorch/export/tests/test_export_recipe.py +131 -0
- executorch/export/tests/test_export_session.py +973 -0
- executorch/export/tests/test_export_stages.py +534 -0
- executorch/export/tests/test_recipe_provider.py +98 -0
- executorch/export/tests/test_recipe_registry.py +139 -0
- executorch/export/tests/test_target_recipes.py +539 -0
- executorch/export/types.py +22 -0
- executorch/export/utils.py +51 -0
- executorch/extension/audio/mel_spectrogram.py +279 -0
- executorch/extension/export_util/__init__.py +13 -0
- executorch/extension/export_util/utils.py +147 -0
- executorch/extension/flat_tensor/__init__.py +0 -0
- executorch/extension/flat_tensor/serialize/__init__.py +0 -0
- executorch/extension/flat_tensor/serialize/flat_tensor.fbs +73 -0
- executorch/extension/flat_tensor/serialize/flat_tensor_schema.py +34 -0
- executorch/extension/flat_tensor/serialize/scalar_type.fbs +38 -0
- executorch/extension/flat_tensor/serialize/serialize.py +446 -0
- executorch/extension/flat_tensor/test/test_serialize.py +326 -0
- executorch/extension/gguf_util/convert_main.py +53 -0
- executorch/extension/gguf_util/converter.py +27 -0
- executorch/extension/gguf_util/converters/llama_converter.py +123 -0
- executorch/extension/gguf_util/load_gguf.py +103 -0
- executorch/extension/llm/custom_ops/__init__.py +0 -0
- executorch/extension/llm/custom_ops/custom_ops.py +495 -0
- executorch/extension/llm/custom_ops/custom_ops_aot_lib.dll +0 -0
- executorch/extension/llm/custom_ops/model_sharding.py +117 -0
- executorch/extension/llm/custom_ops/op_tile_crop_aot.py +38 -0
- executorch/extension/llm/custom_ops/preprocess_custom_ops.py +69 -0
- executorch/extension/llm/custom_ops/spinquant/special_hadamard_code_gen.py +279 -0
- executorch/extension/llm/custom_ops/spinquant/third-party/FFHT/example.py +20 -0
- executorch/extension/llm/custom_ops/spinquant/third-party/FFHT/gen.py +869 -0
- executorch/extension/llm/custom_ops/test_preprocess_custom_ops.py +34 -0
- executorch/extension/llm/custom_ops/test_quantized_sdpa.py +550 -0
- executorch/extension/llm/custom_ops/test_sdpa_with_kv_cache.py +651 -0
- executorch/extension/llm/custom_ops/test_update_cache.py +433 -0
- executorch/extension/llm/custom_ops/test_update_cross_attn_cache.py +284 -0
- executorch/extension/llm/export/__init__.py +11 -0
- executorch/extension/llm/export/builder.py +535 -0
- executorch/extension/llm/export/config/llm_config.py +727 -0
- executorch/extension/llm/export/export_llm.py +106 -0
- executorch/extension/llm/export/export_passes.py +202 -0
- executorch/extension/llm/export/partitioner_lib.py +238 -0
- executorch/extension/llm/export/quantizer_lib.py +322 -0
- executorch/extension/llm/export/test/__init__.py +0 -0
- executorch/extension/llm/export/test/test_builder.py +118 -0
- executorch/extension/llm/export/test/test_export_llm.py +155 -0
- executorch/extension/llm/export/test_export_passes.py +209 -0
- executorch/extension/llm/modules/__init__.py +24 -0
- executorch/extension/llm/modules/_position_embeddings.py +729 -0
- executorch/extension/llm/modules/attention.py +415 -0
- executorch/extension/llm/modules/kv_cache.py +151 -0
- executorch/extension/llm/modules/test/__init__.py +0 -0
- executorch/extension/llm/modules/test/test_attention.py +353 -0
- executorch/extension/llm/modules/test/test_kv_cache.py +218 -0
- executorch/extension/llm/modules/test/test_position_embeddings.py +230 -0
- executorch/extension/llm/runner/__init__.py +235 -0
- executorch/extension/llm/runner/_llm_runner.pyi +523 -0
- executorch/extension/llm/runner/test/test_runner_pybindings.py +258 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/__init__.py +63 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/constants.py +31 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/hf_tokenizer.py +57 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/llama2c.py +111 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tiktoken.py +198 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tools/__init__.py +0 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tools/llama2c/__init__.py +0 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tools/llama2c/convert.py +49 -0
- executorch/extension/llm/tokenizers/setup.py +199 -0
- executorch/extension/llm/tokenizers/test/test_hf_tokenizer.py +83 -0
- executorch/extension/llm/tokenizers/test/test_python_bindings.py +131 -0
- executorch/extension/llm/tokenizers/test/test_tekken_python.py +453 -0
- executorch/extension/llm/tokenizers/test/test_tiktoken.py +49 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/absl/abseil.podspec.gen.py +243 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/absl/copts/copts.py +194 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/absl/copts/generate_copts.py +109 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/conanfile.py +51 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/create_lts.py +139 -0
- executorch/extension/llm/tokenizers/third-party/json/docs/mkdocs/scripts/check_structure.py +179 -0
- executorch/extension/llm/tokenizers/third-party/json/tests/thirdparty/imapdl/filterbr.py +109 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/amalgamate/amalgamate.py +299 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/gdb_pretty_printer/nlohmann-json.py +32 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/generate_natvis/generate_natvis.py +41 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/serve_header/serve_header.py +410 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateCommon.py +354 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateTest.py +186 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateUcd.py +999 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateUcpHeader.py +98 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateUcpTables.py +203 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/UpdateCommon.py +31 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/UpdateDates.py +59 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/UpdateRelease.py +29 -0
- executorch/extension/llm/tokenizers/third-party/re2/benchlog/benchplot.py +98 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/re2.py +583 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/re2_test.py +489 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/setup.py +158 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/toolchains/generate.py +98 -0
- executorch/extension/llm/tokenizers/third-party/re2/re2/make_unicode_casefold.py +151 -0
- executorch/extension/llm/tokenizers/third-party/re2/re2/make_unicode_groups.py +117 -0
- executorch/extension/llm/tokenizers/third-party/re2/re2/unicode.py +284 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/setup.py +215 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/__init__.py +1224 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/_version.py +1 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/sentencepiece_model_pb2.py +44 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/sentencepiece_pb2.py +30 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/test/__init__.py +0 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/test/sentencepiece_test.py +937 -0
- executorch/extension/module/test/resources/gen_bundled_program.py +99 -0
- executorch/extension/pybindings/_portable_lib.cp313-win_amd64.pyd +0 -0
- executorch/extension/pybindings/portable_lib.py +82 -0
- executorch/extension/pybindings/pybindings.pyi +299 -0
- executorch/extension/pybindings/test/make_test.py +186 -0
- executorch/extension/pybindings/test/test_backend_pybinding.py +27 -0
- executorch/extension/pybindings/test/test_pybindings.py +735 -0
- executorch/extension/pytree/__init__.py +54 -0
- executorch/extension/pytree/test/test.py +331 -0
- executorch/extension/training/__init__.py +22 -0
- executorch/extension/training/examples/CIFAR/data_utils.py +389 -0
- executorch/extension/training/examples/CIFAR/export.py +220 -0
- executorch/extension/training/examples/CIFAR/main.py +188 -0
- executorch/extension/training/examples/CIFAR/model.py +73 -0
- executorch/extension/training/examples/CIFAR/train_utils.py +622 -0
- executorch/extension/training/examples/XOR/export_model.py +74 -0
- executorch/extension/training/examples/XOR/model.py +34 -0
- executorch/extension/training/examples/XOR/test/test_export.py +19 -0
- executorch/extension/training/pybindings/_training_lib.pyi +45 -0
- executorch/extension/training/pybindings/_training_module.py +86 -0
- executorch/extension/training/pybindings/test/test.py +67 -0
- executorch/extension/wasm/test/test_model.py +34 -0
- executorch/include/executorch/extension/kernel_util/make_boxed_from_unboxed_functor.h +260 -0
- executorch/include/executorch/extension/kernel_util/meta_programming.h +119 -0
- executorch/include/executorch/extension/kernel_util/type_list.h +145 -0
- executorch/include/executorch/extension/tensor/tensor.h +14 -0
- executorch/include/executorch/extension/tensor/tensor_accessor.h +218 -0
- executorch/include/executorch/extension/tensor/tensor_ptr.h +485 -0
- executorch/include/executorch/extension/tensor/tensor_ptr_maker.h +687 -0
- executorch/include/executorch/extension/threadpool/cpuinfo_utils.h +24 -0
- executorch/include/executorch/extension/threadpool/threadpool.h +124 -0
- executorch/include/executorch/extension/threadpool/threadpool_guard.h +37 -0
- executorch/include/executorch/runtime/core/array_ref.h +262 -0
- executorch/include/executorch/runtime/core/data_loader.h +141 -0
- executorch/include/executorch/runtime/core/defines.h +20 -0
- executorch/include/executorch/runtime/core/error.h +257 -0
- executorch/include/executorch/runtime/core/evalue.h +608 -0
- executorch/include/executorch/runtime/core/event_tracer.h +592 -0
- executorch/include/executorch/runtime/core/event_tracer_hooks.h +340 -0
- executorch/include/executorch/runtime/core/event_tracer_hooks_delegate.h +204 -0
- executorch/include/executorch/runtime/core/exec_aten/exec_aten.h +175 -0
- executorch/include/executorch/runtime/core/exec_aten/testing_util/tensor_factory.h +1133 -0
- executorch/include/executorch/runtime/core/exec_aten/testing_util/tensor_util.h +378 -0
- executorch/include/executorch/runtime/core/exec_aten/util/dim_order_util.h +278 -0
- executorch/include/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1430 -0
- executorch/include/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- executorch/include/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +68 -0
- executorch/include/executorch/runtime/core/exec_aten/util/tensor_util.h +1415 -0
- executorch/include/executorch/runtime/core/freeable_buffer.h +218 -0
- executorch/include/executorch/runtime/core/function_ref.h +108 -0
- executorch/include/executorch/runtime/core/hierarchical_allocator.h +125 -0
- executorch/include/executorch/runtime/core/memory_allocator.h +233 -0
- executorch/include/executorch/runtime/core/named_data_map.h +77 -0
- executorch/include/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- executorch/include/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- executorch/include/executorch/runtime/core/portable_type/bits_types.h +83 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +299 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/Half.h +8 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/complex.h +78 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/complex_math.h +406 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/complex_utils.h +46 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/irange.h +123 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/llvmMathExtras.h +905 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/overflows.h +100 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/safe_numerics.h +114 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/macros/Export.h +153 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h +694 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/BFloat16.h +480 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/Half.h +788 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/TypeSafeSignMath.h +148 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/bit_cast.h +50 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/complex.h +616 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/floating_point_utils.h +38 -0
- executorch/include/executorch/runtime/core/portable_type/complex.h +21 -0
- executorch/include/executorch/runtime/core/portable_type/device.h +74 -0
- executorch/include/executorch/runtime/core/portable_type/half.h +27 -0
- executorch/include/executorch/runtime/core/portable_type/optional.h +36 -0
- executorch/include/executorch/runtime/core/portable_type/qint_types.h +83 -0
- executorch/include/executorch/runtime/core/portable_type/scalar.h +123 -0
- executorch/include/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- executorch/include/executorch/runtime/core/portable_type/string_view.h +29 -0
- executorch/include/executorch/runtime/core/portable_type/tensor.h +175 -0
- executorch/include/executorch/runtime/core/portable_type/tensor_impl.h +304 -0
- executorch/include/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- executorch/include/executorch/runtime/core/result.h +268 -0
- executorch/include/executorch/runtime/core/span.h +110 -0
- executorch/include/executorch/runtime/core/tag.h +90 -0
- executorch/include/executorch/runtime/core/tensor_layout.h +93 -0
- executorch/include/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- executorch/include/executorch/runtime/core/testing_util/error_matchers.h +303 -0
- executorch/include/executorch/runtime/kernel/kernel_includes.h +23 -0
- executorch/include/executorch/runtime/kernel/kernel_runtime_context.h +131 -0
- executorch/include/executorch/runtime/kernel/operator_registry.h +298 -0
- executorch/include/executorch/runtime/kernel/test/test_util.h +40 -0
- executorch/include/executorch/runtime/kernel/thread_parallel_interface.h +107 -0
- executorch/include/executorch/runtime/platform/abort.h +36 -0
- executorch/include/executorch/runtime/platform/assert.h +124 -0
- executorch/include/executorch/runtime/platform/clock.h +43 -0
- executorch/include/executorch/runtime/platform/compat_unistd.h +75 -0
- executorch/include/executorch/runtime/platform/compiler.h +214 -0
- executorch/include/executorch/runtime/platform/log.h +216 -0
- executorch/include/executorch/runtime/platform/platform.h +276 -0
- executorch/include/executorch/runtime/platform/profiler.h +289 -0
- executorch/include/executorch/runtime/platform/runtime.h +35 -0
- executorch/include/executorch/runtime/platform/system.h +49 -0
- executorch/include/executorch/runtime/platform/test/pal_spy.h +86 -0
- executorch/include/executorch/runtime/platform/test/stub_platform.h +76 -0
- executorch/include/executorch/runtime/platform/types.h +24 -0
- executorch/kernels/quantized/__init__.py +21 -0
- executorch/kernels/quantized/quantized.yaml +113 -0
- executorch/kernels/quantized/quantized_ops_aot_lib.dll +0 -0
- executorch/kernels/quantized/test/supported_features_def.yaml +1 -0
- executorch/kernels/quantized/test/test_out_variants.py +100 -0
- executorch/kernels/quantized/test/test_quant_dequant_per_token.py +149 -0
- executorch/runtime/__init__.py +334 -0
- executorch/runtime/kernel/test/functions.yaml +13 -0
- executorch/runtime/test/test_runtime.py +106 -0
- executorch/runtime/test/test_runtime_etdump_gen.py +163 -0
- executorch/schema/program.fbs +489 -0
- executorch/schema/scalar_type.fbs +43 -0
- executorch/share/cmake/executorch-config.cmake +77 -0
- executorch/util/activation_memory_profiler.py +177 -0
- executorch/util/collect_env.py +748 -0
- executorch/util/python_profiler.py +96 -0
- executorch/version.py +4 -0
- executorch-1.1.0.dist-info/METADATA +87 -0
- executorch-1.1.0.dist-info/RECORD +2784 -0
- executorch-1.1.0.dist-info/WHEEL +5 -0
- executorch-1.1.0.dist-info/entry_points.txt +2 -0
- executorch-1.1.0.dist-info/licenses/LICENSE +37 -0
- executorch-1.1.0.dist-info/top_level.txt +7 -0
|
@@ -0,0 +1,2507 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2023 Apple Inc. All rights reserved.
|
|
3
|
+
# Provided subject to the LICENSE file in the top level directory.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
import inspect
|
|
7
|
+
import logging
|
|
8
|
+
import random
|
|
9
|
+
import unittest
|
|
10
|
+
from enum import Enum
|
|
11
|
+
|
|
12
|
+
import torch
|
|
13
|
+
from executorch.backends.apple.mps.test.test_mps_models import MPS_MODEL_NAME_TO_MODEL
|
|
14
|
+
from executorch.backends.apple.mps.test.test_mps_utils import (
|
|
15
|
+
OpSequencesAddConv2d,
|
|
16
|
+
randomize_bn,
|
|
17
|
+
TestMPS,
|
|
18
|
+
)
|
|
19
|
+
from executorch.examples.models import MODEL_NAME_TO_MODEL
|
|
20
|
+
from executorch.examples.models.model_factory import EagerModelFactory
|
|
21
|
+
|
|
22
|
+
from executorch.exir.tests.models import (
|
|
23
|
+
BasicSinMax,
|
|
24
|
+
CompositeDelegateModule,
|
|
25
|
+
ElementwiseAdd,
|
|
26
|
+
Emformer,
|
|
27
|
+
MLP,
|
|
28
|
+
ModelWithUnusedArg,
|
|
29
|
+
Mul,
|
|
30
|
+
Repeat,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class MODEL_TYPE(Enum):
|
|
35
|
+
EXIR_DEFAULT_MODEL = 0
|
|
36
|
+
EXIR_TEST_MODEL = 1
|
|
37
|
+
MPS_TEST_MODEL = 2
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
EXIR_MODEL_NAME_TO_MODEL = {
|
|
41
|
+
"repeat": lambda: (Repeat(), Repeat().get_random_inputs()),
|
|
42
|
+
"model_with_unused_arg": lambda: (
|
|
43
|
+
ModelWithUnusedArg(),
|
|
44
|
+
ModelWithUnusedArg().get_random_inputs(),
|
|
45
|
+
),
|
|
46
|
+
"mlp": lambda: (MLP(), MLP().get_random_inputs()),
|
|
47
|
+
"mul_2": lambda: (Mul(), Mul().get_random_inputs()),
|
|
48
|
+
"element_wise_add": lambda: (
|
|
49
|
+
ElementwiseAdd(),
|
|
50
|
+
ElementwiseAdd().get_random_inputs(),
|
|
51
|
+
),
|
|
52
|
+
"basic_sin_max": lambda: (BasicSinMax(), BasicSinMax().get_random_inputs()),
|
|
53
|
+
"composite_delegate_module": lambda: (
|
|
54
|
+
CompositeDelegateModule(),
|
|
55
|
+
CompositeDelegateModule().get_random_inputs(),
|
|
56
|
+
),
|
|
57
|
+
"emformer": lambda: (Emformer(), Emformer().get_random_inputs()),
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def run_model(
|
|
62
|
+
model: str,
|
|
63
|
+
model_type: MODEL_TYPE = MODEL_TYPE.EXIR_DEFAULT_MODEL,
|
|
64
|
+
use_fp16: bool = False,
|
|
65
|
+
lowering_func=None,
|
|
66
|
+
):
|
|
67
|
+
logging.info(f"Step 1: Retrieving model: {model}...")
|
|
68
|
+
if model_type == MODEL_TYPE.EXIR_DEFAULT_MODEL:
|
|
69
|
+
m, m_inputs = EagerModelFactory.create_model(*MODEL_NAME_TO_MODEL[model])
|
|
70
|
+
elif model_type == MODEL_TYPE.EXIR_TEST_MODEL:
|
|
71
|
+
m, m_inputs = EXIR_MODEL_NAME_TO_MODEL.get(model)()
|
|
72
|
+
elif model_type == MODEL_TYPE.MPS_TEST_MODEL:
|
|
73
|
+
m, m_inputs = MPS_MODEL_NAME_TO_MODEL.get(model)()
|
|
74
|
+
|
|
75
|
+
lowering_func(m, m_inputs, model)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class TestMPSBackendExirModels(TestMPS):
|
|
79
|
+
def test_model_with_unused_arg(self):
|
|
80
|
+
run_model(
|
|
81
|
+
inspect.stack()[0].function[5:],
|
|
82
|
+
MODEL_TYPE.EXIR_TEST_MODEL,
|
|
83
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
def test_mlp(self):
|
|
87
|
+
run_model(
|
|
88
|
+
inspect.stack()[0].function[5:],
|
|
89
|
+
MODEL_TYPE.EXIR_TEST_MODEL,
|
|
90
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def test_mul_2(self):
|
|
94
|
+
run_model(
|
|
95
|
+
inspect.stack()[0].function[5:],
|
|
96
|
+
MODEL_TYPE.EXIR_TEST_MODEL,
|
|
97
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def test_element_wise_add(self):
|
|
101
|
+
run_model(
|
|
102
|
+
inspect.stack()[0].function[5:],
|
|
103
|
+
MODEL_TYPE.EXIR_TEST_MODEL,
|
|
104
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def test_emformer(self):
|
|
108
|
+
run_model(
|
|
109
|
+
inspect.stack()[0].function[5:],
|
|
110
|
+
MODEL_TYPE.EXIR_TEST_MODEL,
|
|
111
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class TestMPSBackendMPSModels(TestMPS):
|
|
116
|
+
def test_conv2D(self):
|
|
117
|
+
run_model(
|
|
118
|
+
inspect.stack()[0].function[5:],
|
|
119
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
120
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def test_norm(self):
|
|
124
|
+
run_model(
|
|
125
|
+
inspect.stack()[0].function[5:],
|
|
126
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
127
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
def test_module_add(self):
|
|
131
|
+
run_model(
|
|
132
|
+
inspect.stack()[0].function[5:],
|
|
133
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
134
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def test_toy_model_for_mem_planning(self):
|
|
138
|
+
run_model(
|
|
139
|
+
inspect.stack()[0].function[5:],
|
|
140
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
141
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
def test_mem_planning_with_scratch_tensor(self):
|
|
145
|
+
run_model(
|
|
146
|
+
inspect.stack()[0].function[5:],
|
|
147
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
148
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
def test_module_ops_return_tensor_list(self):
|
|
152
|
+
run_model(
|
|
153
|
+
inspect.stack()[0].function[5:],
|
|
154
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
155
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
def test_module_contiguous_tensor(self):
|
|
159
|
+
run_model(
|
|
160
|
+
inspect.stack()[0].function[5:],
|
|
161
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
162
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def test_module_input_dynamic_shape(self):
|
|
166
|
+
run_model(
|
|
167
|
+
inspect.stack()[0].function[5:],
|
|
168
|
+
MODEL_TYPE.MPS_TEST_MODEL,
|
|
169
|
+
lowering_func=self.lower_and_test_with_partitioner,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class TestMPSUnitOpTesting(TestMPS):
|
|
174
|
+
def test_mps_backend_split_copy(self):
|
|
175
|
+
class SplitCopy(torch.nn.Module):
|
|
176
|
+
def __init__(self):
|
|
177
|
+
super().__init__()
|
|
178
|
+
|
|
179
|
+
def forward(self, x):
|
|
180
|
+
return torch.split(x, 2, 1)
|
|
181
|
+
|
|
182
|
+
example_inputs = (torch.randn(3, 5, 4, 7),)
|
|
183
|
+
self.lower_and_test_with_partitioner(
|
|
184
|
+
SplitCopy(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
def test_mps_backend_unbind_copy(self):
|
|
188
|
+
class UnbindCopy(torch.nn.Module):
|
|
189
|
+
def __init__(self):
|
|
190
|
+
super().__init__()
|
|
191
|
+
|
|
192
|
+
def forward(self, x):
|
|
193
|
+
return torch.unbind(x, 1)
|
|
194
|
+
|
|
195
|
+
example_inputs = (torch.randn(3, 5, 4, 7),)
|
|
196
|
+
self.lower_and_test_with_partitioner(
|
|
197
|
+
UnbindCopy(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
def test_mps_backend_pixel_shuffle(self):
|
|
201
|
+
class PixelShuffle(torch.nn.Module):
|
|
202
|
+
def __init__(self):
|
|
203
|
+
super().__init__()
|
|
204
|
+
|
|
205
|
+
def forward(self, x):
|
|
206
|
+
return torch.pixel_shuffle(x, 2)
|
|
207
|
+
|
|
208
|
+
example_inputs = (torch.randn(3, 8, 4, 7),)
|
|
209
|
+
self.lower_and_test_with_partitioner(
|
|
210
|
+
PixelShuffle(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
def test_mps_backend_cumsum(self):
|
|
214
|
+
class CumulativeSum(torch.nn.Module):
|
|
215
|
+
def __init__(self):
|
|
216
|
+
super().__init__()
|
|
217
|
+
|
|
218
|
+
def forward(self, *x):
|
|
219
|
+
return torch.cumsum(x[0], dim=0)
|
|
220
|
+
|
|
221
|
+
example_inputs = (torch.randn(3, 5, 4, 7),)
|
|
222
|
+
self.lower_and_test_with_partitioner(
|
|
223
|
+
CumulativeSum(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
def test_mps_backend_stack(self):
|
|
227
|
+
class Stack(torch.nn.Module):
|
|
228
|
+
def __init__(self):
|
|
229
|
+
super().__init__()
|
|
230
|
+
|
|
231
|
+
def forward(self, *x):
|
|
232
|
+
return torch.stack((x), 0)
|
|
233
|
+
|
|
234
|
+
example_inputs = (
|
|
235
|
+
torch.randn(1, 5, 1, 8),
|
|
236
|
+
torch.randn(1, 5, 1, 8),
|
|
237
|
+
)
|
|
238
|
+
self.lower_and_test_with_partitioner(
|
|
239
|
+
Stack(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
def test_mps_backend_cat(self):
|
|
243
|
+
class Cat(torch.nn.Module):
|
|
244
|
+
def __init__(self):
|
|
245
|
+
super().__init__()
|
|
246
|
+
|
|
247
|
+
def forward(self, *x):
|
|
248
|
+
return torch.cat((x), 1)
|
|
249
|
+
|
|
250
|
+
example_inputs = (
|
|
251
|
+
torch.randn(1, 5, 1, 8),
|
|
252
|
+
torch.randn(1, 5, 1, 8),
|
|
253
|
+
)
|
|
254
|
+
self.lower_and_test_with_partitioner(
|
|
255
|
+
Cat(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
def test_mps_backend_expand_copy(self):
|
|
259
|
+
class ExpandCopy(torch.nn.Module):
|
|
260
|
+
def __init__(self):
|
|
261
|
+
super().__init__()
|
|
262
|
+
self.example_inputs = [7, 5, 4, 8]
|
|
263
|
+
|
|
264
|
+
def forward(self, x):
|
|
265
|
+
return x.expand(self.example_inputs)
|
|
266
|
+
|
|
267
|
+
example_inputs = (torch.randn(1, 5, 1, 8),)
|
|
268
|
+
self.lower_and_test_with_partitioner(
|
|
269
|
+
ExpandCopy(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
def test_mps_backend_select(self):
|
|
273
|
+
class Select(torch.nn.Module):
|
|
274
|
+
def __init__(self):
|
|
275
|
+
super().__init__()
|
|
276
|
+
|
|
277
|
+
def forward(self, x):
|
|
278
|
+
return torch.select(x, 3, 2)
|
|
279
|
+
|
|
280
|
+
example_inputs = (torch.randn(3, 5, 4, 7),)
|
|
281
|
+
self.lower_and_test_with_partitioner(
|
|
282
|
+
Select(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
def test_mps_backend_view_copy(self):
|
|
286
|
+
class ViewCopy(torch.nn.Module):
|
|
287
|
+
def __init__(self):
|
|
288
|
+
super().__init__()
|
|
289
|
+
self.example_inputs = [2, 10, 2, 4]
|
|
290
|
+
|
|
291
|
+
def forward(self, x):
|
|
292
|
+
return x.view(self.example_inputs)
|
|
293
|
+
|
|
294
|
+
example_inputs = (torch.randn(1, 5, 4, 8),)
|
|
295
|
+
self.lower_and_test_with_partitioner(
|
|
296
|
+
ViewCopy(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
def test_mps_backend_mean_dim_2(self):
|
|
300
|
+
class Mean(torch.nn.Module):
|
|
301
|
+
def __init__(self):
|
|
302
|
+
super().__init__()
|
|
303
|
+
|
|
304
|
+
def forward(self, x):
|
|
305
|
+
return torch.mean(x, (-1, -2), keepdim=True)
|
|
306
|
+
|
|
307
|
+
example_inputs = (torch.randn(1, 5, 4, 4),)
|
|
308
|
+
self.lower_and_test_with_partitioner(
|
|
309
|
+
Mean(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
def test_mps_backend_squeeze_dim_1(self):
|
|
313
|
+
class Squeeze(torch.nn.Module):
|
|
314
|
+
def __init__(self):
|
|
315
|
+
super().__init__()
|
|
316
|
+
|
|
317
|
+
def forward(self, x):
|
|
318
|
+
y = torch.squeeze(x, 2)
|
|
319
|
+
return torch.squeeze(y, 0)
|
|
320
|
+
|
|
321
|
+
example_inputs = (torch.randn(1, 5, 1, 1, 4),)
|
|
322
|
+
self.lower_and_test_with_partitioner(
|
|
323
|
+
Squeeze(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
def test_mps_backend_unsqueeze_dim_1(self):
|
|
327
|
+
class Squeeze(torch.nn.Module):
|
|
328
|
+
def __init__(self):
|
|
329
|
+
super().__init__()
|
|
330
|
+
|
|
331
|
+
def forward(self, x):
|
|
332
|
+
return torch.unsqueeze(x, 1)
|
|
333
|
+
|
|
334
|
+
example_inputs = (torch.randn(1, 5, 1, 4),)
|
|
335
|
+
self.lower_and_test_with_partitioner(
|
|
336
|
+
Squeeze(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
def test_mps_backend_mean_dim_no_keepdim(self):
|
|
340
|
+
class Mean(torch.nn.Module):
|
|
341
|
+
def __init__(self):
|
|
342
|
+
super().__init__()
|
|
343
|
+
|
|
344
|
+
def forward(self, x):
|
|
345
|
+
return torch.mean(x, (-1, -2), keepdim=False)
|
|
346
|
+
|
|
347
|
+
example_inputs = (torch.randn(1, 5, 4, 4),)
|
|
348
|
+
self.lower_and_test_with_partitioner(
|
|
349
|
+
Mean(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
def test_mps_backend_mean_dim_unsupported(self):
|
|
353
|
+
class Mean(torch.nn.Module):
|
|
354
|
+
def __init__(self):
|
|
355
|
+
super().__init__()
|
|
356
|
+
|
|
357
|
+
def forward(self, x):
|
|
358
|
+
return torch.mean(x, (3), keepdim=True)
|
|
359
|
+
|
|
360
|
+
example_inputs = (torch.randn(1, 5, 4, 4),)
|
|
361
|
+
self.lower_and_test_with_partitioner(
|
|
362
|
+
Mean(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
def test_mps_backend_static_transpose(self):
|
|
366
|
+
class PermuteModule(torch.nn.Module):
|
|
367
|
+
def __init__(self):
|
|
368
|
+
super().__init__()
|
|
369
|
+
self.nchw_to_nhwc = [0, 2, 3, 1]
|
|
370
|
+
|
|
371
|
+
def forward(self, x):
|
|
372
|
+
return torch.permute(x, self.nchw_to_nhwc)
|
|
373
|
+
|
|
374
|
+
example_inputs = (torch.randn(1, 1, 4, 4),)
|
|
375
|
+
self.lower_module_and_test_output(
|
|
376
|
+
PermuteModule(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
def test_mps_backend_sequential_conv2d(self):
|
|
380
|
+
class TwoConv(torch.nn.Module):
|
|
381
|
+
def __init__(self):
|
|
382
|
+
super().__init__()
|
|
383
|
+
self.first = torch.nn.Conv2d(
|
|
384
|
+
in_channels=1,
|
|
385
|
+
out_channels=3,
|
|
386
|
+
kernel_size=(3, 3),
|
|
387
|
+
padding=1,
|
|
388
|
+
bias=False,
|
|
389
|
+
)
|
|
390
|
+
self.second = torch.nn.Conv2d(
|
|
391
|
+
in_channels=3,
|
|
392
|
+
out_channels=2,
|
|
393
|
+
kernel_size=(3, 3),
|
|
394
|
+
padding=1,
|
|
395
|
+
bias=False,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
def forward(self, x):
|
|
399
|
+
return self.second(self.first(x))
|
|
400
|
+
|
|
401
|
+
example_inputs = (torch.randn(1, 1, 3, 3),)
|
|
402
|
+
self.lower_and_test_with_partitioner(
|
|
403
|
+
TwoConv(), example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
def test_mps_backend_conv2d_bn_1(self):
|
|
407
|
+
class ModelConvBN(torch.nn.Module):
|
|
408
|
+
def __init__(self, in_features: int, out_features: int, kernel_size):
|
|
409
|
+
super().__init__()
|
|
410
|
+
self.conv2d = torch.nn.Conv2d(in_features, out_features, kernel_size)
|
|
411
|
+
self.bn = randomize_bn(out_features)
|
|
412
|
+
|
|
413
|
+
def forward(self, x):
|
|
414
|
+
y = self.conv2d(x)
|
|
415
|
+
y = self.bn(y)
|
|
416
|
+
return y
|
|
417
|
+
|
|
418
|
+
model = ModelConvBN(2, 2, (2, 2)).eval()
|
|
419
|
+
|
|
420
|
+
self.lower_and_test_with_partitioner(
|
|
421
|
+
model, (torch.randn(2, 2, 4, 4),), func_name=inspect.stack()[0].function[5:]
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
def test_mps_backend_conv2d(self):
|
|
425
|
+
groups = 1
|
|
426
|
+
stride = [2, 2]
|
|
427
|
+
padding = [1, 1]
|
|
428
|
+
dilation = [1, 1]
|
|
429
|
+
in_channels = 2
|
|
430
|
+
out_channels = 1
|
|
431
|
+
width = 8
|
|
432
|
+
height = 8
|
|
433
|
+
batches = 1
|
|
434
|
+
example_inputs = (torch.randn(batches, in_channels, height, width),)
|
|
435
|
+
conv = torch.nn.Conv2d(
|
|
436
|
+
in_channels=in_channels,
|
|
437
|
+
out_channels=out_channels,
|
|
438
|
+
kernel_size=(3, 3),
|
|
439
|
+
stride=stride,
|
|
440
|
+
padding=padding,
|
|
441
|
+
groups=groups,
|
|
442
|
+
dilation=dilation,
|
|
443
|
+
bias=True,
|
|
444
|
+
)
|
|
445
|
+
conv.eval()
|
|
446
|
+
self.lower_and_test_with_partitioner(
|
|
447
|
+
conv, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
def test_conv1d(self):
|
|
451
|
+
example_inputs = (torch.randn(1, 57, 40),)
|
|
452
|
+
stride = random.randint(1, 4)
|
|
453
|
+
padding = random.randint(1, 4)
|
|
454
|
+
conv = torch.nn.Conv1d(
|
|
455
|
+
57,
|
|
456
|
+
20,
|
|
457
|
+
stride=stride,
|
|
458
|
+
padding=padding,
|
|
459
|
+
kernel_size=3,
|
|
460
|
+
bias=random.choice([True, False]),
|
|
461
|
+
)
|
|
462
|
+
conv.eval()
|
|
463
|
+
self.lower_and_test_with_partitioner(
|
|
464
|
+
conv, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
465
|
+
)
|
|
466
|
+
|
|
467
|
+
def test_conv2d_simple(self):
|
|
468
|
+
N = 10
|
|
469
|
+
C = 10
|
|
470
|
+
H = 4
|
|
471
|
+
W = 6
|
|
472
|
+
groups = 2
|
|
473
|
+
input_memory_format = torch.contiguous_format
|
|
474
|
+
weight_memory_format = torch.contiguous_format
|
|
475
|
+
strideX = random.randint(1, 4)
|
|
476
|
+
strideY = random.randint(1, 4)
|
|
477
|
+
example_inputs = (
|
|
478
|
+
torch.randn(N, C, H, W).to(memory_format=input_memory_format),
|
|
479
|
+
)
|
|
480
|
+
conv = torch.nn.Conv2d(
|
|
481
|
+
in_channels=N,
|
|
482
|
+
out_channels=C,
|
|
483
|
+
kernel_size=H,
|
|
484
|
+
groups=groups,
|
|
485
|
+
stride=(strideX, strideY),
|
|
486
|
+
bias=False,
|
|
487
|
+
)
|
|
488
|
+
conv.weight.data = conv.weight.to(memory_format=weight_memory_format)
|
|
489
|
+
conv.eval()
|
|
490
|
+
self.lower_and_test_with_partitioner(
|
|
491
|
+
conv, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
492
|
+
)
|
|
493
|
+
|
|
494
|
+
def test_conv2d_to_depthwise_conv_3d(self):
|
|
495
|
+
N = 10
|
|
496
|
+
C = 10
|
|
497
|
+
H = 4
|
|
498
|
+
W = 6
|
|
499
|
+
groups = 10
|
|
500
|
+
input_memory_format = torch.contiguous_format
|
|
501
|
+
weight_memory_format = torch.contiguous_format
|
|
502
|
+
strideX = random.randint(1, 4)
|
|
503
|
+
strideY = random.randint(1, 4)
|
|
504
|
+
example_inputs = (
|
|
505
|
+
torch.randn(N, C, H, W).to(memory_format=input_memory_format),
|
|
506
|
+
)
|
|
507
|
+
conv = torch.nn.Conv2d(
|
|
508
|
+
in_channels=N,
|
|
509
|
+
out_channels=C,
|
|
510
|
+
kernel_size=H,
|
|
511
|
+
groups=groups,
|
|
512
|
+
stride=(strideX, strideY),
|
|
513
|
+
)
|
|
514
|
+
conv.weight.data = conv.weight.to(memory_format=weight_memory_format)
|
|
515
|
+
conv.eval()
|
|
516
|
+
self.lower_and_test_with_partitioner(
|
|
517
|
+
conv, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
def test_mps_backend_conv2d_single_int_params(self):
|
|
521
|
+
groups = 1
|
|
522
|
+
stride = 2
|
|
523
|
+
padding = "valid"
|
|
524
|
+
dilation = 1
|
|
525
|
+
in_channels = 2
|
|
526
|
+
out_channels = 1
|
|
527
|
+
width = 8
|
|
528
|
+
height = 8
|
|
529
|
+
batches = 1
|
|
530
|
+
example_inputs = (torch.randn(batches, in_channels, height, width),)
|
|
531
|
+
conv = torch.nn.Conv2d(
|
|
532
|
+
in_channels=in_channels,
|
|
533
|
+
out_channels=out_channels,
|
|
534
|
+
kernel_size=3,
|
|
535
|
+
stride=stride,
|
|
536
|
+
padding=padding,
|
|
537
|
+
groups=groups,
|
|
538
|
+
dilation=dilation,
|
|
539
|
+
bias=True,
|
|
540
|
+
)
|
|
541
|
+
conv.eval()
|
|
542
|
+
self.lower_and_test_with_partitioner(
|
|
543
|
+
conv, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
def test_mps_backend_conv2d_dw(self):
|
|
547
|
+
# Depthwise Convolution Requirements:
|
|
548
|
+
# - Groups must equal In Channels
|
|
549
|
+
# - Out Channels must be a positive multiple of In Channels
|
|
550
|
+
groups = 2
|
|
551
|
+
stride = [2, 2]
|
|
552
|
+
padding = [1, 1]
|
|
553
|
+
dilation = [1, 1]
|
|
554
|
+
in_channels = groups
|
|
555
|
+
out_channels = 3 * in_channels
|
|
556
|
+
width = 8
|
|
557
|
+
height = 8
|
|
558
|
+
batches = 1
|
|
559
|
+
example_inputs = (torch.randn(batches, in_channels, height, width),)
|
|
560
|
+
conv = torch.nn.Conv2d(
|
|
561
|
+
in_channels=in_channels,
|
|
562
|
+
out_channels=out_channels,
|
|
563
|
+
kernel_size=(3, 3),
|
|
564
|
+
stride=stride,
|
|
565
|
+
padding=padding,
|
|
566
|
+
groups=groups,
|
|
567
|
+
dilation=dilation,
|
|
568
|
+
bias=True,
|
|
569
|
+
)
|
|
570
|
+
conv.eval()
|
|
571
|
+
self.lower_and_test_with_partitioner(
|
|
572
|
+
conv, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
573
|
+
)
|
|
574
|
+
|
|
575
|
+
def test_mps_backend_mm(self):
|
|
576
|
+
in_sizes = [1, 4, 4]
|
|
577
|
+
input_sizes = [4, 37, 17]
|
|
578
|
+
output_sizes = [4, 17, 37]
|
|
579
|
+
for i, _ in enumerate(in_sizes):
|
|
580
|
+
in_size = int(in_sizes[i])
|
|
581
|
+
input_size = int(input_sizes[i])
|
|
582
|
+
output_size = int(output_sizes[i])
|
|
583
|
+
linear = torch.nn.Linear(input_size, output_size, bias=False).eval()
|
|
584
|
+
example_input = (torch.randn(in_size, input_size),)
|
|
585
|
+
|
|
586
|
+
self.lower_and_test_with_partitioner(
|
|
587
|
+
linear, example_input, func_name=inspect.stack()[0].function[5:]
|
|
588
|
+
)
|
|
589
|
+
|
|
590
|
+
def test_mps_backend_bmm(self):
|
|
591
|
+
class BmmModule(torch.nn.Module):
|
|
592
|
+
def __init__(
|
|
593
|
+
self,
|
|
594
|
+
):
|
|
595
|
+
super().__init__()
|
|
596
|
+
self.bmm = torch.bmm
|
|
597
|
+
|
|
598
|
+
def forward(self, x, y):
|
|
599
|
+
return self.bmm(x, y)
|
|
600
|
+
|
|
601
|
+
mul_module = BmmModule()
|
|
602
|
+
model_inputs = (
|
|
603
|
+
torch.randn((3, 1, 8)),
|
|
604
|
+
torch.randn((3, 8, 1)),
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
self.lower_and_test_with_partitioner(
|
|
608
|
+
mul_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
def test_mps_backend_addmm(self):
|
|
612
|
+
in_sizes = [1, 4, 4]
|
|
613
|
+
input_sizes = [4, 37, 17]
|
|
614
|
+
output_sizes = [4, 17, 37]
|
|
615
|
+
for i, _ in enumerate(in_sizes):
|
|
616
|
+
in_size = int(in_sizes[i])
|
|
617
|
+
input_size = int(input_sizes[i])
|
|
618
|
+
output_size = int(output_sizes[i])
|
|
619
|
+
linear = torch.nn.Linear(input_size, output_size, bias=True).eval()
|
|
620
|
+
example_input = (torch.randn(in_size, input_size),)
|
|
621
|
+
|
|
622
|
+
self.lower_and_test_with_partitioner(
|
|
623
|
+
linear, example_input, func_name=inspect.stack()[0].function[5:]
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
def test_mps_backend_full_ones_default(self):
|
|
627
|
+
class Ones(torch.nn.Module):
|
|
628
|
+
def __init__(self):
|
|
629
|
+
super().__init__()
|
|
630
|
+
|
|
631
|
+
def forward(self):
|
|
632
|
+
size = (4, 37, 17)
|
|
633
|
+
return torch.ones(size)
|
|
634
|
+
|
|
635
|
+
self.lower_and_test_with_partitioner(
|
|
636
|
+
Ones(), (), func_name=inspect.stack()[0].function[5:]
|
|
637
|
+
)
|
|
638
|
+
|
|
639
|
+
def test_mps_backend_full_zeros_default(self):
|
|
640
|
+
class Zeros(torch.nn.Module):
|
|
641
|
+
def __init__(self):
|
|
642
|
+
super().__init__()
|
|
643
|
+
|
|
644
|
+
def forward(self):
|
|
645
|
+
size = (4, 37, 17)
|
|
646
|
+
return torch.zeros(size=size)
|
|
647
|
+
|
|
648
|
+
self.lower_and_test_with_partitioner(
|
|
649
|
+
Zeros(), (), func_name=inspect.stack()[0].function[5:]
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
def test_mps_backend_full_default(self):
|
|
653
|
+
class Full(torch.nn.Module):
|
|
654
|
+
def __init__(self):
|
|
655
|
+
super().__init__()
|
|
656
|
+
|
|
657
|
+
def forward(self):
|
|
658
|
+
size = (4, 37, 17)
|
|
659
|
+
return torch.full(size=size, fill_value=2.0)
|
|
660
|
+
|
|
661
|
+
self.lower_and_test_with_partitioner(
|
|
662
|
+
Full(), (), func_name=inspect.stack()[0].function[5:]
|
|
663
|
+
)
|
|
664
|
+
|
|
665
|
+
def test_mps_backend_full_like(self):
|
|
666
|
+
class Full_Like(torch.nn.Module):
|
|
667
|
+
def __init__(self):
|
|
668
|
+
super().__init__()
|
|
669
|
+
|
|
670
|
+
def forward(self, x):
|
|
671
|
+
return torch.full_like(x, fill_value=2.0)
|
|
672
|
+
|
|
673
|
+
const_module = Full_Like()
|
|
674
|
+
model_inputs = (torch.randn(4, 37, 17),)
|
|
675
|
+
|
|
676
|
+
self.lower_and_test_with_partitioner(
|
|
677
|
+
const_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
def test_mps_backend_logit_1(self):
|
|
681
|
+
class LogitModule(torch.nn.Module):
|
|
682
|
+
def __init__(self):
|
|
683
|
+
super().__init__()
|
|
684
|
+
|
|
685
|
+
def forward(self, x):
|
|
686
|
+
z = torch.ops.aten.logit.default(x)
|
|
687
|
+
return z
|
|
688
|
+
|
|
689
|
+
logit_module = LogitModule()
|
|
690
|
+
model_inputs = (torch.rand(5),)
|
|
691
|
+
|
|
692
|
+
self.lower_and_test_with_partitioner(
|
|
693
|
+
logit_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
694
|
+
)
|
|
695
|
+
|
|
696
|
+
def test_mps_backend_logit_2(self):
|
|
697
|
+
class LogitModule(torch.nn.Module):
|
|
698
|
+
def __init__(self):
|
|
699
|
+
super().__init__()
|
|
700
|
+
|
|
701
|
+
def forward(self, x):
|
|
702
|
+
z = torch.ops.aten.logit.default(x, eps=1e-6)
|
|
703
|
+
return z
|
|
704
|
+
|
|
705
|
+
logit_module = LogitModule()
|
|
706
|
+
model_inputs = (torch.rand(5),)
|
|
707
|
+
|
|
708
|
+
self.lower_and_test_with_partitioner(
|
|
709
|
+
logit_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
710
|
+
)
|
|
711
|
+
|
|
712
|
+
def test_mps_backend_round(self):
|
|
713
|
+
class RoundModule(torch.nn.Module):
|
|
714
|
+
def __init__(self):
|
|
715
|
+
super().__init__()
|
|
716
|
+
|
|
717
|
+
def forward(self, x):
|
|
718
|
+
out = torch.round(x)
|
|
719
|
+
return out
|
|
720
|
+
|
|
721
|
+
module = RoundModule()
|
|
722
|
+
model_inputs = (torch.randn(5, 2),)
|
|
723
|
+
|
|
724
|
+
self.lower_and_test_with_partitioner(
|
|
725
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
def test_mps_backend_amax(self):
|
|
729
|
+
class AmaxModule(torch.nn.Module):
|
|
730
|
+
def __init__(self):
|
|
731
|
+
super().__init__()
|
|
732
|
+
|
|
733
|
+
def forward(self, x):
|
|
734
|
+
out = torch.amax(x, 1)
|
|
735
|
+
return out
|
|
736
|
+
|
|
737
|
+
module = AmaxModule()
|
|
738
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
739
|
+
|
|
740
|
+
self.lower_and_test_with_partitioner(
|
|
741
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
def test_mps_backend_amin(self):
|
|
745
|
+
class AminModule(torch.nn.Module):
|
|
746
|
+
def __init__(self):
|
|
747
|
+
super().__init__()
|
|
748
|
+
|
|
749
|
+
def forward(self, x):
|
|
750
|
+
out = torch.amin(x, 1)
|
|
751
|
+
return out
|
|
752
|
+
|
|
753
|
+
module = AminModule()
|
|
754
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
755
|
+
|
|
756
|
+
self.lower_and_test_with_partitioner(
|
|
757
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
758
|
+
)
|
|
759
|
+
|
|
760
|
+
@unittest.skip
|
|
761
|
+
def test_mps_backend_min_dim(self):
|
|
762
|
+
class MinModule(torch.nn.Module):
|
|
763
|
+
def __init__(self):
|
|
764
|
+
super().__init__()
|
|
765
|
+
|
|
766
|
+
def forward(self, x):
|
|
767
|
+
out = torch.min(x, 1)
|
|
768
|
+
return out
|
|
769
|
+
|
|
770
|
+
module = MinModule()
|
|
771
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
772
|
+
|
|
773
|
+
self.lower_and_test_with_partitioner(
|
|
774
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
775
|
+
)
|
|
776
|
+
|
|
777
|
+
def test_mps_backend_argmax_1(self):
|
|
778
|
+
class ArgmaxModule(torch.nn.Module):
|
|
779
|
+
def __init__(self):
|
|
780
|
+
super().__init__()
|
|
781
|
+
|
|
782
|
+
def forward(self, x):
|
|
783
|
+
out1 = torch.argmax(x, 1)
|
|
784
|
+
return out1
|
|
785
|
+
|
|
786
|
+
module = ArgmaxModule()
|
|
787
|
+
model_inputs = (torch.randn(5, 10),)
|
|
788
|
+
|
|
789
|
+
self.lower_and_test_with_partitioner(
|
|
790
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
791
|
+
)
|
|
792
|
+
|
|
793
|
+
def test_mps_backend_argmax_2(self):
|
|
794
|
+
class ArgmaxModule(torch.nn.Module):
|
|
795
|
+
def __init__(self):
|
|
796
|
+
super().__init__()
|
|
797
|
+
|
|
798
|
+
def forward(self, x):
|
|
799
|
+
out1 = torch.argmax(x)
|
|
800
|
+
return out1
|
|
801
|
+
|
|
802
|
+
module = ArgmaxModule()
|
|
803
|
+
model_inputs = (torch.randn(5, 10),)
|
|
804
|
+
|
|
805
|
+
self.lower_and_test_with_partitioner(
|
|
806
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
807
|
+
)
|
|
808
|
+
|
|
809
|
+
def test_mps_backend_argmin_1(self):
|
|
810
|
+
class ArgminModule(torch.nn.Module):
|
|
811
|
+
def __init__(self):
|
|
812
|
+
super().__init__()
|
|
813
|
+
|
|
814
|
+
def forward(self, x):
|
|
815
|
+
out1 = torch.argmin(x, 1)
|
|
816
|
+
return out1
|
|
817
|
+
|
|
818
|
+
module = ArgminModule()
|
|
819
|
+
model_inputs = (torch.randn(5, 10),)
|
|
820
|
+
|
|
821
|
+
self.lower_and_test_with_partitioner(
|
|
822
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
823
|
+
)
|
|
824
|
+
|
|
825
|
+
def test_mps_backend_argmin_2(self):
|
|
826
|
+
class ArgminModule(torch.nn.Module):
|
|
827
|
+
def __init__(self):
|
|
828
|
+
super().__init__()
|
|
829
|
+
|
|
830
|
+
def forward(self, x):
|
|
831
|
+
out1 = torch.argmin(x)
|
|
832
|
+
return out1
|
|
833
|
+
|
|
834
|
+
module = ArgminModule()
|
|
835
|
+
model_inputs = (torch.randn(5, 10),)
|
|
836
|
+
|
|
837
|
+
self.lower_and_test_with_partitioner(
|
|
838
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
839
|
+
)
|
|
840
|
+
|
|
841
|
+
def test_mps_backend_minimum(self):
|
|
842
|
+
class MinimumModule(torch.nn.Module):
|
|
843
|
+
def __init__(
|
|
844
|
+
self,
|
|
845
|
+
):
|
|
846
|
+
super().__init__()
|
|
847
|
+
self.minimum_module = torch.minimum
|
|
848
|
+
|
|
849
|
+
def forward(self, x, y):
|
|
850
|
+
return self.minimum_module(x, y)
|
|
851
|
+
|
|
852
|
+
module = MinimumModule()
|
|
853
|
+
model_inputs = (
|
|
854
|
+
torch.randn(1, 3, 6),
|
|
855
|
+
torch.randn(1, 3, 6),
|
|
856
|
+
)
|
|
857
|
+
self.lower_and_test_with_partitioner(
|
|
858
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
859
|
+
)
|
|
860
|
+
|
|
861
|
+
def test_mps_backend_eq_tensor_1(self):
|
|
862
|
+
class EqModule(torch.nn.Module):
|
|
863
|
+
def __init__(self):
|
|
864
|
+
super().__init__()
|
|
865
|
+
|
|
866
|
+
def forward(self, x, y):
|
|
867
|
+
out = torch.eq(x, y)
|
|
868
|
+
return out
|
|
869
|
+
|
|
870
|
+
module = EqModule()
|
|
871
|
+
model_inputs = (
|
|
872
|
+
torch.randn(2, 3, 4),
|
|
873
|
+
torch.randn(2, 3, 4),
|
|
874
|
+
)
|
|
875
|
+
|
|
876
|
+
self.lower_and_test_with_partitioner(
|
|
877
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
878
|
+
)
|
|
879
|
+
|
|
880
|
+
def test_mps_backend_eq_tensor_2(self):
|
|
881
|
+
class EqModule(torch.nn.Module):
|
|
882
|
+
def __init__(self):
|
|
883
|
+
super().__init__()
|
|
884
|
+
|
|
885
|
+
def forward(self, x, y):
|
|
886
|
+
out = torch.eq(x, y)
|
|
887
|
+
return out
|
|
888
|
+
|
|
889
|
+
module = EqModule()
|
|
890
|
+
input_tensor = torch.randn(2, 3, 4)
|
|
891
|
+
model_inputs = (input_tensor, input_tensor)
|
|
892
|
+
|
|
893
|
+
self.lower_and_test_with_partitioner(
|
|
894
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
895
|
+
)
|
|
896
|
+
|
|
897
|
+
def test_mps_backend_eq_scalar(self):
|
|
898
|
+
class EqModule(torch.nn.Module):
|
|
899
|
+
def __init__(self):
|
|
900
|
+
super().__init__()
|
|
901
|
+
|
|
902
|
+
def forward(self, x):
|
|
903
|
+
out = torch.eq(x, 1.0)
|
|
904
|
+
return out
|
|
905
|
+
|
|
906
|
+
module = EqModule()
|
|
907
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
908
|
+
|
|
909
|
+
self.lower_and_test_with_partitioner(
|
|
910
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
911
|
+
)
|
|
912
|
+
|
|
913
|
+
def test_mps_backend_ne_tensor_1(self):
|
|
914
|
+
class NeModule(torch.nn.Module):
|
|
915
|
+
def __init__(self):
|
|
916
|
+
super().__init__()
|
|
917
|
+
|
|
918
|
+
def forward(self, x, y):
|
|
919
|
+
out = torch.ne(x, y)
|
|
920
|
+
return out
|
|
921
|
+
|
|
922
|
+
module = NeModule()
|
|
923
|
+
model_inputs = (
|
|
924
|
+
torch.randn(2, 3, 4),
|
|
925
|
+
torch.randn(2, 3, 4),
|
|
926
|
+
)
|
|
927
|
+
|
|
928
|
+
self.lower_and_test_with_partitioner(
|
|
929
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
930
|
+
)
|
|
931
|
+
|
|
932
|
+
def test_mps_backend_ne_tensor_2(self):
|
|
933
|
+
class NeModule(torch.nn.Module):
|
|
934
|
+
def __init__(self):
|
|
935
|
+
super().__init__()
|
|
936
|
+
|
|
937
|
+
def forward(self, x, y):
|
|
938
|
+
out = torch.ne(x, y)
|
|
939
|
+
return out
|
|
940
|
+
|
|
941
|
+
module = NeModule()
|
|
942
|
+
input_tensor = torch.randn(2, 3, 4)
|
|
943
|
+
model_inputs = (input_tensor, input_tensor)
|
|
944
|
+
|
|
945
|
+
self.lower_and_test_with_partitioner(
|
|
946
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
947
|
+
)
|
|
948
|
+
|
|
949
|
+
def test_mps_backend_ne_scalar(self):
|
|
950
|
+
class NeModule(torch.nn.Module):
|
|
951
|
+
def __init__(self):
|
|
952
|
+
super().__init__()
|
|
953
|
+
|
|
954
|
+
def forward(self, x):
|
|
955
|
+
out = torch.ne(x, 1.0)
|
|
956
|
+
return out
|
|
957
|
+
|
|
958
|
+
module = NeModule()
|
|
959
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
960
|
+
|
|
961
|
+
self.lower_and_test_with_partitioner(
|
|
962
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
def test_mps_backend_ge_tensor_1(self):
|
|
966
|
+
class GeModule(torch.nn.Module):
|
|
967
|
+
def __init__(self):
|
|
968
|
+
super().__init__()
|
|
969
|
+
|
|
970
|
+
def forward(self, x, y):
|
|
971
|
+
out = torch.ge(x, y)
|
|
972
|
+
return out
|
|
973
|
+
|
|
974
|
+
module = GeModule()
|
|
975
|
+
model_inputs = (torch.randn(2, 3, 4), torch.randn(2, 3, 4))
|
|
976
|
+
|
|
977
|
+
self.lower_and_test_with_partitioner(
|
|
978
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
979
|
+
)
|
|
980
|
+
|
|
981
|
+
def test_mps_backend_ge_tensor_2(self):
|
|
982
|
+
class GeModule(torch.nn.Module):
|
|
983
|
+
def __init__(self):
|
|
984
|
+
super().__init__()
|
|
985
|
+
|
|
986
|
+
def forward(self, x, y):
|
|
987
|
+
out = torch.ge(x, y)
|
|
988
|
+
return out
|
|
989
|
+
|
|
990
|
+
module = GeModule()
|
|
991
|
+
|
|
992
|
+
input_tensor = torch.randn(2, 3, 4)
|
|
993
|
+
model_inputs = (input_tensor, input_tensor)
|
|
994
|
+
|
|
995
|
+
self.lower_and_test_with_partitioner(
|
|
996
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
997
|
+
)
|
|
998
|
+
|
|
999
|
+
def test_mps_backend_ge_scalar(self):
|
|
1000
|
+
class GeModule(torch.nn.Module):
|
|
1001
|
+
def __init__(self):
|
|
1002
|
+
super().__init__()
|
|
1003
|
+
|
|
1004
|
+
def forward(self, x):
|
|
1005
|
+
out = torch.ge(x, 1.0)
|
|
1006
|
+
return out
|
|
1007
|
+
|
|
1008
|
+
module = GeModule()
|
|
1009
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
1010
|
+
|
|
1011
|
+
self.lower_and_test_with_partitioner(
|
|
1012
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1013
|
+
)
|
|
1014
|
+
|
|
1015
|
+
def test_mps_backend_gt_tensor_1(self):
|
|
1016
|
+
class GtModule(torch.nn.Module):
|
|
1017
|
+
def __init__(self):
|
|
1018
|
+
super().__init__()
|
|
1019
|
+
|
|
1020
|
+
def forward(self, x, y):
|
|
1021
|
+
out = torch.gt(x, y)
|
|
1022
|
+
return out
|
|
1023
|
+
|
|
1024
|
+
module = GtModule()
|
|
1025
|
+
model_inputs = (torch.randn(2, 3, 4), torch.randn(2, 3, 4))
|
|
1026
|
+
|
|
1027
|
+
self.lower_and_test_with_partitioner(
|
|
1028
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1029
|
+
)
|
|
1030
|
+
|
|
1031
|
+
def test_mps_backend_gt_tensor_2(self):
|
|
1032
|
+
class GtModule(torch.nn.Module):
|
|
1033
|
+
def __init__(self):
|
|
1034
|
+
super().__init__()
|
|
1035
|
+
|
|
1036
|
+
def forward(self, x, y):
|
|
1037
|
+
out = torch.gt(x, y)
|
|
1038
|
+
return out
|
|
1039
|
+
|
|
1040
|
+
module = GtModule()
|
|
1041
|
+
input_tensor = torch.randn(2, 3, 4)
|
|
1042
|
+
model_inputs = (input_tensor, input_tensor)
|
|
1043
|
+
|
|
1044
|
+
self.lower_and_test_with_partitioner(
|
|
1045
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
|
+
def test_mps_backend_gt_scalar(self):
|
|
1049
|
+
class GtModule(torch.nn.Module):
|
|
1050
|
+
def __init__(self):
|
|
1051
|
+
super().__init__()
|
|
1052
|
+
|
|
1053
|
+
def forward(self, x):
|
|
1054
|
+
out = torch.gt(x, 1.0)
|
|
1055
|
+
return out
|
|
1056
|
+
|
|
1057
|
+
module = GtModule()
|
|
1058
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
1059
|
+
|
|
1060
|
+
self.lower_and_test_with_partitioner(
|
|
1061
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1062
|
+
)
|
|
1063
|
+
|
|
1064
|
+
def test_mps_backend_isnan(self):
|
|
1065
|
+
class IsNanModule(torch.nn.Module):
|
|
1066
|
+
def __init__(self):
|
|
1067
|
+
super().__init__()
|
|
1068
|
+
|
|
1069
|
+
def forward(self, x):
|
|
1070
|
+
return torch.isnan(x)
|
|
1071
|
+
|
|
1072
|
+
module = IsNanModule()
|
|
1073
|
+
model_inputs = (
|
|
1074
|
+
torch.randn(8, 3, 4, 5).index_put_(
|
|
1075
|
+
indices=[torch.tensor([random.randrange(0, 8)])],
|
|
1076
|
+
values=torch.tensor(float("nan")),
|
|
1077
|
+
),
|
|
1078
|
+
)
|
|
1079
|
+
self.lower_and_test_with_partitioner(
|
|
1080
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1081
|
+
)
|
|
1082
|
+
|
|
1083
|
+
def test_mps_backend_partitioner(self):
|
|
1084
|
+
# `index.Tensor`` is not yet natively supported
|
|
1085
|
+
# It will fall back to MPSPartitioner. Once implemented,
|
|
1086
|
+
# replace the op with an unsupported one.
|
|
1087
|
+
class IndexTensorModule(torch.nn.Module):
|
|
1088
|
+
def __init__(self):
|
|
1089
|
+
super().__init__()
|
|
1090
|
+
self.indices = torch.tensor([0, 5, 2, 3])
|
|
1091
|
+
|
|
1092
|
+
def forward(self, x):
|
|
1093
|
+
y = torch.add(x, 2.0)
|
|
1094
|
+
z = y[self.indices]
|
|
1095
|
+
r = z + x[self.indices]
|
|
1096
|
+
d = r - 2
|
|
1097
|
+
p = torch.pow(d, 4)
|
|
1098
|
+
return p / 10
|
|
1099
|
+
|
|
1100
|
+
module = IndexTensorModule()
|
|
1101
|
+
|
|
1102
|
+
model_inputs = (torch.randn(8, 3, 4, 5),)
|
|
1103
|
+
self.lower_and_test_with_partitioner(
|
|
1104
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1105
|
+
)
|
|
1106
|
+
|
|
1107
|
+
def test_mps_indexing_get_1(self):
|
|
1108
|
+
class IndexGet(torch.nn.Module):
|
|
1109
|
+
def __init__(self):
|
|
1110
|
+
super().__init__()
|
|
1111
|
+
|
|
1112
|
+
def forward(self, x):
|
|
1113
|
+
return x[[0, 1, 2], [0, 1, 0]]
|
|
1114
|
+
|
|
1115
|
+
module = IndexGet()
|
|
1116
|
+
model_inputs = (torch.tensor([[1, 2], [3, 4], [5, 6]]),)
|
|
1117
|
+
|
|
1118
|
+
self.lower_and_test_with_partitioner(
|
|
1119
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1120
|
+
)
|
|
1121
|
+
|
|
1122
|
+
def test_mps_indexing_get_2(self):
|
|
1123
|
+
class IndexGet(torch.nn.Module):
|
|
1124
|
+
def __init__(self):
|
|
1125
|
+
super().__init__()
|
|
1126
|
+
|
|
1127
|
+
def forward(self, x):
|
|
1128
|
+
return x[:, [0, 4, 2]]
|
|
1129
|
+
|
|
1130
|
+
module = IndexGet()
|
|
1131
|
+
model_inputs = (torch.randn(5, 7, 3),)
|
|
1132
|
+
|
|
1133
|
+
self.lower_and_test_with_partitioner(
|
|
1134
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1135
|
+
)
|
|
1136
|
+
|
|
1137
|
+
def test_mps_indexing_get_3(self):
|
|
1138
|
+
class IndexGet(torch.nn.Module):
|
|
1139
|
+
def __init__(self):
|
|
1140
|
+
super().__init__()
|
|
1141
|
+
|
|
1142
|
+
def forward(self, x):
|
|
1143
|
+
return x[:, [[0, 1], [4, 3]]]
|
|
1144
|
+
|
|
1145
|
+
module = IndexGet()
|
|
1146
|
+
model_inputs = (torch.randn(5, 7, 3),)
|
|
1147
|
+
|
|
1148
|
+
self.lower_and_test_with_partitioner(
|
|
1149
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1150
|
+
)
|
|
1151
|
+
|
|
1152
|
+
def test_mps_indexing_get_4(self):
|
|
1153
|
+
class IndexGet(torch.nn.Module):
|
|
1154
|
+
def __init__(self):
|
|
1155
|
+
super().__init__()
|
|
1156
|
+
|
|
1157
|
+
def forward(self, x):
|
|
1158
|
+
return x[[0, 4, 2]]
|
|
1159
|
+
|
|
1160
|
+
module = IndexGet()
|
|
1161
|
+
model_inputs = (torch.randn(5, 7, 3),)
|
|
1162
|
+
|
|
1163
|
+
self.lower_and_test_with_partitioner(
|
|
1164
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1165
|
+
)
|
|
1166
|
+
|
|
1167
|
+
def test_mps_indexing_get_5(self):
|
|
1168
|
+
class IndexGet(torch.nn.Module):
|
|
1169
|
+
def __init__(self):
|
|
1170
|
+
super().__init__()
|
|
1171
|
+
|
|
1172
|
+
def forward(self, x):
|
|
1173
|
+
return x[[0, 2, 1], :, 0]
|
|
1174
|
+
|
|
1175
|
+
module = IndexGet()
|
|
1176
|
+
model_inputs = (torch.ones(3, 2, 4),)
|
|
1177
|
+
|
|
1178
|
+
self.lower_and_test_with_partitioner(
|
|
1179
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1180
|
+
)
|
|
1181
|
+
|
|
1182
|
+
def test_mps_indices2d(self):
|
|
1183
|
+
class IndexGet(torch.nn.Module):
|
|
1184
|
+
def __init__(self):
|
|
1185
|
+
super().__init__()
|
|
1186
|
+
|
|
1187
|
+
def forward(self, x, rows, columns):
|
|
1188
|
+
return x[rows, columns]
|
|
1189
|
+
|
|
1190
|
+
module = IndexGet()
|
|
1191
|
+
x = torch.arange(0, 12).resize(4, 3)
|
|
1192
|
+
rows = torch.tensor([[0, 0], [3, 3]])
|
|
1193
|
+
columns = torch.tensor([[0, 2], [0, 2]])
|
|
1194
|
+
model_inputs = (
|
|
1195
|
+
x,
|
|
1196
|
+
rows,
|
|
1197
|
+
columns,
|
|
1198
|
+
)
|
|
1199
|
+
|
|
1200
|
+
self.lower_and_test_with_partitioner(
|
|
1201
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1202
|
+
)
|
|
1203
|
+
|
|
1204
|
+
def test_mps_slicing_using_advanced_index_for_column_0(self):
|
|
1205
|
+
class IndexGet(torch.nn.Module):
|
|
1206
|
+
def __init__(self):
|
|
1207
|
+
super().__init__()
|
|
1208
|
+
|
|
1209
|
+
def forward(self, x):
|
|
1210
|
+
return x[1:4]
|
|
1211
|
+
|
|
1212
|
+
module = IndexGet()
|
|
1213
|
+
model_inputs = (torch.tensor([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]),)
|
|
1214
|
+
|
|
1215
|
+
self.lower_and_test_with_partitioner(
|
|
1216
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1217
|
+
)
|
|
1218
|
+
|
|
1219
|
+
def test_mps_slicing_using_advanced_index_for_column_1(self):
|
|
1220
|
+
class IndexGet(torch.nn.Module):
|
|
1221
|
+
def __init__(self):
|
|
1222
|
+
super().__init__()
|
|
1223
|
+
|
|
1224
|
+
def forward(self, x):
|
|
1225
|
+
# using advanced index for column
|
|
1226
|
+
return x[1:4, [1, 2]]
|
|
1227
|
+
|
|
1228
|
+
module = IndexGet()
|
|
1229
|
+
model_inputs = (torch.tensor([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]),)
|
|
1230
|
+
|
|
1231
|
+
self.lower_and_test_with_partitioner(
|
|
1232
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1233
|
+
)
|
|
1234
|
+
|
|
1235
|
+
@unittest.skip
|
|
1236
|
+
def test_boolean_array_indexing(self):
|
|
1237
|
+
class IndexGet(torch.nn.Module):
|
|
1238
|
+
def __init__(self):
|
|
1239
|
+
super().__init__()
|
|
1240
|
+
|
|
1241
|
+
def forward(self, x):
|
|
1242
|
+
return x[x > 5]
|
|
1243
|
+
|
|
1244
|
+
module = IndexGet()
|
|
1245
|
+
model_inputs = (torch.tensor([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]),)
|
|
1246
|
+
|
|
1247
|
+
self.lower_and_test_with_partitioner(
|
|
1248
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1249
|
+
)
|
|
1250
|
+
|
|
1251
|
+
def test_mps_backend_isinf(self):
|
|
1252
|
+
class IsInfModule(torch.nn.Module):
|
|
1253
|
+
def __init__(self):
|
|
1254
|
+
super().__init__()
|
|
1255
|
+
|
|
1256
|
+
def forward(self, x):
|
|
1257
|
+
return torch.isinf(x)
|
|
1258
|
+
|
|
1259
|
+
module = IsInfModule()
|
|
1260
|
+
model_inputs = (
|
|
1261
|
+
torch.randn(8, 3, 4, 5).index_put_(
|
|
1262
|
+
indices=[torch.tensor([random.randrange(0, 8)])],
|
|
1263
|
+
values=torch.tensor(float("inf")),
|
|
1264
|
+
),
|
|
1265
|
+
)
|
|
1266
|
+
self.lower_and_test_with_partitioner(
|
|
1267
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1268
|
+
)
|
|
1269
|
+
|
|
1270
|
+
def test_mps_backend_le_tensor_1(self):
|
|
1271
|
+
class LeModule(torch.nn.Module):
|
|
1272
|
+
def __init__(self):
|
|
1273
|
+
super().__init__()
|
|
1274
|
+
|
|
1275
|
+
def forward(self, x, y):
|
|
1276
|
+
out = torch.le(x, y)
|
|
1277
|
+
return out
|
|
1278
|
+
|
|
1279
|
+
module = LeModule()
|
|
1280
|
+
model_inputs = (torch.randn(2, 3, 4), torch.randn(2, 3, 4))
|
|
1281
|
+
|
|
1282
|
+
self.lower_and_test_with_partitioner(
|
|
1283
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1284
|
+
)
|
|
1285
|
+
|
|
1286
|
+
def test_mps_backend_le_tensor_2(self):
|
|
1287
|
+
class LeModule(torch.nn.Module):
|
|
1288
|
+
def __init__(self):
|
|
1289
|
+
super().__init__()
|
|
1290
|
+
|
|
1291
|
+
def forward(self, x, y):
|
|
1292
|
+
out = torch.le(x, y)
|
|
1293
|
+
return out
|
|
1294
|
+
|
|
1295
|
+
module = LeModule()
|
|
1296
|
+
input_tensor = torch.randn(2, 3, 4)
|
|
1297
|
+
model_inputs = (input_tensor, input_tensor)
|
|
1298
|
+
|
|
1299
|
+
self.lower_and_test_with_partitioner(
|
|
1300
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1301
|
+
)
|
|
1302
|
+
|
|
1303
|
+
def test_mps_backend_le_scalar(self):
|
|
1304
|
+
class LeModule(torch.nn.Module):
|
|
1305
|
+
def __init__(self):
|
|
1306
|
+
super().__init__()
|
|
1307
|
+
|
|
1308
|
+
def forward(self, x):
|
|
1309
|
+
out = torch.le(x, 1.0)
|
|
1310
|
+
return out
|
|
1311
|
+
|
|
1312
|
+
module = LeModule()
|
|
1313
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
1314
|
+
|
|
1315
|
+
self.lower_and_test_with_partitioner(
|
|
1316
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1317
|
+
)
|
|
1318
|
+
|
|
1319
|
+
def test_mps_backend_lt_tensor_1(self):
|
|
1320
|
+
class LtModule(torch.nn.Module):
|
|
1321
|
+
def __init__(self):
|
|
1322
|
+
super().__init__()
|
|
1323
|
+
|
|
1324
|
+
def forward(self, x, y):
|
|
1325
|
+
out = torch.lt(x, y)
|
|
1326
|
+
return out
|
|
1327
|
+
|
|
1328
|
+
module = LtModule()
|
|
1329
|
+
model_inputs = (torch.randn(2, 3, 4), torch.randn(2, 3, 4))
|
|
1330
|
+
|
|
1331
|
+
self.lower_and_test_with_partitioner(
|
|
1332
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1333
|
+
)
|
|
1334
|
+
|
|
1335
|
+
def test_mps_backend_lt_tensor_2(self):
|
|
1336
|
+
class LtModule(torch.nn.Module):
|
|
1337
|
+
def __init__(self):
|
|
1338
|
+
super().__init__()
|
|
1339
|
+
|
|
1340
|
+
def forward(self, x, y):
|
|
1341
|
+
out = torch.le(x, y)
|
|
1342
|
+
return out
|
|
1343
|
+
|
|
1344
|
+
module = LtModule()
|
|
1345
|
+
input_tensor = torch.randn(2, 3, 4)
|
|
1346
|
+
model_inputs = (input_tensor, input_tensor)
|
|
1347
|
+
|
|
1348
|
+
self.lower_and_test_with_partitioner(
|
|
1349
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1350
|
+
)
|
|
1351
|
+
|
|
1352
|
+
def test_mps_backend_lt_scalar(self):
|
|
1353
|
+
class LtModule(torch.nn.Module):
|
|
1354
|
+
def __init__(self):
|
|
1355
|
+
super().__init__()
|
|
1356
|
+
|
|
1357
|
+
def forward(self, x):
|
|
1358
|
+
out = torch.lt(x, 1.0)
|
|
1359
|
+
return out
|
|
1360
|
+
|
|
1361
|
+
module = LtModule()
|
|
1362
|
+
model_inputs = (torch.randn(2, 3, 4),)
|
|
1363
|
+
|
|
1364
|
+
self.lower_and_test_with_partitioner(
|
|
1365
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1366
|
+
)
|
|
1367
|
+
|
|
1368
|
+
@torch.inference_mode() # TODO Use for capturing.
|
|
1369
|
+
def test_mps_backend_linear(self):
|
|
1370
|
+
in_size = 2
|
|
1371
|
+
input_size = 3
|
|
1372
|
+
output_size = 4
|
|
1373
|
+
linear = torch.nn.Linear(input_size, output_size).eval()
|
|
1374
|
+
example_input = (torch.randn(in_size, input_size),)
|
|
1375
|
+
|
|
1376
|
+
self.lower_and_test_with_partitioner(
|
|
1377
|
+
linear, example_input, func_name=inspect.stack()[0].function[5:]
|
|
1378
|
+
)
|
|
1379
|
+
|
|
1380
|
+
def test_mps_backend_glu(self):
|
|
1381
|
+
class GLUModule(torch.nn.Module):
|
|
1382
|
+
def __init__(self, dim):
|
|
1383
|
+
super().__init__()
|
|
1384
|
+
self.glu = torch.nn.GLU(dim=dim)
|
|
1385
|
+
|
|
1386
|
+
def forward(self, x):
|
|
1387
|
+
return self.glu(x)
|
|
1388
|
+
|
|
1389
|
+
shape = (4, 2)
|
|
1390
|
+
for dim in list(range(len(shape))) + [-1]:
|
|
1391
|
+
model_inputs = (torch.rand(shape),)
|
|
1392
|
+
glu_module = GLUModule(dim)
|
|
1393
|
+
self.lower_and_test_with_partitioner(
|
|
1394
|
+
glu_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1395
|
+
)
|
|
1396
|
+
|
|
1397
|
+
def test_mps_backend_softmax(self):
|
|
1398
|
+
class SoftMaxModule(torch.nn.Module):
|
|
1399
|
+
def __init__(self, dim):
|
|
1400
|
+
super().__init__()
|
|
1401
|
+
self.softmax = torch.nn.Softmax(dim=dim)
|
|
1402
|
+
|
|
1403
|
+
def forward(self, x):
|
|
1404
|
+
return self.softmax(x)
|
|
1405
|
+
|
|
1406
|
+
shape = (3, 5, 7)
|
|
1407
|
+
for dim in list(range(len(shape))) + [-1]:
|
|
1408
|
+
model_inputs = (torch.rand(shape),)
|
|
1409
|
+
softmax_module = SoftMaxModule(dim)
|
|
1410
|
+
self.lower_and_test_with_partitioner(
|
|
1411
|
+
softmax_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1412
|
+
)
|
|
1413
|
+
|
|
1414
|
+
def test_mps_backend_log_softmax(self):
|
|
1415
|
+
class LogSoftMaxModule(torch.nn.Module):
|
|
1416
|
+
def __init__(self, dim):
|
|
1417
|
+
super().__init__()
|
|
1418
|
+
self.logsoftmax = torch.nn.LogSoftmax(dim=dim)
|
|
1419
|
+
|
|
1420
|
+
def forward(self, x):
|
|
1421
|
+
return self.logsoftmax(x)
|
|
1422
|
+
|
|
1423
|
+
shape = (3, 5, 7)
|
|
1424
|
+
for dim in list(range(len(shape))) + [-1]:
|
|
1425
|
+
model_inputs = (torch.rand(shape),)
|
|
1426
|
+
logsoftmax_module = LogSoftMaxModule(dim)
|
|
1427
|
+
|
|
1428
|
+
self.lower_and_test_with_partitioner(
|
|
1429
|
+
logsoftmax_module,
|
|
1430
|
+
model_inputs,
|
|
1431
|
+
func_name=inspect.stack()[0].function[5:],
|
|
1432
|
+
)
|
|
1433
|
+
|
|
1434
|
+
def test_mps_backend_hardtanh(self):
|
|
1435
|
+
class HardTanhModule(torch.nn.Module):
|
|
1436
|
+
def __init__(self, min_val=-1.0, max_val=1.0):
|
|
1437
|
+
super().__init__()
|
|
1438
|
+
self.hardtanh = torch.nn.Hardtanh(min_val, max_val)
|
|
1439
|
+
|
|
1440
|
+
def forward(self, x):
|
|
1441
|
+
return self.hardtanh(x)
|
|
1442
|
+
|
|
1443
|
+
inputs = [torch.randn(2, 3, 4), torch.randn(7, 5, 2), torch.randn(2, 9)]
|
|
1444
|
+
for test_input in inputs:
|
|
1445
|
+
hardtanh_model = HardTanhModule()
|
|
1446
|
+
self.lower_and_test_with_partitioner(
|
|
1447
|
+
hardtanh_model, (test_input,), func_name=inspect.stack()[0].function[5:]
|
|
1448
|
+
)
|
|
1449
|
+
|
|
1450
|
+
for test_input in inputs:
|
|
1451
|
+
hardtanh_model = HardTanhModule(-2, 2)
|
|
1452
|
+
self.lower_and_test_with_partitioner(
|
|
1453
|
+
hardtanh_model, (test_input,), func_name=inspect.stack()[0].function[5:]
|
|
1454
|
+
)
|
|
1455
|
+
|
|
1456
|
+
def test_mps_backend_Relu(self):
|
|
1457
|
+
class ReluModule(torch.nn.Module):
|
|
1458
|
+
def __init__(self):
|
|
1459
|
+
super().__init__()
|
|
1460
|
+
self.relu = torch.nn.ReLU()
|
|
1461
|
+
|
|
1462
|
+
def forward(self, x):
|
|
1463
|
+
return self.relu(x)
|
|
1464
|
+
|
|
1465
|
+
example_input = torch.randn(2, 3, 4)
|
|
1466
|
+
self.lower_and_test_with_partitioner(
|
|
1467
|
+
ReluModule(), (example_input,), func_name=inspect.stack()[0].function[5:]
|
|
1468
|
+
)
|
|
1469
|
+
|
|
1470
|
+
def test_mps_backend_GELU(self):
|
|
1471
|
+
class GELUModule(torch.nn.Module):
|
|
1472
|
+
def __init__(self):
|
|
1473
|
+
super().__init__()
|
|
1474
|
+
self.gelu = torch.nn.GELU()
|
|
1475
|
+
self.gelu_tanh = torch.nn.GELU(approximate="tanh")
|
|
1476
|
+
|
|
1477
|
+
def forward(self, x):
|
|
1478
|
+
return self.gelu(x)
|
|
1479
|
+
# MPS TODO: MPS Gelu tanh fails
|
|
1480
|
+
# return self.gelu_tanh(y)
|
|
1481
|
+
|
|
1482
|
+
example_input = torch.randn(2, 3, 4)
|
|
1483
|
+
self.lower_and_test_with_partitioner(
|
|
1484
|
+
GELUModule(), (example_input,), func_name=inspect.stack()[0].function[5:]
|
|
1485
|
+
)
|
|
1486
|
+
|
|
1487
|
+
def test_mps_backend_leaky_Relu(self):
|
|
1488
|
+
class LeakyReluModule(torch.nn.Module):
|
|
1489
|
+
def __init__(self):
|
|
1490
|
+
super().__init__()
|
|
1491
|
+
self.leaky_relu = torch.nn.LeakyReLU()
|
|
1492
|
+
self.leaky_relu_2 = torch.nn.LeakyReLU(1.0)
|
|
1493
|
+
|
|
1494
|
+
def forward(self, x):
|
|
1495
|
+
out = self.leaky_relu(x)
|
|
1496
|
+
out = self.leaky_relu_2(out)
|
|
1497
|
+
return out
|
|
1498
|
+
|
|
1499
|
+
example_input = torch.randn(2, 3, 4)
|
|
1500
|
+
self.lower_and_test_with_partitioner(
|
|
1501
|
+
LeakyReluModule(),
|
|
1502
|
+
(example_input,),
|
|
1503
|
+
func_name=inspect.stack()[0].function[5:],
|
|
1504
|
+
)
|
|
1505
|
+
|
|
1506
|
+
def test_mps_backend_sigmoid(self):
|
|
1507
|
+
class SigmoidModule(torch.nn.Module):
|
|
1508
|
+
def __init__(self):
|
|
1509
|
+
super().__init__()
|
|
1510
|
+
self.sigmoid = torch.nn.Sigmoid()
|
|
1511
|
+
|
|
1512
|
+
def forward(self, x):
|
|
1513
|
+
return self.sigmoid(x)
|
|
1514
|
+
|
|
1515
|
+
model_inputs = (torch.rand(7, 5, 3),)
|
|
1516
|
+
sigmoid_module = SigmoidModule()
|
|
1517
|
+
self.lower_and_test_with_partitioner(
|
|
1518
|
+
sigmoid_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1519
|
+
)
|
|
1520
|
+
|
|
1521
|
+
def test_mps_backend_constant_pad_nd(self):
|
|
1522
|
+
class PadModule(torch.nn.Module):
|
|
1523
|
+
def __init__(self):
|
|
1524
|
+
super().__init__()
|
|
1525
|
+
self.constant_pad = torch.nn.ConstantPad2d((1, 2), 0)
|
|
1526
|
+
|
|
1527
|
+
def forward(self, x):
|
|
1528
|
+
return self.constant_pad(x)
|
|
1529
|
+
|
|
1530
|
+
model_inputs = (torch.rand(1, 2, 3, 4),)
|
|
1531
|
+
pad_module = PadModule()
|
|
1532
|
+
self.lower_and_test_with_partitioner(
|
|
1533
|
+
pad_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1534
|
+
)
|
|
1535
|
+
|
|
1536
|
+
def test_mps_backend_index_select(self):
|
|
1537
|
+
class IndexSelectModule(torch.nn.Module):
|
|
1538
|
+
def __init__(self):
|
|
1539
|
+
super().__init__()
|
|
1540
|
+
|
|
1541
|
+
def forward(self, input, index):
|
|
1542
|
+
return torch.index_select(input, dim=2, index=index)
|
|
1543
|
+
|
|
1544
|
+
model_inputs = (torch.rand(2, 8, 4, 5), torch.tensor([3, 0, 1]))
|
|
1545
|
+
module = IndexSelectModule()
|
|
1546
|
+
self.lower_and_test_with_partitioner(
|
|
1547
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1548
|
+
)
|
|
1549
|
+
|
|
1550
|
+
def test_mps_backend_empty(self):
|
|
1551
|
+
class EmptyModule(torch.nn.Module):
|
|
1552
|
+
def __init__(self):
|
|
1553
|
+
super().__init__()
|
|
1554
|
+
|
|
1555
|
+
def forward(self):
|
|
1556
|
+
return torch.empty((3, 4, 5), dtype=torch.float32)
|
|
1557
|
+
|
|
1558
|
+
self.lower_and_test_with_partitioner(
|
|
1559
|
+
EmptyModule(), (), func_name=inspect.stack()[0].function[5:]
|
|
1560
|
+
)
|
|
1561
|
+
|
|
1562
|
+
def test_mps_backend_static_constant_pad(self):
|
|
1563
|
+
class StaticConstantPadModule(torch.nn.Module):
|
|
1564
|
+
def __init__(self):
|
|
1565
|
+
super().__init__()
|
|
1566
|
+
|
|
1567
|
+
def forward(self, x, y, z):
|
|
1568
|
+
pad_6 = (1, 2, 3, 4, 5, 6)
|
|
1569
|
+
pad_4 = (1, 2, 3, 4)
|
|
1570
|
+
pad_2 = (1, 2)
|
|
1571
|
+
a = torch.nn.functional.pad(
|
|
1572
|
+
input=x,
|
|
1573
|
+
pad=pad_6,
|
|
1574
|
+
mode="constant",
|
|
1575
|
+
value=2.3,
|
|
1576
|
+
)
|
|
1577
|
+
b = torch.nn.functional.pad(
|
|
1578
|
+
input=x,
|
|
1579
|
+
pad=pad_4,
|
|
1580
|
+
mode="constant",
|
|
1581
|
+
value=1.3,
|
|
1582
|
+
)
|
|
1583
|
+
c = torch.nn.functional.pad(
|
|
1584
|
+
input=x,
|
|
1585
|
+
pad=pad_2,
|
|
1586
|
+
mode="constant",
|
|
1587
|
+
value=2.1,
|
|
1588
|
+
)
|
|
1589
|
+
d = torch.nn.functional.pad(
|
|
1590
|
+
input=y,
|
|
1591
|
+
pad=pad_6,
|
|
1592
|
+
mode="constant",
|
|
1593
|
+
value=2.7,
|
|
1594
|
+
)
|
|
1595
|
+
e = torch.nn.functional.pad(
|
|
1596
|
+
input=y,
|
|
1597
|
+
pad=pad_4,
|
|
1598
|
+
mode="constant",
|
|
1599
|
+
value=1.9,
|
|
1600
|
+
)
|
|
1601
|
+
f = torch.nn.functional.pad(
|
|
1602
|
+
input=y,
|
|
1603
|
+
pad=pad_2,
|
|
1604
|
+
mode="constant",
|
|
1605
|
+
value=3.1,
|
|
1606
|
+
)
|
|
1607
|
+
g = torch.nn.functional.pad(
|
|
1608
|
+
input=z,
|
|
1609
|
+
pad=pad_4,
|
|
1610
|
+
mode="constant",
|
|
1611
|
+
value=2.9,
|
|
1612
|
+
)
|
|
1613
|
+
h = torch.nn.functional.pad(
|
|
1614
|
+
input=z,
|
|
1615
|
+
pad=pad_2,
|
|
1616
|
+
mode="constant",
|
|
1617
|
+
value=1.2,
|
|
1618
|
+
)
|
|
1619
|
+
return (a, b, c, d, e, f, g, h)
|
|
1620
|
+
|
|
1621
|
+
example_inputs = (
|
|
1622
|
+
torch.randn(size=(5, 4, 3, 2)),
|
|
1623
|
+
torch.randn(size=(5, 3, 2)),
|
|
1624
|
+
torch.randn(size=(4, 3)),
|
|
1625
|
+
)
|
|
1626
|
+
self.lower_and_test_with_partitioner(
|
|
1627
|
+
StaticConstantPadModule(),
|
|
1628
|
+
example_inputs,
|
|
1629
|
+
func_name=inspect.stack()[0].function[5:],
|
|
1630
|
+
)
|
|
1631
|
+
|
|
1632
|
+
def test_mps_clamp_min_max(self):
|
|
1633
|
+
class Clamp(torch.nn.Module):
|
|
1634
|
+
def __init__(self, min_val, max_val):
|
|
1635
|
+
super().__init__()
|
|
1636
|
+
self.clamp = torch.clamp
|
|
1637
|
+
self.min_val = min_val
|
|
1638
|
+
self.max_val = max_val
|
|
1639
|
+
|
|
1640
|
+
def forward(self, *x):
|
|
1641
|
+
out1 = self.clamp(x[0], min=-0.5, max=0.5)
|
|
1642
|
+
out2 = self.clamp(x[0], min=-5, max=5)
|
|
1643
|
+
return out1, out2
|
|
1644
|
+
|
|
1645
|
+
model_inputs = (
|
|
1646
|
+
torch.randn(1, 4, 122, 122) * 2,
|
|
1647
|
+
torch.randint(-100, 100, (1, 4, 15, 20)),
|
|
1648
|
+
)
|
|
1649
|
+
module = Clamp(-0.5, 0.5)
|
|
1650
|
+
self.lower_and_test_with_partitioner(
|
|
1651
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1652
|
+
)
|
|
1653
|
+
|
|
1654
|
+
def test_mps_clamp_min(self):
|
|
1655
|
+
class Clamp(torch.nn.Module):
|
|
1656
|
+
def __init__(self, min_val, max_val):
|
|
1657
|
+
super().__init__()
|
|
1658
|
+
self.clamp = torch.clamp
|
|
1659
|
+
self.min_val = min_val
|
|
1660
|
+
self.max_val = max_val
|
|
1661
|
+
|
|
1662
|
+
def forward(self, x):
|
|
1663
|
+
return self.clamp(x, min=self.min_val, max=self.max_val)
|
|
1664
|
+
|
|
1665
|
+
model_inputs = (torch.randn(1, 4, 122, 122) * 2,)
|
|
1666
|
+
module = Clamp(-0.5, None)
|
|
1667
|
+
self.lower_and_test_with_partitioner(
|
|
1668
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1669
|
+
)
|
|
1670
|
+
|
|
1671
|
+
def test_mps_clamp_max(self):
|
|
1672
|
+
class Clamp(torch.nn.Module):
|
|
1673
|
+
def __init__(self, min_val, max_val):
|
|
1674
|
+
super().__init__()
|
|
1675
|
+
self.clamp = torch.clamp
|
|
1676
|
+
self.min_val = min_val
|
|
1677
|
+
self.max_val = max_val
|
|
1678
|
+
|
|
1679
|
+
def forward(self, x):
|
|
1680
|
+
return self.clamp(x, min=self.min_val, max=self.max_val)
|
|
1681
|
+
|
|
1682
|
+
model_inputs = (torch.randn(1, 4, 122, 122) * 2,)
|
|
1683
|
+
module = Clamp(None, 0.5)
|
|
1684
|
+
self.lower_and_test_with_partitioner(
|
|
1685
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1686
|
+
)
|
|
1687
|
+
|
|
1688
|
+
def test_mps_backend_maxpool2d_default(self):
|
|
1689
|
+
class MaxPool2dModule(torch.nn.Module):
|
|
1690
|
+
def __init__(
|
|
1691
|
+
self,
|
|
1692
|
+
kernel_size=3,
|
|
1693
|
+
stride=1,
|
|
1694
|
+
padding=3,
|
|
1695
|
+
dilation=1,
|
|
1696
|
+
):
|
|
1697
|
+
super().__init__()
|
|
1698
|
+
self.max_pool2d_module = torch.nn.MaxPool2d(
|
|
1699
|
+
kernel_size=kernel_size,
|
|
1700
|
+
stride=stride,
|
|
1701
|
+
padding=padding,
|
|
1702
|
+
dilation=dilation,
|
|
1703
|
+
)
|
|
1704
|
+
|
|
1705
|
+
def forward(self, x):
|
|
1706
|
+
return self.max_pool2d_module(x)
|
|
1707
|
+
|
|
1708
|
+
maxpool2d_module = MaxPool2dModule(3, 1, 0, 1)
|
|
1709
|
+
model_inputs = (torch.randn(4, 3, 24, 24),)
|
|
1710
|
+
|
|
1711
|
+
self.lower_and_test_with_partitioner(
|
|
1712
|
+
maxpool2d_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1713
|
+
)
|
|
1714
|
+
|
|
1715
|
+
def test_mps_backend_maxpool2d_unsupported(self):
|
|
1716
|
+
class MaxPool2dModule(torch.nn.Module):
|
|
1717
|
+
def __init__(
|
|
1718
|
+
self,
|
|
1719
|
+
kernel_size=3,
|
|
1720
|
+
stride=1,
|
|
1721
|
+
padding=0,
|
|
1722
|
+
dilation=1,
|
|
1723
|
+
):
|
|
1724
|
+
super().__init__()
|
|
1725
|
+
self.max_pool2d_module = torch.nn.MaxPool2d(
|
|
1726
|
+
kernel_size=kernel_size,
|
|
1727
|
+
stride=stride,
|
|
1728
|
+
padding=padding,
|
|
1729
|
+
dilation=dilation,
|
|
1730
|
+
return_indices=True,
|
|
1731
|
+
)
|
|
1732
|
+
|
|
1733
|
+
def forward(self, x):
|
|
1734
|
+
return self.max_pool2d_module(x)[1]
|
|
1735
|
+
|
|
1736
|
+
maxpool2d_module = MaxPool2dModule(3, 1, 0, 1)
|
|
1737
|
+
model_inputs = (torch.randn(4, 3, 24, 24),)
|
|
1738
|
+
|
|
1739
|
+
self.lower_and_test_with_partitioner(
|
|
1740
|
+
maxpool2d_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1741
|
+
)
|
|
1742
|
+
|
|
1743
|
+
def test_mps_backend_max_dim_vals(self):
|
|
1744
|
+
class MaxModule(torch.nn.Module):
|
|
1745
|
+
def __init__(
|
|
1746
|
+
self,
|
|
1747
|
+
):
|
|
1748
|
+
super().__init__()
|
|
1749
|
+
|
|
1750
|
+
def forward(self, x):
|
|
1751
|
+
max_vals, _ = torch.max(x, dim=3, keepdim=True)
|
|
1752
|
+
return max_vals
|
|
1753
|
+
|
|
1754
|
+
model_inputs = (torch.randn(16, 3, 12, 12),)
|
|
1755
|
+
max_dim_module = MaxModule()
|
|
1756
|
+
|
|
1757
|
+
self.lower_and_test_with_partitioner(
|
|
1758
|
+
max_dim_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1759
|
+
)
|
|
1760
|
+
|
|
1761
|
+
def test_mps_backend_max_dim(self):
|
|
1762
|
+
class MaxModule(torch.nn.Module):
|
|
1763
|
+
def __init__(
|
|
1764
|
+
self,
|
|
1765
|
+
):
|
|
1766
|
+
super().__init__()
|
|
1767
|
+
|
|
1768
|
+
def forward(self, x):
|
|
1769
|
+
x = torch.add(x, x)
|
|
1770
|
+
max_values_1, max_indices_1 = torch.max(x, dim=2, keepdim=True)
|
|
1771
|
+
max_values_2, max_indices_2 = torch.max(x, dim=3, keepdim=True)
|
|
1772
|
+
return (max_values_1, max_indices_1, max_values_2, max_indices_2)
|
|
1773
|
+
|
|
1774
|
+
model_inputs = (torch.randn(16, 3, 12, 12),)
|
|
1775
|
+
max_dim_module = MaxModule()
|
|
1776
|
+
|
|
1777
|
+
self.lower_and_test_with_partitioner(
|
|
1778
|
+
max_dim_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1779
|
+
)
|
|
1780
|
+
|
|
1781
|
+
def test_mps_backend_multiply(self):
|
|
1782
|
+
class MulModule(torch.nn.Module):
|
|
1783
|
+
def __init__(
|
|
1784
|
+
self,
|
|
1785
|
+
):
|
|
1786
|
+
super().__init__()
|
|
1787
|
+
self.mul = torch.mul
|
|
1788
|
+
|
|
1789
|
+
def forward(self, x, y):
|
|
1790
|
+
return self.mul(x, y)
|
|
1791
|
+
|
|
1792
|
+
mul_module = MulModule()
|
|
1793
|
+
model_inputs = (
|
|
1794
|
+
torch.randn((1, 8)),
|
|
1795
|
+
torch.randn((8, 1)),
|
|
1796
|
+
)
|
|
1797
|
+
|
|
1798
|
+
self.lower_and_test_with_partitioner(
|
|
1799
|
+
mul_module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1800
|
+
)
|
|
1801
|
+
|
|
1802
|
+
def test_mps_backend_sub(self):
|
|
1803
|
+
class Sub(torch.nn.Module):
|
|
1804
|
+
def __init__(self):
|
|
1805
|
+
super().__init__()
|
|
1806
|
+
self.sub = torch.sub
|
|
1807
|
+
|
|
1808
|
+
def forward(self, x, y):
|
|
1809
|
+
return self.sub(x, y)
|
|
1810
|
+
|
|
1811
|
+
module = Sub()
|
|
1812
|
+
M = torch.randn(2, 3)
|
|
1813
|
+
N = torch.randn(2, 3)
|
|
1814
|
+
model_inputs = (
|
|
1815
|
+
M,
|
|
1816
|
+
N,
|
|
1817
|
+
)
|
|
1818
|
+
self.lower_and_test_with_partitioner(
|
|
1819
|
+
module, model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1820
|
+
)
|
|
1821
|
+
|
|
1822
|
+
def test_mps_backend_clone(self):
|
|
1823
|
+
class Clone(torch.nn.Module):
|
|
1824
|
+
def forward(self, x):
|
|
1825
|
+
return torch.clone(x)
|
|
1826
|
+
|
|
1827
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
1828
|
+
self.lower_and_test_with_partitioner(
|
|
1829
|
+
Clone(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1830
|
+
)
|
|
1831
|
+
|
|
1832
|
+
def test_mps_backend_to_copy(self):
|
|
1833
|
+
class Copy(torch.nn.Module):
|
|
1834
|
+
def forward(self, x):
|
|
1835
|
+
return (
|
|
1836
|
+
torch.ops.aten._to_copy.default(
|
|
1837
|
+
x + 2, memory_format=torch.contiguous_format
|
|
1838
|
+
)
|
|
1839
|
+
+ x
|
|
1840
|
+
)
|
|
1841
|
+
|
|
1842
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
1843
|
+
self.lower_and_test_with_partitioner(
|
|
1844
|
+
Copy(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1845
|
+
)
|
|
1846
|
+
|
|
1847
|
+
def test_mps_backend_floor(self):
|
|
1848
|
+
class Floor(torch.nn.Module):
|
|
1849
|
+
def forward(self, x):
|
|
1850
|
+
return torch.floor(x)
|
|
1851
|
+
|
|
1852
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
1853
|
+
self.lower_and_test_with_partitioner(
|
|
1854
|
+
Floor(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1855
|
+
)
|
|
1856
|
+
|
|
1857
|
+
def test_mps_backend_sqrt(self):
|
|
1858
|
+
class Sqrt(torch.nn.Module):
|
|
1859
|
+
def forward(self, x):
|
|
1860
|
+
return torch.sqrt(x)
|
|
1861
|
+
|
|
1862
|
+
model_inputs = (torch.randn(1, 3, 3).abs(),)
|
|
1863
|
+
self.lower_and_test_with_partitioner(
|
|
1864
|
+
Sqrt(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1865
|
+
)
|
|
1866
|
+
|
|
1867
|
+
def test_mps_backend_ceil(self):
|
|
1868
|
+
class Ceil(torch.nn.Module):
|
|
1869
|
+
def forward(self, x):
|
|
1870
|
+
return torch.ceil(x)
|
|
1871
|
+
|
|
1872
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
1873
|
+
self.lower_and_test_with_partitioner(
|
|
1874
|
+
Ceil(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1875
|
+
)
|
|
1876
|
+
|
|
1877
|
+
def test_mps_backend_hardswish(self):
|
|
1878
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
1879
|
+
|
|
1880
|
+
class HardswishModule(torch.nn.Module):
|
|
1881
|
+
def __init__(self):
|
|
1882
|
+
super(HardswishModule, self).__init__()
|
|
1883
|
+
self.hardswish_out_of_place = torch.nn.Hardswish()
|
|
1884
|
+
self.hardswish_in_place = torch.nn.Hardswish(inplace=True)
|
|
1885
|
+
self.hardswish_functional = torch.nn.functional.hardswish
|
|
1886
|
+
|
|
1887
|
+
def forward(self, x):
|
|
1888
|
+
a = self.hardswish_out_of_place(x)
|
|
1889
|
+
a = self.hardswish_in_place(a)
|
|
1890
|
+
a = self.hardswish_functional(a)
|
|
1891
|
+
return a
|
|
1892
|
+
|
|
1893
|
+
# TODO(T158969708)
|
|
1894
|
+
self.lower_and_test_with_partitioner(
|
|
1895
|
+
HardswishModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1896
|
+
)
|
|
1897
|
+
|
|
1898
|
+
def test_mps_backend_leaky_relu(self):
|
|
1899
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
1900
|
+
|
|
1901
|
+
class LeakyReLUModule(torch.nn.Module):
|
|
1902
|
+
def __init__(self):
|
|
1903
|
+
super(LeakyReLUModule, self).__init__()
|
|
1904
|
+
self.leaky_relu_out_of_place = torch.nn.LeakyReLU(negative_slope=0.2)
|
|
1905
|
+
self.leaky_relu_in_place = torch.nn.LeakyReLU(
|
|
1906
|
+
negative_slope=0.08, inplace=True
|
|
1907
|
+
)
|
|
1908
|
+
self.leaky_relu_functional_default = torch.nn.functional.leaky_relu
|
|
1909
|
+
|
|
1910
|
+
def forward(self, x):
|
|
1911
|
+
a = self.leaky_relu_out_of_place(x)
|
|
1912
|
+
a = self.leaky_relu_in_place(a)
|
|
1913
|
+
a = self.leaky_relu_functional_default(a)
|
|
1914
|
+
return a
|
|
1915
|
+
|
|
1916
|
+
self.lower_and_test_with_partitioner(
|
|
1917
|
+
LeakyReLUModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1918
|
+
)
|
|
1919
|
+
|
|
1920
|
+
@unittest.skip
|
|
1921
|
+
def test_mps_channels_last_tagged_reshape_pass_output(self):
|
|
1922
|
+
op_sequences = OpSequencesAddConv2d(2, 2)
|
|
1923
|
+
op_sequences.eval()
|
|
1924
|
+
|
|
1925
|
+
example_inputs = (torch.ones(1, 1, 6, 6),)
|
|
1926
|
+
|
|
1927
|
+
self.lower_and_test_with_partitioner(
|
|
1928
|
+
op_sequences, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1929
|
+
)
|
|
1930
|
+
|
|
1931
|
+
def test_mps_backend_conv2d_bn_hardtanh_mean_sequence(self):
|
|
1932
|
+
"""
|
|
1933
|
+
This test makes sure that we can fuse batchnorm and hardtanh
|
|
1934
|
+
even with inserting copy nodes at some spots in the graph to change
|
|
1935
|
+
memory format
|
|
1936
|
+
"""
|
|
1937
|
+
groups = 1
|
|
1938
|
+
stride = [2, 2]
|
|
1939
|
+
padding = [1, 1]
|
|
1940
|
+
dilation = [1, 1]
|
|
1941
|
+
in_channels = 2
|
|
1942
|
+
out_channels = 1
|
|
1943
|
+
width = 8
|
|
1944
|
+
height = 8
|
|
1945
|
+
batches = 1
|
|
1946
|
+
example_inputs = (torch.randn(batches, in_channels, height, width),)
|
|
1947
|
+
|
|
1948
|
+
class TestModule(torch.nn.Module):
|
|
1949
|
+
def __init__(self):
|
|
1950
|
+
super(TestModule, self).__init__()
|
|
1951
|
+
self.conv = torch.nn.Conv2d(
|
|
1952
|
+
in_channels=in_channels,
|
|
1953
|
+
out_channels=out_channels,
|
|
1954
|
+
kernel_size=(3, 3),
|
|
1955
|
+
stride=stride,
|
|
1956
|
+
padding=padding,
|
|
1957
|
+
groups=groups,
|
|
1958
|
+
dilation=dilation,
|
|
1959
|
+
bias=True,
|
|
1960
|
+
)
|
|
1961
|
+
self.native_batchnorm = torch.nn.BatchNorm2d(out_channels)
|
|
1962
|
+
self.hardtanh = torch.nn.Hardtanh(min_val=0, max_val=6)
|
|
1963
|
+
|
|
1964
|
+
def forward(self, x):
|
|
1965
|
+
x = self.conv(x)
|
|
1966
|
+
x = self.native_batchnorm(x)
|
|
1967
|
+
x = self.hardtanh(x)
|
|
1968
|
+
x = torch.mean(x, (-1, -2), keepdim=True)
|
|
1969
|
+
return x
|
|
1970
|
+
|
|
1971
|
+
test_module = TestModule()
|
|
1972
|
+
test_module.eval()
|
|
1973
|
+
self.lower_and_test_with_partitioner(
|
|
1974
|
+
test_module, example_inputs, func_name=inspect.stack()[0].function[5:]
|
|
1975
|
+
)
|
|
1976
|
+
|
|
1977
|
+
@unittest.expectedFailure
|
|
1978
|
+
def test_mps_backend_maximum_no_broadcast(self):
|
|
1979
|
+
model_inputs_no_broadcast = (torch.randn(2, 3, 4), torch.randn(2, 3, 4))
|
|
1980
|
+
|
|
1981
|
+
self.lower_and_test_with_partitioner(
|
|
1982
|
+
torch.maximum,
|
|
1983
|
+
model_inputs_no_broadcast,
|
|
1984
|
+
func_name=inspect.stack()[0].function[5:],
|
|
1985
|
+
)
|
|
1986
|
+
|
|
1987
|
+
@unittest.expectedFailure
|
|
1988
|
+
def test_mps_backend_maximum_broadcast(self):
|
|
1989
|
+
model_inputs_broadcast = (torch.randn(2, 3, 4), torch.randn(2, 1, 4))
|
|
1990
|
+
|
|
1991
|
+
self.lower_and_test_with_partitioner(
|
|
1992
|
+
torch.maximum,
|
|
1993
|
+
model_inputs_broadcast,
|
|
1994
|
+
func_name=inspect.stack()[0].function[5:],
|
|
1995
|
+
)
|
|
1996
|
+
|
|
1997
|
+
def test_mps_backend_negative(self):
|
|
1998
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
1999
|
+
|
|
2000
|
+
class NegModule(torch.nn.Module):
|
|
2001
|
+
def __init__(self):
|
|
2002
|
+
super().__init__()
|
|
2003
|
+
|
|
2004
|
+
def forward(self, x):
|
|
2005
|
+
return torch.neg(x)
|
|
2006
|
+
|
|
2007
|
+
self.lower_and_test_with_partitioner(
|
|
2008
|
+
NegModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2009
|
+
)
|
|
2010
|
+
|
|
2011
|
+
def test_mps_backend_remainder_1(self):
|
|
2012
|
+
model_inputs = (torch.randn(1, 3, 3), torch.randn(1, 3, 3))
|
|
2013
|
+
|
|
2014
|
+
class RemainderModule(torch.nn.Module):
|
|
2015
|
+
def __init__(self):
|
|
2016
|
+
super().__init__()
|
|
2017
|
+
|
|
2018
|
+
def forward(self, x, y):
|
|
2019
|
+
return torch.remainder(x, y)
|
|
2020
|
+
|
|
2021
|
+
self.lower_and_test_with_partitioner(
|
|
2022
|
+
RemainderModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2023
|
+
)
|
|
2024
|
+
|
|
2025
|
+
def test_mps_backend_remainder_2(self):
|
|
2026
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
2027
|
+
|
|
2028
|
+
class RemainderModule(torch.nn.Module):
|
|
2029
|
+
def __init__(self):
|
|
2030
|
+
super().__init__()
|
|
2031
|
+
|
|
2032
|
+
def forward(self, x):
|
|
2033
|
+
return torch.remainder(x, 0.5)
|
|
2034
|
+
|
|
2035
|
+
self.lower_and_test_with_partitioner(
|
|
2036
|
+
RemainderModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2037
|
+
)
|
|
2038
|
+
|
|
2039
|
+
def test_mps_backend_square(self):
|
|
2040
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
2041
|
+
|
|
2042
|
+
class SquareModule(torch.nn.Module):
|
|
2043
|
+
def __init__(self):
|
|
2044
|
+
super().__init__()
|
|
2045
|
+
|
|
2046
|
+
def forward(self, x):
|
|
2047
|
+
return torch.square(x)
|
|
2048
|
+
|
|
2049
|
+
self.lower_and_test_with_partitioner(
|
|
2050
|
+
SquareModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2051
|
+
)
|
|
2052
|
+
|
|
2053
|
+
def test_mps_backend_pow_1(self):
|
|
2054
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
2055
|
+
|
|
2056
|
+
class PowModule(torch.nn.Module):
|
|
2057
|
+
def __init__(self):
|
|
2058
|
+
super().__init__()
|
|
2059
|
+
|
|
2060
|
+
def forward(self, x):
|
|
2061
|
+
return torch.pow(x, 4)
|
|
2062
|
+
|
|
2063
|
+
self.lower_and_test_with_partitioner(
|
|
2064
|
+
PowModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2065
|
+
)
|
|
2066
|
+
|
|
2067
|
+
def test_mps_backend_pow_2(self):
|
|
2068
|
+
model_inputs = (torch.randn(1, 3, 3), torch.tensor(4))
|
|
2069
|
+
|
|
2070
|
+
class PowModule(torch.nn.Module):
|
|
2071
|
+
def __init__(self):
|
|
2072
|
+
super().__init__()
|
|
2073
|
+
|
|
2074
|
+
def forward(self, x, y):
|
|
2075
|
+
return torch.pow(x, y)
|
|
2076
|
+
|
|
2077
|
+
self.lower_and_test_with_partitioner(
|
|
2078
|
+
PowModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2079
|
+
)
|
|
2080
|
+
|
|
2081
|
+
def test_mps_backend_elu(self):
|
|
2082
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
2083
|
+
|
|
2084
|
+
class ELUModule(torch.nn.Module):
|
|
2085
|
+
def __init__(self):
|
|
2086
|
+
super().__init__()
|
|
2087
|
+
|
|
2088
|
+
def forward(self, x):
|
|
2089
|
+
return torch.square(x)
|
|
2090
|
+
|
|
2091
|
+
self.lower_and_test_with_partitioner(
|
|
2092
|
+
ELUModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2093
|
+
)
|
|
2094
|
+
|
|
2095
|
+
def test_mps_backend_avg_pool_2d_1(self):
|
|
2096
|
+
model_inputs = (torch.randn(1, 1, 10, 10),)
|
|
2097
|
+
|
|
2098
|
+
class AvgPoolModule(torch.nn.Module):
|
|
2099
|
+
def __init__(self):
|
|
2100
|
+
super().__init__()
|
|
2101
|
+
self.avgPool = torch.nn.AvgPool2d(
|
|
2102
|
+
kernel_size=(2, 2),
|
|
2103
|
+
padding=(1, 1),
|
|
2104
|
+
stride=(2, 2),
|
|
2105
|
+
count_include_pad=False,
|
|
2106
|
+
)
|
|
2107
|
+
|
|
2108
|
+
def forward(self, x):
|
|
2109
|
+
return self.avgPool(x)
|
|
2110
|
+
|
|
2111
|
+
self.lower_and_test_with_partitioner(
|
|
2112
|
+
AvgPoolModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2113
|
+
)
|
|
2114
|
+
|
|
2115
|
+
def test_mps_backend_avg_pool_2d_2(self):
|
|
2116
|
+
model_inputs = (torch.randn(1, 1, 10, 10),)
|
|
2117
|
+
|
|
2118
|
+
class AvgPoolModule(torch.nn.Module):
|
|
2119
|
+
def __init__(self):
|
|
2120
|
+
super().__init__()
|
|
2121
|
+
self.avgPool = torch.nn.AvgPool2d(
|
|
2122
|
+
kernel_size=(2, 2),
|
|
2123
|
+
padding=(1, 1),
|
|
2124
|
+
stride=(2, 2),
|
|
2125
|
+
count_include_pad=True,
|
|
2126
|
+
)
|
|
2127
|
+
|
|
2128
|
+
def forward(self, x):
|
|
2129
|
+
return self.avgPool(x)
|
|
2130
|
+
|
|
2131
|
+
self.lower_and_test_with_partitioner(
|
|
2132
|
+
AvgPoolModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2133
|
+
)
|
|
2134
|
+
|
|
2135
|
+
def test_mps_backend_avg_pool_2d_3(self):
|
|
2136
|
+
model_inputs = (torch.randn(1, 1, 10, 10),)
|
|
2137
|
+
|
|
2138
|
+
class AvgPoolModule(torch.nn.Module):
|
|
2139
|
+
def __init__(self):
|
|
2140
|
+
super().__init__()
|
|
2141
|
+
self.avgPool = torch.nn.AvgPool2d(
|
|
2142
|
+
kernel_size=(2, 2),
|
|
2143
|
+
padding=(1, 1),
|
|
2144
|
+
stride=(2, 2),
|
|
2145
|
+
count_include_pad=False,
|
|
2146
|
+
ceil_mode=True,
|
|
2147
|
+
divisor_override=4,
|
|
2148
|
+
)
|
|
2149
|
+
|
|
2150
|
+
def forward(self, x):
|
|
2151
|
+
return self.avgPool(x)
|
|
2152
|
+
|
|
2153
|
+
self.lower_and_test_with_partitioner(
|
|
2154
|
+
AvgPoolModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2155
|
+
)
|
|
2156
|
+
|
|
2157
|
+
def test_mps_backend_abs(self):
|
|
2158
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
2159
|
+
|
|
2160
|
+
class AbsModule(torch.nn.Module):
|
|
2161
|
+
def forward(self, x):
|
|
2162
|
+
return torch.abs(x)
|
|
2163
|
+
|
|
2164
|
+
self.lower_and_test_with_partitioner(
|
|
2165
|
+
AbsModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2166
|
+
)
|
|
2167
|
+
|
|
2168
|
+
def test_mps_backend_sign(self):
|
|
2169
|
+
model_inputs = (torch.randn(1, 3, 3),)
|
|
2170
|
+
|
|
2171
|
+
class SignModule(torch.nn.Module):
|
|
2172
|
+
def forward(self, x):
|
|
2173
|
+
return torch.sign(x)
|
|
2174
|
+
|
|
2175
|
+
self.lower_and_test_with_partitioner(
|
|
2176
|
+
SignModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2177
|
+
)
|
|
2178
|
+
|
|
2179
|
+
def test_mps_backend_rsqrt(self):
|
|
2180
|
+
model_inputs = (torch.randn(1, 3, 3).abs(),)
|
|
2181
|
+
|
|
2182
|
+
class RsqrtModule(torch.nn.Module):
|
|
2183
|
+
def forward(self, x):
|
|
2184
|
+
return torch.rsqrt(x)
|
|
2185
|
+
|
|
2186
|
+
self.lower_and_test_with_partitioner(
|
|
2187
|
+
RsqrtModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2188
|
+
)
|
|
2189
|
+
|
|
2190
|
+
def test_mps_backend_prelu(self):
|
|
2191
|
+
num_channels = 5
|
|
2192
|
+
model_inputs = (torch.randn(1, num_channels, 3, 2),)
|
|
2193
|
+
|
|
2194
|
+
class PReLUModule(torch.nn.Module):
|
|
2195
|
+
def __init__(self):
|
|
2196
|
+
super(PReLUModule, self).__init__()
|
|
2197
|
+
self.prelu = torch.nn.PReLU()
|
|
2198
|
+
self.prelu_non_default = torch.nn.PReLU(
|
|
2199
|
+
num_parameters=num_channels, init=0.2
|
|
2200
|
+
)
|
|
2201
|
+
|
|
2202
|
+
def forward(self, x):
|
|
2203
|
+
a = self.prelu(x)
|
|
2204
|
+
a = self.prelu_non_default(a)
|
|
2205
|
+
return a
|
|
2206
|
+
|
|
2207
|
+
self.lower_and_test_with_partitioner(
|
|
2208
|
+
PReLUModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2209
|
+
)
|
|
2210
|
+
|
|
2211
|
+
# Should fail to be partitioned since constraint (input dim) is violated
|
|
2212
|
+
self.assertRaises(
|
|
2213
|
+
Exception,
|
|
2214
|
+
self.lower_and_test_with_partitioner,
|
|
2215
|
+
torch.nn.PReLU(),
|
|
2216
|
+
(torch.randn(1, 2),),
|
|
2217
|
+
)
|
|
2218
|
+
|
|
2219
|
+
def test_mps_backend_concatenate2(self):
|
|
2220
|
+
class Concat(torch.nn.Module):
|
|
2221
|
+
def forward(self, x, y):
|
|
2222
|
+
return torch.cat((y, x), 0)
|
|
2223
|
+
|
|
2224
|
+
self.lower_and_test_with_partitioner(
|
|
2225
|
+
Concat(),
|
|
2226
|
+
(torch.ones(4, 2, 3), torch.randn(1, 2, 3)),
|
|
2227
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2228
|
+
)
|
|
2229
|
+
|
|
2230
|
+
def test_mps_backend_concatenate3(self):
|
|
2231
|
+
class Concat(torch.nn.Module):
|
|
2232
|
+
def forward(self, x, y):
|
|
2233
|
+
return torch.concat((y, y, x), 0)
|
|
2234
|
+
|
|
2235
|
+
self.lower_and_test_with_partitioner(
|
|
2236
|
+
Concat(),
|
|
2237
|
+
(torch.ones(4, 2, 3), torch.randn(1, 2, 3)),
|
|
2238
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2239
|
+
)
|
|
2240
|
+
|
|
2241
|
+
def test_mps_backend_concatenate4(self):
|
|
2242
|
+
class Concat(torch.nn.Module):
|
|
2243
|
+
def forward(self, x, y):
|
|
2244
|
+
return torch.concatenate((y, x, y, x), 2)
|
|
2245
|
+
|
|
2246
|
+
self.lower_and_test_with_partitioner(
|
|
2247
|
+
Concat(),
|
|
2248
|
+
(torch.randn(1, 2, 3), torch.randn(1, 2, 5)),
|
|
2249
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2250
|
+
)
|
|
2251
|
+
|
|
2252
|
+
def test_mps_backend_concatenate_nhwc(self):
|
|
2253
|
+
class Concat(torch.nn.Module):
|
|
2254
|
+
def __init__(self):
|
|
2255
|
+
super().__init__()
|
|
2256
|
+
self.conv = torch.nn.Conv2d(
|
|
2257
|
+
in_channels=1,
|
|
2258
|
+
out_channels=3,
|
|
2259
|
+
kernel_size=(3, 3),
|
|
2260
|
+
padding=1,
|
|
2261
|
+
bias=False,
|
|
2262
|
+
)
|
|
2263
|
+
|
|
2264
|
+
def forward(self, x, y):
|
|
2265
|
+
x = self.conv(x)
|
|
2266
|
+
return torch.concatenate((y, x, y, x), 1)
|
|
2267
|
+
|
|
2268
|
+
self.lower_and_test_with_partitioner(
|
|
2269
|
+
Concat(),
|
|
2270
|
+
(torch.randn(1, 1, 3, 3), torch.randn(1, 1, 3, 3)),
|
|
2271
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2272
|
+
)
|
|
2273
|
+
|
|
2274
|
+
def test_mps_backend_concatenate_nhwc2(self):
|
|
2275
|
+
class Concat(torch.nn.Module):
|
|
2276
|
+
def __init__(self):
|
|
2277
|
+
super().__init__()
|
|
2278
|
+
self.conv = torch.nn.Conv2d(
|
|
2279
|
+
in_channels=1,
|
|
2280
|
+
out_channels=3,
|
|
2281
|
+
kernel_size=(3, 3),
|
|
2282
|
+
padding=1,
|
|
2283
|
+
bias=False,
|
|
2284
|
+
)
|
|
2285
|
+
|
|
2286
|
+
def forward(self, x, y):
|
|
2287
|
+
x = self.conv(x)
|
|
2288
|
+
y = self.conv(y)
|
|
2289
|
+
return torch.concatenate((y, x, y, x), 3)
|
|
2290
|
+
|
|
2291
|
+
self.lower_and_test_with_partitioner(
|
|
2292
|
+
Concat(),
|
|
2293
|
+
(torch.randn(1, 1, 3, 3), torch.randn(1, 1, 3, 3)),
|
|
2294
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2295
|
+
)
|
|
2296
|
+
|
|
2297
|
+
def test_mps_backend_slice_copy(self):
|
|
2298
|
+
class Slice(torch.nn.Module):
|
|
2299
|
+
def forward(self, x):
|
|
2300
|
+
return x[1:3, -2:, :-1]
|
|
2301
|
+
|
|
2302
|
+
self.lower_and_test_with_partitioner(
|
|
2303
|
+
Slice(), (torch.randn(5, 5, 5),), func_name=inspect.stack()[0].function[5:]
|
|
2304
|
+
)
|
|
2305
|
+
|
|
2306
|
+
def test_mps_backend_slice_copy_stride_non_1(self):
|
|
2307
|
+
class Slice(torch.nn.Module):
|
|
2308
|
+
def forward(self, x):
|
|
2309
|
+
return x[:3:-1, 2:, :3]
|
|
2310
|
+
|
|
2311
|
+
self.assertRaises(
|
|
2312
|
+
Exception,
|
|
2313
|
+
self.lower_and_test_with_partitioner,
|
|
2314
|
+
Slice(),
|
|
2315
|
+
(torch.randn(5, 5, 5),),
|
|
2316
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2317
|
+
)
|
|
2318
|
+
|
|
2319
|
+
def test_mps_backend_slice_copy_dim_0(self):
|
|
2320
|
+
class Slice(torch.nn.Module):
|
|
2321
|
+
def forward(self, x):
|
|
2322
|
+
return x[-1:3, 2:, 3:3]
|
|
2323
|
+
|
|
2324
|
+
self.lower_module_and_test_output(
|
|
2325
|
+
Slice(),
|
|
2326
|
+
(torch.randn(5, 5, 5),),
|
|
2327
|
+
use_partitioner=False,
|
|
2328
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2329
|
+
)
|
|
2330
|
+
|
|
2331
|
+
def test_mps_backend_slice_copy_memory_format(self):
|
|
2332
|
+
class ConvSlice(torch.nn.Module):
|
|
2333
|
+
def __init__(self):
|
|
2334
|
+
super().__init__()
|
|
2335
|
+
self.conv = torch.nn.Conv2d(
|
|
2336
|
+
in_channels=1,
|
|
2337
|
+
out_channels=3,
|
|
2338
|
+
kernel_size=(3, 3),
|
|
2339
|
+
padding=1,
|
|
2340
|
+
bias=False,
|
|
2341
|
+
)
|
|
2342
|
+
|
|
2343
|
+
def forward(self, x):
|
|
2344
|
+
y = self.conv(x)
|
|
2345
|
+
return y[:, :, 2:3, -2:]
|
|
2346
|
+
|
|
2347
|
+
self.lower_and_test_with_partitioner(
|
|
2348
|
+
ConvSlice(),
|
|
2349
|
+
(torch.randn(1, 1, 3, 3),),
|
|
2350
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2351
|
+
)
|
|
2352
|
+
|
|
2353
|
+
def test_mps_backend_bitwise_and(self):
|
|
2354
|
+
class BitwiseAnd(torch.nn.Module):
|
|
2355
|
+
def forward(self, x, y):
|
|
2356
|
+
return torch.bitwise_and(x, y)
|
|
2357
|
+
|
|
2358
|
+
model_inputs = (
|
|
2359
|
+
torch.tensor([-1, -2, 3], dtype=torch.int8),
|
|
2360
|
+
torch.tensor([1, 0, 3], dtype=torch.int8),
|
|
2361
|
+
)
|
|
2362
|
+
self.lower_and_test_with_partitioner(
|
|
2363
|
+
BitwiseAnd(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2364
|
+
)
|
|
2365
|
+
|
|
2366
|
+
def test_mps_backend_bitwise_or(self):
|
|
2367
|
+
class BitwiseOr(torch.nn.Module):
|
|
2368
|
+
def forward(self, x, y):
|
|
2369
|
+
return torch.bitwise_or(x, y)
|
|
2370
|
+
|
|
2371
|
+
model_inputs = (
|
|
2372
|
+
torch.tensor([-1, -2, 3], dtype=torch.int8),
|
|
2373
|
+
torch.tensor([1, 0, 3], dtype=torch.int8),
|
|
2374
|
+
)
|
|
2375
|
+
self.lower_and_test_with_partitioner(
|
|
2376
|
+
BitwiseOr(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2377
|
+
)
|
|
2378
|
+
|
|
2379
|
+
def test_mps_backend_bitwise_xor(self):
|
|
2380
|
+
class BitwiseXor(torch.nn.Module):
|
|
2381
|
+
def forward(self, x, y):
|
|
2382
|
+
return torch.bitwise_xor(x, y)
|
|
2383
|
+
|
|
2384
|
+
model_inputs = (
|
|
2385
|
+
torch.tensor([True, True, False]),
|
|
2386
|
+
torch.tensor([False, True, False]),
|
|
2387
|
+
)
|
|
2388
|
+
self.lower_and_test_with_partitioner(
|
|
2389
|
+
BitwiseXor(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2390
|
+
)
|
|
2391
|
+
|
|
2392
|
+
def test_mps_backend_bitwise_not(self):
|
|
2393
|
+
class BitwiseNot(torch.nn.Module):
|
|
2394
|
+
def forward(self, x):
|
|
2395
|
+
return torch.bitwise_not(x)
|
|
2396
|
+
|
|
2397
|
+
model_inputs = (torch.tensor([-1, -2, 3], dtype=torch.int8),)
|
|
2398
|
+
self.lower_and_test_with_partitioner(
|
|
2399
|
+
BitwiseNot(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2400
|
+
)
|
|
2401
|
+
|
|
2402
|
+
def test_mps_backend_bitwise_not_with_bool(self):
|
|
2403
|
+
class BitwiseNot(torch.nn.Module):
|
|
2404
|
+
def forward(self, x):
|
|
2405
|
+
return torch.bitwise_not(x)
|
|
2406
|
+
|
|
2407
|
+
model_inputs = (torch.tensor([True, True, False]),)
|
|
2408
|
+
self.lower_and_test_with_partitioner(
|
|
2409
|
+
BitwiseNot(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2410
|
+
)
|
|
2411
|
+
|
|
2412
|
+
def test_mps_backend_bitwise_with_scalar(self):
|
|
2413
|
+
class BitwiseScalarModule(torch.nn.Module):
|
|
2414
|
+
def __init__(self):
|
|
2415
|
+
super().__init__()
|
|
2416
|
+
self._scalar = 3
|
|
2417
|
+
|
|
2418
|
+
def forward(self, x):
|
|
2419
|
+
out1 = torch.ops.aten.bitwise_and.Scalar(x, self._scalar)
|
|
2420
|
+
return out1
|
|
2421
|
+
|
|
2422
|
+
model_inputs = (torch.tensor([-1, -2, 3], dtype=torch.int8),)
|
|
2423
|
+
self.lower_and_test_with_partitioner(
|
|
2424
|
+
BitwiseScalarModule(),
|
|
2425
|
+
model_inputs,
|
|
2426
|
+
func_name=inspect.stack()[0].function[5:],
|
|
2427
|
+
)
|
|
2428
|
+
|
|
2429
|
+
def test_mps_backend_arange(self):
|
|
2430
|
+
class ArangeModule(torch.nn.Module):
|
|
2431
|
+
def __init__(self):
|
|
2432
|
+
super().__init__()
|
|
2433
|
+
self._begin = 2.5
|
|
2434
|
+
self._end = 5
|
|
2435
|
+
self._step = 0.5
|
|
2436
|
+
|
|
2437
|
+
def forward(self):
|
|
2438
|
+
out1 = torch.arange(end=self._end)
|
|
2439
|
+
out2 = torch.arange(start=self._begin, end=self._end, step=self._step)
|
|
2440
|
+
return out1 + out2
|
|
2441
|
+
|
|
2442
|
+
self.lower_and_test_with_partitioner(
|
|
2443
|
+
ArangeModule(), (), func_name=inspect.stack()[0].function[5:]
|
|
2444
|
+
)
|
|
2445
|
+
|
|
2446
|
+
def test_mps_backend_where(self):
|
|
2447
|
+
class Where(torch.nn.Module):
|
|
2448
|
+
def forward(self, cond, x, y):
|
|
2449
|
+
return torch.where(cond, x, y)
|
|
2450
|
+
|
|
2451
|
+
x = torch.randn(3, 2)
|
|
2452
|
+
y = torch.ones(3, 2)
|
|
2453
|
+
cond = x > 0
|
|
2454
|
+
module_inputs = (cond, x, y)
|
|
2455
|
+
self.lower_and_test_with_partitioner(
|
|
2456
|
+
Where(), module_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2457
|
+
)
|
|
2458
|
+
|
|
2459
|
+
def test_mps_backend_scalar_tensor(self):
|
|
2460
|
+
class ScalarTensorModule(torch.nn.Module):
|
|
2461
|
+
def __init__(self):
|
|
2462
|
+
super().__init__()
|
|
2463
|
+
self._scalar = 3.0
|
|
2464
|
+
self._bool = True
|
|
2465
|
+
|
|
2466
|
+
def forward(self):
|
|
2467
|
+
out1 = torch.ops.aten.scalar_tensor(self._scalar)
|
|
2468
|
+
out2 = torch.ops.aten.scalar_tensor(self._scalar, dtype=torch.int32)
|
|
2469
|
+
# issue 121117206
|
|
2470
|
+
out3 = torch.ops.aten.scalar_tensor(self._bool, dtype=torch.bool)
|
|
2471
|
+
return out1 + out2 + out3
|
|
2472
|
+
|
|
2473
|
+
self.lower_and_test_with_partitioner(
|
|
2474
|
+
ScalarTensorModule(), (), func_name=inspect.stack()[0].function[5:]
|
|
2475
|
+
)
|
|
2476
|
+
|
|
2477
|
+
def test_mps_backend_tril(self):
|
|
2478
|
+
class TrilModule(torch.nn.Module):
|
|
2479
|
+
def __init__(self):
|
|
2480
|
+
super().__init__()
|
|
2481
|
+
self._k = 1
|
|
2482
|
+
self._negK = -1
|
|
2483
|
+
|
|
2484
|
+
def forward(self, x):
|
|
2485
|
+
out1 = torch.tril(x, diagonal=self._k)
|
|
2486
|
+
out2 = torch.tril(x, diagonal=self._negK)
|
|
2487
|
+
return out1 + out2
|
|
2488
|
+
|
|
2489
|
+
model_inputs = (torch.randn(4, 6),)
|
|
2490
|
+
self.lower_and_test_with_partitioner(
|
|
2491
|
+
TrilModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2492
|
+
)
|
|
2493
|
+
|
|
2494
|
+
def test_mps_backend_embedding(self):
|
|
2495
|
+
class EmbeddingModule(torch.nn.Module):
|
|
2496
|
+
def __init__(self):
|
|
2497
|
+
super().__init__()
|
|
2498
|
+
self._embedding = torch.nn.Embedding(10, 3)
|
|
2499
|
+
self._embedding_with_padding = torch.nn.Embedding(10, 3, padding_idx=2)
|
|
2500
|
+
|
|
2501
|
+
def forward(self, x):
|
|
2502
|
+
return self._embedding(x) + self._embedding_with_padding(x)
|
|
2503
|
+
|
|
2504
|
+
model_inputs = (torch.tensor([[1, 2, 4, 5], [4, 3, 2, 9]]),)
|
|
2505
|
+
self.lower_and_test_with_partitioner(
|
|
2506
|
+
EmbeddingModule(), model_inputs, func_name=inspect.stack()[0].function[5:]
|
|
2507
|
+
)
|