Skip to content

Make initial tensor dimensions general#156

Draft
khatchad wants to merge 818 commits intomasterfrom
267-initial-tensor-dimensions-arent-always-accurate
Draft

Make initial tensor dimensions general#156
khatchad wants to merge 818 commits intomasterfrom
267-initial-tensor-dimensions-arent-always-accurate

Conversation

@khatchad
Copy link
Member

@khatchad khatchad commented Jul 11, 2025

Fix wala#267.

  • Add all dtypes to library summary,

@khatchad khatchad linked an issue Jul 11, 2025 that may be closed by this pull request
@khatchad khatchad self-assigned this Jul 11, 2025
@codecov
Copy link

codecov bot commented Jul 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.74%. Comparing base (0197356) to head (6185d5a).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #156      +/-   ##
============================================
- Coverage     59.77%   59.74%   -0.03%     
+ Complexity      521      520       -1     
============================================
  Files           109      109              
  Lines          7480     7480              
  Branches        828      828              
============================================
- Hits           4471     4469       -2     
- Misses         2830     2832       +2     
  Partials        179      179              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@khatchad khatchad closed this Jul 22, 2025
@khatchad khatchad deleted the 267-initial-tensor-dimensions-arent-always-accurate branch July 22, 2025 16:11
@khatchad khatchad restored the 267-initial-tensor-dimensions-arent-always-accurate branch July 22, 2025 16:12
@khatchad khatchad reopened this Jul 22, 2025
…egalArgumentException when indices points-to set is empty.
…legalArgumentException when 'lam' argument is missing.
khatchad added 30 commits March 11, 2026 15:24
- Modified `PythonConstructorTargetSelector` to extract methods from both `IPythonClass` and `BypassSyntheticClass` (XML summaries), including the "do" method for the latter.
- Updated `PythonInstanceMethodTrampolineTargetSelector` to recognize summarized classes as callables.
- Updated `PythonSuper` with similar logic to support `super()` calls for summarized classes.
- Ensures `self` correctly refers to the instance object in summarized methods, addressing wala#127.
This commit resolves wala#127 by updating
how synthetic methods defined in XML summaries are integrated into the
Python front-end's object model.

- Modifies `PythonAnalysisEngine` to automatically translate synthetic
  XML methods into "Function Classes", allowing them to leverage the
  existing trampoline generation infrastructure.
- Restricts the application of the `IPythonClass` interface to only
  those synthetic classes that actually contain methods, preventing
  the erroneous interception of non-instance factory functions (e.g.,
  `tf.reshape`) by the Python constructor selector.
- Updates `PythonInstanceMethodTrampolineTargetSelector` to support
  flexible lookups of the `__call__` method for synthetic types,
  ensuring implicit invocations (like `c()`) route correctly to
  the underlying `do` method.
This commit improves the Pass 2 logic in `PythonAnalysisEngine` to
accurately distinguish between auto-generated dummy constructors and
intentional factory functions defined in XML summaries (e.g.,
`pd.read_excel`).

- Updates the removal heuristic to only delete `do` methods that
  allocate the exact type of their declaring class AND belong to a class
  possessing other instance methods.
- Ensures that pure factory functions modeled as classes without instance
  methods remain untouched, preserving their original XML-defined
  semantics.
- Fixes `TestPandasModel.testPandas1` and ensures continued support for
  TensorFlow factory functions while maintaining the fix for
  wala#127.
…ly used a read_data helper that did not preserve shape and dtype information from input tensors.
…o remove the `read_dataset` helper.

This change inlines tensor allocations directly within the `do` methods. It avoids the `read_dataset` helper pattern, which obfuscates object creation from 1-CFA context sensitivity. This prevents the aliasing of resulting tensor objects and ensures that tensor arguments are correctly tracked, fixing the failing test `testDataset19`.
… trampolines.

- Updated `PythonInstanceMethodTrampolineTargetSelector` to properly recognize and resolve `do` methods (via a new constant `DO_METHOD_NAME`) for summarized classes when they are invoked as callables.
- Added type safety to `getCall()` in `PythonMethodTrampolineTargetSelector` to gracefully return `null` instead of throwing `ClassCastException` on non-Python invoke instructions, avoiding analysis crashes.
Added an explanatory comment to the `from_tensor_slices` method detailing why dataset field initializations are duplicated across operations. This redundancy is required to bypass WALA's 1-CFA context sensitivity limits, ensuring unique allocation sites and preventing object aliasing in chained dataset operations.
Removes the centralized `read_dataset` helper methods in `Dataset` and `ImageDataGenerator` and inlines their logic directly into the `do` methods of various dataset operations. This circumvents 1-CFA context sensitivity limitations, ensuring unique allocation sites for dataset fields and preventing object aliasing in chained operations.
The underlying trampoline resolution issues that necessitated these workarounds have been resolved.
…l tensor specs in the code.

The initial tensor dimensions were not accurate, which caused the test to fail. The expected tensor spec should be (256, 28, 28, 1) with dtype float32, which matches the actual tensor spec used in the `train_step` function in the `tensorflow_gan_tutorial.py` file.
In case we need it.
That's where they currently are.
…ponding tensor generators to support pass-through behavior for __call__ and call methods. Also, refine tensor source identification in PythonTensorAnalysisEngine by verifying sources with TensorGeneratorFactory.
…tive layer discovery and fixing trampoline injection for multiple allocations in summarized methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track initial tensor shapes and dtypes through literals

1 participant