tico 0.2.0.dev260615__tar.gz → 0.2.0.dev260622__tar.gz
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.
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/PKG-INFO +1 -1
- tico-0.2.0.dev260622/tico/_version.py +1 -0
- tico-0.2.0.dev260622/tico/passes/convert_gather_to_gather_nd.py +350 -0
- tico-0.2.0.dev260622/tico/quantization/recipes/debug/static_qwen3_vl_runtime.py +1516 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/cases/gemma4.py +232 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/runner.py +14 -1
- tico-0.2.0.dev260622/tico/quantization/wrapq/examples/gemma4/quantize_text_scaled_word_embedding.py +149 -0
- tico-0.2.0.dev260622/tico/quantization/wrapq/examples/gemma4/quantize_vision_pooler.py +211 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/utils/version.py +1 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/export_adapters.py +104 -1
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_text_scaled_word_embedding.py +34 -8
- tico-0.2.0.dev260622/tico/quantization/wrapq/wrappers/gemma4/quant_vision_encoder_layer.py +166 -0
- tico-0.2.0.dev260622/tico/quantization/wrapq/wrappers/gemma4/quant_vision_pooler.py +292 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/export_adapters.py +101 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/registry.py +4 -4
- tico-0.2.0.dev260622/tico/serialize/operators/op_circle_gather_nd.py +53 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/convert.py +2 -0
- tico-0.2.0.dev260622/tico/utils/mx/__init__.py +1 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/register_custom_op.py +61 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico.egg-info/PKG-INFO +1 -1
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico.egg-info/SOURCES.txt +5 -0
- tico-0.2.0.dev260615/tico/_version.py +0 -1
- tico-0.2.0.dev260615/tico/quantization/recipes/debug/static_qwen3_vl_runtime.py +0 -765
- tico-0.2.0.dev260615/tico/quantization/wrapq/wrappers/gemma4/quant_vision_encoder_layer.py +0 -89
- tico-0.2.0.dev260615/tico/quantization/wrapq/wrappers/gemma4/quant_vision_pooler.py +0 -54
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/LICENSE +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/README.md +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/pyproject.toml +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/setup.cfg +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/config/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/config/base.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/config/factory.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/config/v1.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/experimental/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/interpreter/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/interpreter/infer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/interpreter/interpreter.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/cast_aten_where_arg_type.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/cast_clamp_mixed_type_args.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/cast_mixed_type_args.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/const_prop_pass.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_conv1d_to_conv2d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_conv3d_to_conv2d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_expand_to_slice_cat.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_layout_op_to_reshape.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_matmul_to_linear.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_repeat_to_expand_copy.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_sym_size_to_circle_shape.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/convert_to_relu6.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/decompose_addmm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/decompose_batch_norm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/decompose_fake_quantize.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/decompose_fake_quantize_tensor_qparams.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/decompose_group_norm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/decompose_grouped_conv2d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/decompose_slice_scatter.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/eliminate_rank_round_trip_region.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/extract_dtype_kwargs.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/fill_meta_val.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/fuse_leading_unsqueeze_reshape.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/fuse_redundant_reshape_to_mean.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/legalize_causal_mask_value.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/legalize_predefined_layout_operators.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/lower_copy.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/lower_pow2_to_mul.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/lower_to_resize_nearest_neighbor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/lower_to_slice.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/merge_consecutive_cat.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/ops.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_nop.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_redundant_assert_nodes.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_redundant_expand.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_redundant_permute.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_redundant_reshape.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_redundant_slice.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_redundant_to_copy.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/remove_unused_placeholder.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/restore_linear.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/passes/segment_index_select.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/pt2_to_circle.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/cle/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/cle/cle.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/cle/quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/fpi_gptq/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/fpi_gptq/fpi_gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/fpi_gptq/quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/fpi_gptq/util.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/gptq/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/gptq/gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/gptq/quant.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/gptq/quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/gptq/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/qwen3_vl_gptq/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/qwen3_vl_gptq/gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/qwen3_vl_gptq/quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/qwen3_vl_gptq/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/smoothquant/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/smoothquant/observer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/smoothquant/quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/smoothquant/smooth_quant.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/fuse_norm_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/hadamard_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/qwen3_vl_model_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/qwen3_vl_quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/qwen3_vl_rotation_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/rotation_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/spin_llama.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/algorithm/spinquant/spin_qwen3_vl.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/base.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/builders.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/cle.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/fpi_gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/gemma4_builders.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/llama_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/ptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/qwen3_vl_gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/qwen3_vl_spinquant.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/smoothquant.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/specs.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/spinquant.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/config/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/backend.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/evaluate.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/executor/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/executor/backend_executor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/executor/circle_executor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/executor/triv24_executor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/hellaswag_eval_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/llava_bench_judge_eval_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/lmms_eval_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/lmms_tasks/videomme_mini/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/metric.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/mmlu_eval_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/mmmu_eval_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/optional_deps.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/script/llm_tasks_eval.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/script/mini_vqa_eval.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/evaluation/vlm_eval_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/examples/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/examples/configs/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/examples/evaluate.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/examples/inspect.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/examples/quantize.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/fold_quant_ops.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/insert_quantize_on_dtype_mismatch.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/propagate_qparam_backward.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/propagate_qparam_forward.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/qparam_safe_const_prop.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/quantize_bias.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/passes/remove_weight_dequant_op.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/public_interface.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/quantizer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/quantizer_registry.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/adapters/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/adapters/base.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/adapters/gemma4.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/adapters/llama.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/adapters/qwen3_vl.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/config.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/context.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/data/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/data/llm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/data/vlm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/static_gemma4_runtime.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/static_llama_runtime.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/tied_embedding.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/trace.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/case.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/cases/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/cases/llama.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/cases/nn.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/cases/qwen3_vl.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/registry.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/result.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/debug/wrapper_smoke/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/hellaswag.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/llava_bench_judge.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/llm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/mmlu.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/mmmu.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/video_mme.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/evaluation/vlm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/export/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/export/checkpoint.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/export/circle.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/export/llama.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/qparams.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/runner.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/stages/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/stages/base.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/stages/cle.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/stages/gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/stages/ptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/stages/smoothquant.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/stages/spinquant.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/recipes/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/dtypes.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/compare_ppl.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/debug_quant_outputs.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/evaluate_fk_llama_model.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/examples/llama → tico-0.2.0.dev260622/tico/quantization/wrapq/examples/gemma4}/__init__.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/examples/nn → tico-0.2.0.dev260622/tico/quantization/wrapq/examples/llama}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/llama/quantize_attention_decode.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/llama/quantize_attention_prefill.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/llama/quantize_decoder_layer_decode.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/llama/quantize_decoder_layer_prefill.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/llama/quantize_mlp.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/examples/qwen → tico-0.2.0.dev260622/tico/quantization/wrapq/examples/nn}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/nn/quantize_conv3d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/nn/quantize_conv3d_special_case.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/nn/quantize_layernorm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/nn/quantize_linear.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/nn/quantize_tied_embedding.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/quantize_full_qmodel_with_gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/quantize_qwen3_vl_with_gptq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/quantize_with_gptq.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/observers → tico-0.2.0.dev260622/tico/quantization/wrapq/examples/qwen}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_for_conditional_generation.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_text_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_text_decoder_layer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_text_mlp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_text_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_vision_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_vision_block.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_vision_mlp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_vision_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_vision_patch_embed.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/quantize_vision_patch_merger.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/qwen/trace_qwen.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/examples/static_llama_layer_runtime.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/mode.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/utils → tico-0.2.0.dev260622/tico/quantization/wrapq/observers}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/observers/affine_base.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/observers/base.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/observers/ema.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/observers/identity.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/observers/minmax.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/observers/mx.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/qscheme.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/quantizer.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/wrappers → tico-0.2.0.dev260622/tico/quantization/wrapq/utils}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/utils/check_missing_qparam.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/utils/introspection.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/utils/metrics.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/utils/reduce_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/utils/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrap_helper.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/wrappers/gemma4 → tico-0.2.0.dev260622/tico/quantization/wrapq/wrappers}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/fairseq/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/fairseq/decoder_export_single_step.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/fairseq/quant_decoder.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/fairseq/quant_decoder_layer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/fairseq/quant_encoder.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/fairseq/quant_encoder_layer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/fairseq/quant_mha.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/wrappers/llama → tico-0.2.0.dev260622/tico/quantization/wrapq/wrappers/gemma4}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_clippable_linear.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_for_causal_lm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_for_conditional_generation.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_multimodal_embedder.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_rmsnorm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_text_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_text_decoder_layer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_text_mlp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_text_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_vision_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_vision_encoder.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_vision_mlp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_vision_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/quant_vision_patch_embedder.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/gemma4/utils.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/wrappers/nn → tico-0.2.0.dev260622/tico/quantization/wrapq/wrappers/llama}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/llama/export_adapters.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/llama/quant_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/llama/quant_decoder_layer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/llama/quant_mlp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/llama/quant_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/llama/quant_model_for_causal_lm.py +0 -0
- {tico-0.2.0.dev260615/tico/quantization/wrapq/wrappers/ops → tico-0.2.0.dev260622/tico/quantization/wrapq/wrappers/nn}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/nn/quant_conv3d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/nn/quant_conv3d_decomposed.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/nn/quant_embedding.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/nn/quant_layernorm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/nn/quant_linear.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/nn/quant_silu.py +0 -0
- {tico-0.2.0.dev260615/tico/serialize → tico-0.2.0.dev260622/tico/quantization/wrapq/wrappers/ops}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/ops/quant_rmsnorm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/ptq_wrapper.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/quant_elementwise.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/quant_module_base.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_for_conditional_generation.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_decoder_layer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_mlp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_text_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_block.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_mlp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_patch_embed.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/quantization/wrapq/wrappers/qwen_vl/quant_vision_patch_merger.py +0 -0
- {tico-0.2.0.dev260615/tico/serialize/operators/adapters → tico-0.2.0.dev260622/tico/serialize}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/circle_graph.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/circle_mapping.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/circle_serializer.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/__init__.py +0 -0
- {tico-0.2.0.dev260615/tico/serialize/operators/adapters/onert → tico-0.2.0.dev260622/tico/serialize/operators/adapters}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/adapters/llama_rmsnorm.py +0 -0
- {tico-0.2.0.dev260615/tico/utils → tico-0.2.0.dev260622/tico/serialize/operators/adapters/onert}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/adapters/onert/llama_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/hashable_opcode.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/node_visitor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_abs.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_add.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_alias_copy.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_any.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_arange_start_step.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_argmax.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_attention.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_avg_pool2d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_bmm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_cat.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_circle_shape.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_clamp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_clone.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_constant_pad_nd.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_conv2d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_cos.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_cumsum.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_depthwise_conv2d.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_dequantize_per_channel.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_dequantize_per_tensor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_div.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_elu.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_embedding.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_eq.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_exp.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_expand.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_full.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_full_like.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_ge.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_gelu.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_gt.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_index.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_index_select.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_instance_norm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_le.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_leaky_relu.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_linear.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_log.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_log1p.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_logical_and.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_logical_not.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_lt.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_max_dim.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_max_pool2d_with_indices.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_maximum.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_mean.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_minimum.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_mm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_mul.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_ne.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_neg.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_permute.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_pow.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_prelu.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_quantize_per_tensor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_reciprocal.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_relu.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_relu6.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_repeat.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_reshape.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_resize_nearest_neighbor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_rmsnorm.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_round.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_rsqrt.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_scalar_tensor.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_select_copy.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_sigmoid.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_sin.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_slice.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_softmax.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_split_with_sizes.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_sqrt.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_squeeze.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_sub.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_sum.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_tanh.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_to_copy.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_transpose_conv.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_unsqueeze.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_view.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/op_where.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/operators/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/pack.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/serialize/quant_param.py +0 -0
- {tico-0.2.0.dev260615/tico/utils/compat → tico-0.2.0.dev260622/tico/utils}/__init__.py +0 -0
- {tico-0.2.0.dev260615/tico/utils/mx → tico-0.2.0.dev260622/tico/utils/compat}/__init__.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/compat/torch.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/compat/transformers.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/define.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/diff_graph.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/dtype.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/errors.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/graph.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/installed_packages.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/logging.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/model.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/mx/dtypes.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/mx/elemwise_ops.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/mx/formats.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/mx/mx_ops.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/padding.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/passes.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/pytree_utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/record_input.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/serialize.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/signature.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/trace_decorators.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/utils.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/validate_args_kwargs.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico/utils/version.py +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico.egg-info/dependency_links.txt +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico.egg-info/entry_points.txt +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico.egg-info/requires.txt +0 -0
- {tico-0.2.0.dev260615 → tico-0.2.0.dev260622}/tico.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.0.dev260622"
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Copyright (c) 2026 Samsung Electronics Co., Ltd. All Rights Reserved
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from typing import Any, List, Mapping, Tuple
|
|
16
|
+
|
|
17
|
+
import torch
|
|
18
|
+
from torch.export import ExportedProgram
|
|
19
|
+
from torch.export.exported_program import InputKind, InputSpec, TensorArgument
|
|
20
|
+
|
|
21
|
+
from tico.utils import logging
|
|
22
|
+
from tico.utils.errors import NotYetSupportedError
|
|
23
|
+
from tico.utils.graph import create_node, get_first_user_input
|
|
24
|
+
from tico.utils.passes import PassBase, PassResult
|
|
25
|
+
from tico.utils.trace_decorators import trace_graph_diff_on_pass
|
|
26
|
+
from tico.utils.utils import get_fake_mode, is_target_node, set_new_meta_val
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@trace_graph_diff_on_pass
|
|
30
|
+
class ConvertGatherToGatherNd(PassBase):
|
|
31
|
+
"""Lower torch.gather to an explicit internal GatherNd IR node.
|
|
32
|
+
|
|
33
|
+
PyTorch gather uses one index value per output element and replaces only the
|
|
34
|
+
gather dimension with that value:
|
|
35
|
+
|
|
36
|
+
out[p0, ..., pN] = input[p0, ..., index[p], ..., pN]
|
|
37
|
+
|
|
38
|
+
Circle GATHER_ND expects the indices input to contain full coordinates in
|
|
39
|
+
the params tensor. This pass constructs those full coordinates and replaces
|
|
40
|
+
aten.gather with circle_custom.gather_nd:
|
|
41
|
+
|
|
42
|
+
aten.gather(input, dim, index)
|
|
43
|
+
-> circle_custom.gather_nd(input, full_indices)
|
|
44
|
+
|
|
45
|
+
The resulting custom op has GatherNd semantics at the FX level and is
|
|
46
|
+
serialized directly as Circle GATHER_ND.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def call(self, exported_program: ExportedProgram) -> PassResult:
|
|
50
|
+
logger = logging.getLogger(__name__)
|
|
51
|
+
|
|
52
|
+
graph_module = exported_program.graph_module
|
|
53
|
+
graph = graph_module.graph
|
|
54
|
+
|
|
55
|
+
modified = False
|
|
56
|
+
for node in list(graph.nodes):
|
|
57
|
+
if not is_target_node(node, torch.ops.aten.gather.default):
|
|
58
|
+
continue
|
|
59
|
+
|
|
60
|
+
input_node, dim, index_node, sparse_grad = self._parse_gather_args(node)
|
|
61
|
+
if sparse_grad:
|
|
62
|
+
raise NotYetSupportedError(
|
|
63
|
+
"torch.gather with sparse_grad=True is not supported."
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
input_shape = self._get_static_shape(input_node, "gather input")
|
|
67
|
+
index_shape = self._get_static_shape(index_node, "gather index")
|
|
68
|
+
|
|
69
|
+
if len(input_shape) != len(index_shape):
|
|
70
|
+
raise NotYetSupportedError(
|
|
71
|
+
"torch.gather lowering requires input and index to have the same rank."
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
normalized_dim = self._normalize_dim(dim, len(input_shape))
|
|
75
|
+
self._validate_non_gather_shapes(input_shape, index_shape, normalized_dim)
|
|
76
|
+
|
|
77
|
+
logger.debug(
|
|
78
|
+
"%s: lowering aten.gather to circle_custom.gather_nd: "
|
|
79
|
+
"input=%r dim=%d index=%r",
|
|
80
|
+
node,
|
|
81
|
+
input_shape,
|
|
82
|
+
normalized_dim,
|
|
83
|
+
index_shape,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
with graph.inserting_before(node):
|
|
87
|
+
int32_index = self._cast_index_to_int32(graph, index_node)
|
|
88
|
+
full_indices = self._build_full_indices(
|
|
89
|
+
exported_program,
|
|
90
|
+
graph,
|
|
91
|
+
node,
|
|
92
|
+
int32_index,
|
|
93
|
+
index_shape,
|
|
94
|
+
normalized_dim,
|
|
95
|
+
)
|
|
96
|
+
gather_nd = create_node(
|
|
97
|
+
graph,
|
|
98
|
+
torch.ops.circle_custom.gather_nd,
|
|
99
|
+
args=(input_node, full_indices),
|
|
100
|
+
origin=node,
|
|
101
|
+
)
|
|
102
|
+
self._copy_non_value_meta(node, gather_nd)
|
|
103
|
+
set_new_meta_val(gather_nd)
|
|
104
|
+
|
|
105
|
+
# gather_nd already owns copied metadata and a recomputed meta["val"].
|
|
106
|
+
# Propagating metadata again would assert because the replacement node
|
|
107
|
+
# is not metadata-empty.
|
|
108
|
+
node.replace_all_uses_with(gather_nd, propagate_meta=False)
|
|
109
|
+
modified = True
|
|
110
|
+
logger.debug("%s is replaced with %s", node.name, gather_nd.name)
|
|
111
|
+
|
|
112
|
+
if modified:
|
|
113
|
+
graph.eliminate_dead_code()
|
|
114
|
+
graph.lint()
|
|
115
|
+
graph_module.recompile()
|
|
116
|
+
|
|
117
|
+
return PassResult(modified)
|
|
118
|
+
|
|
119
|
+
@staticmethod
|
|
120
|
+
def _parse_gather_args(
|
|
121
|
+
node: torch.fx.Node,
|
|
122
|
+
) -> Tuple[torch.fx.Node, int, torch.fx.Node, bool]:
|
|
123
|
+
"""Parse aten.gather arguments from an FX node."""
|
|
124
|
+
args = list(node.args)
|
|
125
|
+
kwargs: Mapping[str, Any] = node.kwargs
|
|
126
|
+
|
|
127
|
+
input_node = (
|
|
128
|
+
args[0] if len(args) > 0 else kwargs.get("input", kwargs.get("self"))
|
|
129
|
+
)
|
|
130
|
+
dim = args[1] if len(args) > 1 else kwargs.get("dim")
|
|
131
|
+
index_node = args[2] if len(args) > 2 else kwargs.get("index")
|
|
132
|
+
sparse_grad = kwargs.get("sparse_grad", False)
|
|
133
|
+
|
|
134
|
+
if not isinstance(input_node, torch.fx.Node):
|
|
135
|
+
raise NotYetSupportedError("torch.gather input must be an FX node.")
|
|
136
|
+
if not isinstance(dim, int):
|
|
137
|
+
raise NotYetSupportedError("torch.gather dim must be a static integer.")
|
|
138
|
+
if not isinstance(index_node, torch.fx.Node):
|
|
139
|
+
raise NotYetSupportedError("torch.gather index must be an FX node.")
|
|
140
|
+
if not isinstance(sparse_grad, bool):
|
|
141
|
+
raise NotYetSupportedError(
|
|
142
|
+
"torch.gather sparse_grad must be a static boolean."
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
return input_node, dim, index_node, sparse_grad
|
|
146
|
+
|
|
147
|
+
@staticmethod
|
|
148
|
+
def _normalize_dim(dim: int, rank: int) -> int:
|
|
149
|
+
"""Return a non-negative dimension index."""
|
|
150
|
+
if dim < 0:
|
|
151
|
+
dim += rank
|
|
152
|
+
if dim < 0 or dim >= rank:
|
|
153
|
+
raise NotYetSupportedError("torch.gather dimension is out of range.")
|
|
154
|
+
return dim
|
|
155
|
+
|
|
156
|
+
@staticmethod
|
|
157
|
+
def _get_static_shape(node: torch.fx.Node, tensor_name: str) -> List[int]:
|
|
158
|
+
"""Return a static tensor shape or reject dynamic shapes."""
|
|
159
|
+
shape = node.meta["val"].shape
|
|
160
|
+
static_shape = []
|
|
161
|
+
for dim in shape:
|
|
162
|
+
if not isinstance(dim, int):
|
|
163
|
+
raise NotYetSupportedError(
|
|
164
|
+
f"{tensor_name} must have a static shape for GatherNd lowering."
|
|
165
|
+
)
|
|
166
|
+
static_shape.append(dim)
|
|
167
|
+
return static_shape
|
|
168
|
+
|
|
169
|
+
@staticmethod
|
|
170
|
+
def _validate_non_gather_shapes(
|
|
171
|
+
input_shape: List[int], index_shape: List[int], gather_dim: int
|
|
172
|
+
) -> None:
|
|
173
|
+
"""Validate PyTorch gather shape constraints used by this lowering."""
|
|
174
|
+
for axis, (input_dim, index_dim) in enumerate(zip(input_shape, index_shape)):
|
|
175
|
+
if axis == gather_dim:
|
|
176
|
+
continue
|
|
177
|
+
if index_dim > input_dim:
|
|
178
|
+
raise NotYetSupportedError(
|
|
179
|
+
"torch.gather index shape must not exceed input shape for "
|
|
180
|
+
"non-gather dimensions."
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
@staticmethod
|
|
184
|
+
def _cast_index_to_int32(
|
|
185
|
+
graph: torch.fx.Graph, index_node: torch.fx.Node
|
|
186
|
+
) -> torch.fx.Node:
|
|
187
|
+
"""Return an int32 index tensor for Circle GATHER_ND."""
|
|
188
|
+
index_dtype = index_node.meta["val"].dtype
|
|
189
|
+
if index_dtype == torch.int32:
|
|
190
|
+
return index_node
|
|
191
|
+
|
|
192
|
+
if index_dtype not in (torch.int64, torch.long):
|
|
193
|
+
raise NotYetSupportedError(
|
|
194
|
+
"torch.gather index must have int32 or int64 dtype."
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
int32_index = create_node(
|
|
198
|
+
graph,
|
|
199
|
+
torch.ops.aten._to_copy.default,
|
|
200
|
+
args=(index_node,),
|
|
201
|
+
kwargs={"dtype": torch.int32},
|
|
202
|
+
origin=index_node,
|
|
203
|
+
)
|
|
204
|
+
set_new_meta_val(int32_index)
|
|
205
|
+
return int32_index
|
|
206
|
+
|
|
207
|
+
def _build_full_indices(
|
|
208
|
+
self,
|
|
209
|
+
exported_program: ExportedProgram,
|
|
210
|
+
graph: torch.fx.Graph,
|
|
211
|
+
origin: torch.fx.Node,
|
|
212
|
+
index_node: torch.fx.Node,
|
|
213
|
+
index_shape: List[int],
|
|
214
|
+
gather_dim: int,
|
|
215
|
+
) -> torch.fx.Node:
|
|
216
|
+
"""Build a tensor whose last dimension stores full GatherNd coordinates."""
|
|
217
|
+
rank = len(index_shape)
|
|
218
|
+
coordinates = []
|
|
219
|
+
for axis in range(rank):
|
|
220
|
+
if axis == gather_dim:
|
|
221
|
+
coordinate = index_node
|
|
222
|
+
else:
|
|
223
|
+
coordinate = self._add_coordinate_grid(
|
|
224
|
+
exported_program, index_shape, axis
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
unsqueezed = create_node(
|
|
228
|
+
graph,
|
|
229
|
+
torch.ops.aten.unsqueeze.default,
|
|
230
|
+
args=(coordinate, -1),
|
|
231
|
+
origin=origin,
|
|
232
|
+
)
|
|
233
|
+
set_new_meta_val(unsqueezed)
|
|
234
|
+
coordinates.append(unsqueezed)
|
|
235
|
+
|
|
236
|
+
full_indices = create_node(
|
|
237
|
+
graph,
|
|
238
|
+
torch.ops.aten.cat.default,
|
|
239
|
+
args=(coordinates, -1),
|
|
240
|
+
origin=origin,
|
|
241
|
+
)
|
|
242
|
+
set_new_meta_val(full_indices)
|
|
243
|
+
return full_indices
|
|
244
|
+
|
|
245
|
+
@classmethod
|
|
246
|
+
def _add_coordinate_grid(
|
|
247
|
+
cls, exported_program: ExportedProgram, index_shape: List[int], axis: int
|
|
248
|
+
) -> torch.fx.Node:
|
|
249
|
+
"""Add a constant coordinate grid for one non-gather dimension."""
|
|
250
|
+
rank = len(index_shape)
|
|
251
|
+
view_shape = [1] * rank
|
|
252
|
+
view_shape[axis] = index_shape[axis]
|
|
253
|
+
|
|
254
|
+
coordinate = torch.arange(index_shape[axis], dtype=torch.int32)
|
|
255
|
+
coordinate = coordinate.reshape(view_shape).expand(index_shape).clone()
|
|
256
|
+
return cls._add_non_persistent_buffer(
|
|
257
|
+
exported_program, coordinate, "_gather_nd_grid"
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
@classmethod
|
|
261
|
+
def _add_non_persistent_buffer(
|
|
262
|
+
cls,
|
|
263
|
+
exported_program: ExportedProgram,
|
|
264
|
+
tensor: torch.Tensor,
|
|
265
|
+
prefix: str,
|
|
266
|
+
) -> torch.fx.Node:
|
|
267
|
+
"""Add a generated tensor as a lifted non-persistent buffer.
|
|
268
|
+
|
|
269
|
+
A CONSTANT_TENSOR input is unlifted to a plain tensor attribute by
|
|
270
|
+
ExportedProgram.module(). FX warns when a get_attr node targets such an
|
|
271
|
+
attribute because it is not a module, parameter, or registered buffer.
|
|
272
|
+
Representing compiler-generated coordinate grids as non-persistent
|
|
273
|
+
buffers preserves ExportedProgram invariants and avoids those warnings.
|
|
274
|
+
"""
|
|
275
|
+
fake_mode = get_fake_mode(exported_program)
|
|
276
|
+
graph = exported_program.graph
|
|
277
|
+
target = cls._generate_buffer_target(exported_program, prefix)
|
|
278
|
+
|
|
279
|
+
first_user_input = get_first_user_input(exported_program)
|
|
280
|
+
if first_user_input is None:
|
|
281
|
+
first_user_input = next(iter(graph.nodes))
|
|
282
|
+
|
|
283
|
+
with graph.inserting_before(first_user_input):
|
|
284
|
+
buffer_node = graph.placeholder(target)
|
|
285
|
+
|
|
286
|
+
buffer_node.meta["val"] = fake_mode.from_tensor(tensor, static_shapes=True)
|
|
287
|
+
buffer_node.meta["val"].constant = tensor
|
|
288
|
+
|
|
289
|
+
exported_program.constants[target] = tensor
|
|
290
|
+
buffer_spec = InputSpec(
|
|
291
|
+
kind=InputKind.BUFFER,
|
|
292
|
+
arg=TensorArgument(name=buffer_node.name),
|
|
293
|
+
target=target,
|
|
294
|
+
persistent=False,
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
name_to_spec = {
|
|
298
|
+
spec.arg.name: spec for spec in exported_program.graph_signature.input_specs
|
|
299
|
+
}
|
|
300
|
+
if buffer_node.name in name_to_spec:
|
|
301
|
+
raise RuntimeError(
|
|
302
|
+
f"Input spec already exists for generated buffer {buffer_node.name}."
|
|
303
|
+
)
|
|
304
|
+
name_to_spec[buffer_node.name] = buffer_spec
|
|
305
|
+
|
|
306
|
+
new_input_specs = []
|
|
307
|
+
for graph_node in graph.nodes:
|
|
308
|
+
if graph_node.op != "placeholder":
|
|
309
|
+
continue
|
|
310
|
+
if graph_node.name not in name_to_spec:
|
|
311
|
+
raise RuntimeError(
|
|
312
|
+
f"Missing input spec for placeholder {graph_node.name}."
|
|
313
|
+
)
|
|
314
|
+
new_input_specs.append(name_to_spec[graph_node.name])
|
|
315
|
+
exported_program.graph_signature.input_specs = new_input_specs
|
|
316
|
+
|
|
317
|
+
return buffer_node
|
|
318
|
+
|
|
319
|
+
@staticmethod
|
|
320
|
+
def _generate_buffer_target(exported_program: ExportedProgram, prefix: str) -> str:
|
|
321
|
+
"""Return a unique state target for a generated buffer."""
|
|
322
|
+
used_targets = {
|
|
323
|
+
spec.target
|
|
324
|
+
for spec in exported_program.graph_signature.input_specs
|
|
325
|
+
if isinstance(spec.target, str)
|
|
326
|
+
}
|
|
327
|
+
used_targets.update(exported_program.constants.keys())
|
|
328
|
+
used_targets.update(exported_program.state_dict.keys())
|
|
329
|
+
used_targets.update(
|
|
330
|
+
str(node.target)
|
|
331
|
+
for node in exported_program.graph.nodes
|
|
332
|
+
if node.op == "placeholder"
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
index = 0
|
|
336
|
+
while True:
|
|
337
|
+
candidate = f"{prefix}{index}"
|
|
338
|
+
if candidate not in used_targets and not hasattr(
|
|
339
|
+
exported_program.graph_module, candidate
|
|
340
|
+
):
|
|
341
|
+
return candidate
|
|
342
|
+
index += 1
|
|
343
|
+
|
|
344
|
+
@staticmethod
|
|
345
|
+
def _copy_non_value_meta(src: torch.fx.Node, dst: torch.fx.Node) -> None:
|
|
346
|
+
"""Copy metadata except the value field, which is recomputed."""
|
|
347
|
+
for key, value in src.meta.items():
|
|
348
|
+
if key == "val":
|
|
349
|
+
continue
|
|
350
|
+
dst.meta[key] = value
|