A tool to count PyTorch tensor operations in Python files, Jupyter notebooks, and entire repositories.
git clone https://github.com/jcrucesdeveloper/TEOSC
python teosc.py file.py
# Analyze a single Python file
python teosc.py path/to/file.py
# Analyze a Jupyter notebook
python teosc.py path/to/notebook.ipynb
# Analyze an entire directory recursively
python teosc.py path/to/directory
# Save results to a file
python teosc.py path/to/file.py -o results.txt
The tool provides a summary of all PyTorch operations found in the analyzed files:
[RESULTS] Total Operation Summary:
--------------------------------------------------
Files scanned (3):
- /path/to/file1.py
- /path/to/file2.py
- /path/to/notebook.ipynb
--------------------------------------------------
Operation Count Summary:
tensor: 5
add: 3
matmul: 2
...
--------------------------------------------------
The tool counts various PyTorch operations check data/pytorch_operations.txt
Distributed under the MIT License. See LICENSE
for more information.
email: jcrucesdeveloper@gmail.com