{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,1,30]],"date-time":"2026-01-30T03:43:53Z","timestamp":1769744633824,"version":"3.49.0"},"publisher-location":"Cham","reference-count":53,"publisher":"Springer Nature Switzerland","isbn-type":[{"value":"9783031908996","type":"print"},{"value":"9783031909009","type":"electronic"}],"license":[{"start":{"date-parts":[[2025,1,1]],"date-time":"2025-01-01T00:00:00Z","timestamp":1735689600000},"content-version":"tdm","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0"},{"start":{"date-parts":[[2025,5,1]],"date-time":"2025-05-01T00:00:00Z","timestamp":1746057600000},"content-version":"vor","delay-in-days":120,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0"}],"content-domain":{"domain":["link.springer.com"],"crossmark-restriction":false},"short-container-title":[],"published-print":{"date-parts":[[2025]]},"abstract":"<jats:title>Abstract<\/jats:title>\n          <jats:p>Efficiency is essential to support responsiveness w.r.t.\u00a0ever-growing datasets, especially for Deep Learning (DL) systems. DL frameworks have traditionally embraced <jats:italic>deferred<\/jats:italic> execution-style DL code\u2014supporting symbolic, graph-based Deep Neural Network (DNN) computation. While scalable, such development is error-prone, non-intuitive, and difficult to debug. Consequently, more natural, imperative DL frameworks encouraging <jats:italic>eager<\/jats:italic> execution have emerged but at the expense of run-time performance. Though hybrid approaches aim for the \u201cbest of both worlds,\u201d using them effectively requires subtle considerations to make code amenable to safe, accurate, and efficient graph execution\u2014avoiding performance bottlenecks and semantically inequivalent results. We discuss the engineering aspects of a refactoring tool that automatically determines when it is safe and potentially advantageous to migrate imperative DL code to graph execution and vice-versa.<\/jats:p>","DOI":"10.1007\/978-3-031-90900-9_5","type":"book-chapter","created":{"date-parts":[[2025,4,30]],"date-time":"2025-04-30T04:44:49Z","timestamp":1745988289000},"page":"89-100","update-policy":"https:\/\/doi.org\/10.1007\/springer_crossmark_policy","source":"Crossref","is-referenced-by-count":1,"title":["Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Learning Programs to Graph Execution"],"prefix":"10.1007","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-7930-0182","authenticated-orcid":false,"given":"Raffi","family":"Khatchadourian","sequence":"first","affiliation":[]},{"given":"Tatiana Castro","family":"V\u00e9lez","sequence":"additional","affiliation":[]},{"ORCID":"https:\/\/orcid.org\/0000-0003-1549-881X","authenticated-orcid":false,"given":"Mehdi","family":"Bagherzadeh","sequence":"additional","affiliation":[]},{"given":"Nan","family":"Jia","sequence":"additional","affiliation":[]},{"ORCID":"https:\/\/orcid.org\/0000-0002-0735-7358","authenticated-orcid":false,"given":"Anita","family":"Raja","sequence":"additional","affiliation":[]}],"member":"297","published-online":{"date-parts":[[2025,5,1]]},"reference":[{"key":"5_CR1","unstructured":"Abadi, M., Barham, P., Chen, J., Chen, Z., Davis, A., Dean, J., Devin, M., Ghemawat, S., Irving, G., Isard, M., Kudlur, M., Levenberg, J., Monga, R., Moore, S., Murray, D.G., Steiner, B., Tucker, P., Vasudevan, V., Warden, P., Wicke, M., Yu, Y., Zheng, X.: TensorFlow: A System for Large-Scale Machine Learning. In: Symposium on Operating Systems Design and Implementation (2016)"},{"key":"5_CR2","unstructured":"Abseil, abseil\/abseil-py, (2024). https:\/\/github.com\/abseil\/abseil-py (visited on 06\/26\/2024)."},{"key":"5_CR3","unstructured":"Agrawal, A., Modi, A.N., Passos, A., Lavoie, A., Agarwal, A., Shankar, A., Ganichev, I., Levenberg, J., Hong, M., Monga, R., Cai, S.: TensorFlow Eager: A Multi-Stage, Python-Embedded DSL for Machine Learning, (2019). arXiv: 1903.01855 [cs.PL]."},{"key":"5_CR4","unstructured":"Apache, Hybridize. Apache MXNet documentation, (2021). https:\/\/mxnet.apache.org\/versions\/1.8.0\/api\/python\/docs\/tutorials\/packages\/gluon\/blocks\/hybridize.html (visited on 04\/08\/2021)"},{"key":"5_CR5","doi-asserted-by":"crossref","unstructured":"Baker, W., O\u2019Connor, M., Shahamiri, S.R., Terragni, V.: Detect, Fix, and Verify TensorFlow API Misuses. In: International Conference on Software Analysis, Evolution and Reengineering, pp. 1\u20135 (2022)","DOI":"10.1109\/SANER53432.2022.00110"},{"key":"5_CR6","unstructured":"B\u00e4umer, D., Gamma, E., Kiezun, A.: \u201cIntegrating refactoring support into a Java development tool\u201d."},{"key":"5_CR7","unstructured":"Cao, J., Chen, B., Sun, C., Hu, L., Peng, X.: Characterizing Performance Bugs in Deep Learning Systems, (2021). arXiv: 2112.01771 [cs.SE]."},{"key":"5_CR8","doi-asserted-by":"publisher","unstructured":"Cao, J., Chen, B., Sun, C., Hu, L., Wu, S., Peng, X.: Understanding Performance Problems in Deep Learning Systems. In: FSE. FSE \u201922, pp. 357\u2013369. ACM (2022). https:\/\/doi.org\/10.1145\/3540250.3549123","DOI":"10.1145\/3540250.3549123"},{"key":"5_CR9","doi-asserted-by":"publisher","unstructured":"Castro V\u00e9lez, T., Khatchadourian, R., Bagherzadeh, M., Raja, A.: Challenges in Migrating Imperative Deep Learning Programs to Graph Execution: An Empirical Study. In: MSR. MSR \u201922. ACM (2022). https:\/\/doi.org\/10.1145\/3524842.3528455","DOI":"10.1145\/3524842.3528455"},{"key":"5_CR10","unstructured":"Chen, T., Li, M., Li, Y., Lin, M., Wang, N., Wang, M., Xiao, T., Xu, B., Zhang, C., Zhang, Z.: MXNet: A Flexible and Efficient Machine Learning Library for Heterogeneous Distributed Systems. In: Workshop on Machine Learning Systems at NIPS (2015). arXiv: 1512.01274 [cs.DC]"},{"key":"5_CR11","doi-asserted-by":"publisher","unstructured":"Chen, Z., Yao, H., Lou, Y., Cao, Y., Liu, Y., Wang, H., Liu, X.: An Empirical Study on Deployment Faults of Deep Learning Based Mobile Applications. In: ICSE. IEEE (2021). https:\/\/doi.org\/10.1109\/icse43902.2021.00068","DOI":"10.1109\/icse43902.2021.00068"},{"key":"5_CR12","unstructured":"Chollet, F.: Deep Learning with Python. Manning (2020)"},{"key":"5_CR13","doi-asserted-by":"publisher","unstructured":"Dig, D., Marrero, J., Ernst, M.D.: Refactoring sequential Java code for concurrency via concurrent libraries. In: ICSE, pp. 397\u2013407 (2009). https:\/\/doi.org\/10.1109\/ICSE.2009.5070539","DOI":"10.1109\/ICSE.2009.5070539"},{"key":"5_CR14","doi-asserted-by":"publisher","unstructured":"Dillig, I., Dillig, T., Aiken, A.: Precise reasoning for programs using containers. SIGPLAN Not. 46(1), 187\u2013200 (2011). https:\/\/doi.org\/10.1145\/1925844.1926407.https:\/\/dl.acm.org\/doi\/10.1145\/1925844.1926407 (visited on 10\/11\/2023)","DOI":"10.1145\/1925844.1926407"},{"key":"5_CR15","doi-asserted-by":"publisher","unstructured":"Dolby, J., Shinnar, A., Allain, A., Reinen, J.: Ariadne. Analysis for Machine Learning Programs. In: MAPL, pp. 1\u201310. ACM (2018). https:\/\/doi.org\/10.1145\/3211346.3211349","DOI":"10.1145\/3211346.3211349"},{"key":"5_CR16","unstructured":"Eclipse Foundation, Eclipse IDE, (2024). https:\/\/eclipseide.org\/ (visited on 09\/10\/2024)."},{"key":"5_CR17","unstructured":"Eclipse Foundation, Eclipse JDT, (2025). https:\/\/github.com\/eclipse-jdt (visited on 01\/30\/2025)"},{"key":"5_CR18","unstructured":"Facebook Inc., PyTorch. TorchScript, en. (2019). https:\/\/pytorch.org\/docs\/stable\/jit.html (visited on 02\/19\/2021)"},{"key":"5_CR19","unstructured":"Google LLC, Better performance with tf.function, (2021). https:\/\/tensorflow.org\/guide\/function (visited on 02\/19\/2021)"},{"key":"5_CR20","unstructured":"Google LLC, Introduction to graphs and tf.function, (2022). https:\/\/tensorflow.org\/guide\/intro_to_graphs (visited on 01\/20\/2022)"},{"key":"5_CR21","unstructured":"Google LLC, Migrate your TensorFlow 1 code to TensorFlow 2, (2021). https:\/\/tensorflow.org\/guide\/migrate (visited on 05\/27\/2021)"},{"key":"5_CR22","unstructured":"Google LLC, tf.data.Dataset. TensorFlow, version 2.9.3. (2023). https:\/\/www.tensorflow.org\/versions\/r2.9\/api_docs\/python\/tf\/data\/Dataset (visited on 12\/15\/2023)"},{"key":"5_CR23","doi-asserted-by":"publisher","unstructured":"Humbatova, N., Jahangirova, G., Bavota, G., Riccio, V., Stocco, A., Tonella, P.: Taxonomy of real faults in Deep Learning systems. In: ICSE (2020). https:\/\/doi.org\/10.1145\/3377811.3380395","DOI":"10.1145\/3377811.3380395"},{"key":"5_CR24","unstructured":"Hybridize-Functions-Refactoring, (2024). https:\/\/github.com\/ponder-lab\/Hybridize-Functions-Refactoring (visited on 09\/30\/2024)."},{"key":"5_CR25","doi-asserted-by":"publisher","unstructured":"Islam, M.J., Nguyen, G., Pan, R., Rajan, H.: A comprehensive study on Deep Learning bug characteristics. In: FSE (2019). https:\/\/doi.org\/10.1145\/3338906.3338955","DOI":"10.1145\/3338906.3338955"},{"key":"5_CR26","unstructured":"Islam, M.J., Nguyen, H.A., Pan, R., Rajan, H.: What Do Developers Ask About ML Libraries? A Large-scale Study Using Stack Overflow, (2019). arXiv: 1906.11940 [cs.SE]."},{"key":"5_CR27","doi-asserted-by":"publisher","unstructured":"Islam, M.J., Pan, R., Nguyen, G., Rajan, H.: Repairing Deep Neural Networks: Fix Patterns and Challenges. In: ICSE (2020). https:\/\/doi.org\/10.1145\/3377811.3380378","DOI":"10.1145\/3377811.3380378"},{"key":"5_CR28","unstructured":"Istria, M.: An operation for refactorings. Issue #61. microsoft\/language-serverprotocol, Microsoft. (2021). https:\/\/github.com\/microsoft\/language-server-protocol\/issues\/61 (visited on 05\/10\/2023)"},{"key":"5_CR29","doi-asserted-by":"publisher","unstructured":"Jeong, E., Cho, S., Yu, G.-I., Jeong, J.S., Shin, D.-J., Kim, T., Chun, B.-G.: Speculative Symbolic Graph Execution of Imperative Deep Learning Programs. SIGOPS Oper. Syst. Rev. 53(1), 26\u201333 (2019). https:\/\/doi.org\/10.1145\/3352020.3352025","DOI":"10.1145\/3352020.3352025"},{"key":"5_CR30","unstructured":"Kaiyinzhou, NLPGNN\/nlpgnn\/models\/__init__.py, (2020). https:\/\/github.com\/kyzhouhzau\/NLPGNN\/blob\/b9ecec2c6df\/nlpgnn\/models\/__init__.py (visited on 07\/21\/2024)"},{"key":"5_CR31","unstructured":"Khatchadourian, R.: graph_execution_time_comparison.ipynb, (2021). https:\/\/bit.ly\/3bwrhVt (visited on 11\/03\/2021)"},{"key":"5_CR32","doi-asserted-by":"publisher","unstructured":"Khatchadourian, R., Arefin, M., Friedman, O.: ponder-lab\/Common-Eclipse-Refactoring- Framework, version v3.6.0 (2024). https:\/\/doi.org\/10.5281\/zenodo.13873498. https:\/\/github.com\/ponder-lab\/Common-Eclipse-Refactoring-Framework.","DOI":"10.5281\/zenodo.13873498"},{"key":"5_CR33","doi-asserted-by":"publisher","unstructured":"Khatchadourian, R., Tang, Y., Bagherzadeh, M., Ahmed, S.: Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams. In: ICSE. ICSE \u201919, pp. 619\u2013630. IEEE Press (2019). https:\/\/doi.org\/10.1109\/ICSE.2019.00072","DOI":"10.1109\/ICSE.2019.00072"},{"key":"5_CR34","unstructured":"Kim, T., Jeong, E., Kim, G.-W., Koo, Y., Kim, S., Yu, G.-I., Chun, B.-G.: Terra: Imperative-Symbolic Co-Execution of Imperative Deep Learning Programs. In: International Conference on Neural Information Processing Systems. NIPS \u201921, pp. 1468\u20131480 (2021)"},{"key":"5_CR35","doi-asserted-by":"publisher","unstructured":"Liu, J., Huang, Q., Xia, X., Shihab, E., Lo, D., Li, S.: Is Using Deep Learning Frameworks Free? Characterizing Technical Debt in Deep Learning Frameworks. In: ICSE. ICSE-SEIS \u201920 (2020). https:\/\/doi.org\/10.1145\/3377815.3381377","DOI":"10.1145\/3377815.3381377"},{"key":"5_CR36","unstructured":"Microsoft Corporation, Language Server Protocol, (2022). https:\/\/microsoft.github.io\/language-server-protocol (visited on 05\/10\/2023)"},{"key":"5_CR37","unstructured":"Moldovan, D., Decker, J.M., Wang, F., Johnson, A.A., Lee, B.K., Nado, Z., Sculley, D., Rompf, T., Wiltschko, A.B.: AutoGraph: Imperative-style Coding with Graphbased Performance, (2019). arXiv: 1810.08061 [cs.PL]."},{"key":"5_CR38","doi-asserted-by":"publisher","unstructured":"Nikanjam, A., Khomh, F.: Design Smells in Deep Learning Programs: An Empirical Study. In: International Conference on Software Maintenance and Evolution, pp. 332\u2013342. IEEE (2021). https:\/\/doi.org\/10.1109\/ICSME52107.2021.00036","DOI":"10.1109\/ICSME52107.2021.00036"},{"key":"5_CR39","unstructured":"Pallets, Click, (2014). http:\/\/click.palletsprojects.com (visited on 06\/25\/2024)"},{"key":"5_CR40","unstructured":"Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., K\u00f6pf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., Chintala, S.: PyTorch: An Imperative Style, High-Performance Deep Learning Library, (2019). arXiv: 1912.01703 [cs.LG]."},{"key":"5_CR41","unstructured":"Python Software Foundation, Modules. Packages, (2024). https:\/\/docs.python.org\/3\/tutorial\/modules.html#packages (visited on 04\/10\/2024)"},{"key":"5_CR42","unstructured":"Python Software Foundation, Modules. Intra-package References. Packages, (2024). https:\/\/docs.python.org\/3\/tutorial\/modules.html#intra-package-references (visited on 04\/12\/2024)"},{"key":"5_CR43","doi-asserted-by":"publisher","unstructured":"Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Global Value Numbers and Redundant Computations. In: Symposium on Principles of Programming Languages, pp. 12\u201327 (1988). https:\/\/doi.org\/10.1145\/73560.73562","DOI":"10.1145\/73560.73562"},{"key":"5_CR44","doi-asserted-by":"publisher","unstructured":"Suhan, A., Libenzi, D., Zhang, A., Schuh, P., Saeta, B., Sohn, J.Y., Shabalin, D.: LazyTensor: combining eager execution with domain-specific compilers. (2021). https:\/\/doi.org\/10.48550\/ARXIV.2102.13267. arXiv: 2102.13267 [cs.PL]","DOI":"10.48550\/ARXIV.2102.13267"},{"key":"5_CR45","unstructured":"T.J. Watson Libraries for Analysis, (2024). https:\/\/github.com\/wala\/WALA (visited on 09\/10\/2024). original-date: 2012-04-05T18:57:03Z."},{"key":"5_CR46","unstructured":"Tuppeny, D.: Support refactors that require user input\/options. Issue #1164. microsoft\/language-server-protocol, Microsoft. (2023). https:\/\/github.com\/microsoft\/language-server-protocol\/issues\/1164 (visited on 05\/10\/2023)"},{"key":"5_CR47","unstructured":"WALA, wala\/ML, (2024). http:\/\/github.com\/wala\/ML (visited on 09\/12\/2024)."},{"key":"5_CR48","doi-asserted-by":"publisher","unstructured":"Xu, G., Rountev, A.: Precise memory leak detection for java software using container profiling. ACM Trans. Softw. Eng. Methodol. 22(3), 1\u201328 (2013). https:\/\/doi.org\/10.1145\/2491509.2491511","DOI":"10.1145\/2491509.2491511"},{"key":"5_CR49","doi-asserted-by":"publisher","unstructured":"Yang, Y., Milanova, A., Hirzel, M.: Complex Python Features in the Wild. In: MSR, pp. 282\u2013293. ACM (2022). https:\/\/doi.org\/10.1145\/3524842.3528467","DOI":"10.1145\/3524842.3528467"},{"key":"5_CR50","unstructured":"Zadrozny, F.: PyDev, (2023). https:\/\/www.pydev.org (visited on 05\/31\/2023)"},{"key":"5_CR51","doi-asserted-by":"publisher","unstructured":"Zhang, T., Gao, C., Ma, L., Lyu, M., Kim, M.: An Empirical Study of Common Challenges in Developing Deep Learning Applications. In: International Symposium on Software Reliability Engineering (2019). https:\/\/doi.org\/10.1109\/ISSRE.2019.00020","DOI":"10.1109\/ISSRE.2019.00020"},{"key":"5_CR52","doi-asserted-by":"publisher","unstructured":"Zhang, Y., Chen, Y., Cheung, S.-C., Xiong, Y., Zhang, L.: An Empirical Study on TensorFlow Program Bugs. In: International Symposium on Software Testing and Analysis (2018). https:\/\/doi.org\/10.1145\/3213846.3213866","DOI":"10.1145\/3213846.3213866"},{"key":"5_CR53","doi-asserted-by":"publisher","unstructured":"Zhou, W., Zhao, Y., Zhang, G., Shen, X.: HARP: Holistic Analysis for Refactoring Python-Based Analytics Programs. In: ICSE (2020). https:\/\/doi.org\/10.1145\/3377811.3380434","DOI":"10.1145\/3377811.3380434"}],"container-title":["Lecture Notes in Computer Science","Fundamental Approaches to Software Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/link.springer.com\/content\/pdf\/10.1007\/978-3-031-90900-9_5","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,4,30]],"date-time":"2025-04-30T04:45:22Z","timestamp":1745988322000},"score":1,"resource":{"primary":{"URL":"https:\/\/link.springer.com\/10.1007\/978-3-031-90900-9_5"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025]]},"ISBN":["9783031908996","9783031909009"],"references-count":53,"URL":"https:\/\/doi.org\/10.1007\/978-3-031-90900-9_5","relation":{},"ISSN":["0302-9743","1611-3349"],"issn-type":[{"value":"0302-9743","type":"print"},{"value":"1611-3349","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025]]},"assertion":[{"value":"1 May 2025","order":1,"name":"first_online","label":"First Online","group":{"name":"ChapterHistory","label":"Chapter History"}},{"value":"FASE","order":1,"name":"conference_acronym","label":"Conference Acronym","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"International Conference on Fundamental Approaches to Software Engineering","order":2,"name":"conference_name","label":"Conference Name","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"Hamilton, ON","order":3,"name":"conference_city","label":"Conference City","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"Canada","order":4,"name":"conference_country","label":"Conference Country","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"2025","order":5,"name":"conference_year","label":"Conference Year","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"3 May 2025","order":7,"name":"conference_start_date","label":"Conference Start Date","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"8 May 2025","order":8,"name":"conference_end_date","label":"Conference End Date","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"28","order":9,"name":"conference_number","label":"Conference Number","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"fase2025","order":10,"name":"conference_id","label":"Conference ID","group":{"name":"ConferenceInfo","label":"Conference Information"}},{"value":"https:\/\/etaps.org\/2025\/conferences\/fase\/","order":11,"name":"conference_url","label":"Conference URL","group":{"name":"ConferenceInfo","label":"Conference Information"}}]}}