tf.keras.backend.result_type

Returns the type from applying the Keras type promotion rules.

In general, each argument is first parsed by backend.standardize_dtype, and the resulting dtype is determined by the least upper bound of the type promotion lattice.

dtypes Input dtypes.

The result dtype.

Examples:

x = keras.ops.ones((1,), dtype="bfloat16")
keras.backend.result_type(x.dtype, int)
"bfloat16"
x = keras.ops.ones((1,), dtype="int32")
y = keras.ops.ones((1,), dtype="float32")
keras.backend.result_type(x.dtype, y.dtype)
"float32"