
Architecture Tests: How to Enforce Architectural Rules Directly in Code
Architectural rules that exist only in documentation will sooner or later be broken. It's not a question of if, but when.
Go to content|Go to the main menu|Go to search
We started with four practical questions: Is it worth using TensorFlow? Would PyTorch be sufficient? What are the real advantages and disadvantages? And how much do these differences matter in a typical project? To answer these questions, however, we need to conduct a small experiment.
The experiment was designed as a comparison of the two frameworks on the same image recognition task. The CIFAR-10 dataset was used, containing 60,000 images of size 32 × 32 pixels across ten classes. The architectures tested were ResNet50, VGG19, and MobileNet. Training was conducted for 5 epochs with a batch size of 32 on Intel i7-11370 and NVIDIA GeForce RTX 3060 hardware.
The experiment followed the same logic in both frameworks:
Accuracy after training was only one part of the picture. The purpose of the test was also to observe how the frameworks behave during computation. The following parameters were monitored:





These graphs show that TensorFlow has significantly higher overhead around epochs. This is often due to processes that occur at the end of each epoch, such as validation, weight updates, and callbacks.
In shorter runs, these overheads are more noticeable. In longer training sessions (tens to hundreds of epochs), the fixed overhead tends to diminish, and the difference becomes less significant.

A significant difference in the strategies of the two frameworks can be observed here. PyTorch is more predictable during debugging, while TensorFlow tends to allocate memory in blocks.


Activity | Pytorch | Tensorflow |
| Installation | Very simple | On Windows, it is highly sensitive to CUDA and cuDNN versions |
| Code readability | Python-like, straightforward debugging | More boilerplate, high abstraction due to Keras API |
| Documentation | Concise, clear | Extensive |

Architectural rules that exist only in documentation will sooner or later be broken. It's not a question of if, but when.

Software development is a dynamic field in which new tools and trends are constantly emerging. However, if we want to develop high-quality software, it is not enough to simply apply these tools and trends; we must truly understand how they work and what risks they may entail.
Thank you for your interest in subscribing to our newsletter! To complete your registration you need to confirm your subscription. We have just sent you a confirmation link to the email address you provided. Please click on this link to complete your registration. If you do not find the email, please check your spam or "Promotions" folder.
