fix(research): replace deprecated np.int with int in mobilenet_v3#13609
Merged
marksandler2 merged 1 commit intotensorflow:masterfrom Feb 13, 2026
Merged
Conversation
The use of `np.int` was deprecated in NumPy 1.20 and completely removed in NumPy 1.24. This change caused `_reduce_consecutive_layers` to fail with an AttributeError when using NumPy 1.24+. This commit replaces `np.int` with the built-in `int` function to ensure compatibility with modern NumPy versions. Affected file: research/slim/nets/mobilenet/mobilenet_v3.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a compatibility issue with NumPy 1.24+ in the MobileNet V3 implementation.
The Problem:
NumPy 1.20 deprecated
np.int, and NumPy 1.24 completely removed it. This causes anAttributeError: module 'numpy' has no attribute 'int'when_reduce_consecutive_layersis called (e.g., when building Minimalistic or EdgeTPU variants of MobileNetV3).The Fix:
Replaced the removed
np.int(...)with Python's built-inint(...).Changes
research/slim/nets/mobilenet/mobilenet_v3.py: Replacednp.intwithintin the_reduce_consecutive_layersfunction.Verification
num_outputsinconv_defsis strictly scalar, ensuringint()is the correct and safe replacement.