qml.math.get_deep_interface

get_deep_interface(value)[source]

Given a deep data structure with interface-specific scalars at the bottom, return their interface name.

Parameters

value (list, tuple) – A deep list-of-lists, tuple-of-tuples, or combination with interface-specific data hidden within it

Returns

The name of the interface deep within the value

Return type

str

Example

>>> x = [[jax.numpy.array(1), jax.numpy.array(2)], [jax.numpy.array(3), jax.numpy.array(4)]]
>>> get_deep_interface(x)
'jax'

This can be especially useful when converting to the appropriate interface:

>>> qml.math.asarray(x, like=qml.math.get_deep_interface(x))
Array([[1, 2],
       [3, 4]], dtype=int64)

Contents

Using PennyLane

Release news

Development

API

Internals