keras-team/keras · error · ValueError
Unknown Inception-ResNet block type. Expects "block35"…
Error message
Unknown Inception-ResNet block type. Expects "block35", "block17" or "block8", but got: {block_type} What it means
Internal helper _inception_resnet_block in keras/src/applications/inception_resnet_v2.py dispatches on block_type to build block35, block17, or block8 branch structures; any other block_type string falls through all branches and triggers this error, indicating a bug in the calling code or a corrupted model-spec argument rather than user input.
Solutions
- Pass block_type as exactly "block35", "block17", or "block8"
- Check that model-construction code did not modify or corrupt the block_type variable
- Fix case sensitivity — the names are lowercase with no extra whitespace
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/applications/inception_resnet_v2.py:353 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/5927144b5886c8f8.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/applications/inception_resnet_v2.py:353
branch_1 = conv2d_bn(branch_1, 32, 3)
branch_2 = conv2d_bn(x, 32, 1)
branch_2 = conv2d_bn(branch_2, 48, 3)
branch_2 = conv2d_bn(branch_2, 64, 3)
branches = [branch_0, branch_1, branch_2]
elif block_type == "block17":
branch_0 = conv2d_bn(x, 192, 1)
branch_1 = conv2d_bn(x, 128, 1)
branch_1 = conv2d_bn(branch_1, 160, [1, 7])
branch_1 = conv2d_bn(branch_1, 192, [7, 1])
branches = [branch_0, branch_1]
elif block_type == "block8":
branch_0 = conv2d_bn(x, 192, 1)
branch_1 = conv2d_bn(x, 192, 1)
branch_1 = conv2d_bn(branch_1, 224, [1, 3])
branch_1 = conv2d_bn(branch_1, 256, [3, 1])
branches = [branch_0, branch_1]
else:
raise ValueError(
"Unknown Inception-ResNet block type. "
'Expects "block35", "block17" or "block8", '
f"but got: {block_type}"
)
block_name = f"{block_type}_{block_idx}"
channel_axis = 1 if backend.image_data_format() == "channels_first" else 3
mixed = layers.Concatenate(axis=channel_axis, name=f"{block_name}_mixed")(
branches
)
up = conv2d_bn(
mixed,
x.shape[channel_axis],
1,
activation=None,
use_bias=True,
name=f"{block_name}_conv",
)View on GitHub (pinned to 7a34a03db6)