Returns the type from applying the Keras type promotion rules.
tf.keras.backend.result_type(
*dtypes
)
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.
Note: This function attempts to match the result of jnp.result_type.
| Args | |
|---|---|
dtypes | Input dtypes. |
| Returns | |
|---|---|
| The result dtype. |
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"
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/backend/result_type