I did a few more tests and RT[:3, 3] works correctly while RT[..., :3, 3] does not. Check this minimal repro:
import tensorflow as tf
RT = tf.constant(
[
[-0.25497323, -0.81989247, -0.5126062, 0.3136883],
[-0.32365915, 0.57191426, -0.75376326, 0.36354592],
[0.9111716, -0.02627973, -0.41118845, 0.511739],
[0.0, 0.0, 0.0, 1.0],
]
)
with tf.device("/GPU:0"):
T1 = RT[..., :3,3]
T2 = RT[:3,3]
print(f"RT[..., :3,3]: {T1}")
print(f"RT[:3,3]: {T2}")
output:
2025-10-04 15:16:12.602764: I metal_plugin/src/device/metal_device.cc:1154] Metal device set to: Apple M4 Max
2025-10-04 15:16:12.602789: I metal_plugin/src/device/metal_device.cc:296] systemMemory: 128.00 GB
2025-10-04 15:16:12.602794: I metal_plugin/src/device/metal_device.cc:313] maxCacheSize: 53.76 GB
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1759583772.602803 5120482 pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
I0000 00:00:1759583772.602816 5120482 pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)
RT[..., :3,3]: [0.3136883 0.3136883 0.3136883]
RT[:3,3]: [0.3136883 0.36354592 0.511739 ]
tf 2.19, python 3.12, tf metal 1.2
Topic:
Machine Learning & AI
SubTopic:
General
Tags: