Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.backend.result_type
Stay organized with collections
Save and categorize content based on your preferences.
Infers the result dtype from a list of input types, backend-agnostically.
meridian.backend.result_type(
*types
) -> str
This acts as the single source of truth for type promotion rules. The
promotion logic is designed to be consistent across all backends.
Rule: If any input is a float, the result is float32. Otherwise, the result
is int64 to match NumPy/JAX's default behavior for precision.
Args |
*types
|
A variable number of type objects (e.g., <class 'int'> ,
np.dtype('float32')).
|
Returns |
A string representing the promoted dtype.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-05 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-05 UTC."],[],[],null,["\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/google/meridian/blob/v1.2.0/meridian/backend/__init__.py#L63-L92) |\n\nInfers the result dtype from a list of input types, backend-agnostically. \n\n meridian.backend.result_type(\n *types\n ) -\u003e str\n\nThis acts as the single source of truth for type promotion rules. The\npromotion logic is designed to be consistent across all backends.\n\nRule: If any input is a float, the result is float32. Otherwise, the result\nis int64 to match NumPy/JAX's default behavior for precision.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------|---------------------------------------------------------------------------------|\n| `*types` | A variable number of type objects (e.g., `\u003cclass 'int'\u003e`, np.dtype('float32')). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A string representing the promoted dtype. ||\n\n\u003cbr /\u003e"]]