MCPcopy Create free account
hub / github.com/pybind/pybind11 / num

Method num

include/pybind11/numpy.h:930–935  ·  view source on GitHub ↗

Type number of dtype. Note that different values may be returned for equivalent types, e.g. even though ``long`` may be equivalent to ``int`` or ``long long``, they still have different type numbers. Consider using `normalized_num` to avoid this.

Source from the content-addressed store, hash-verified

928 /// e.g. even though ``long`` may be equivalent to ``int`` or ``long long``, they still have
929 /// different type numbers. Consider using `normalized_num` to avoid this.
930 int num() const {
931 // Note: The signature, `dtype::num` follows the naming of NumPy's public
932 // Python API (i.e., ``dtype.num``), rather than its internal
933 // C API (``PyArray_Descr::type_num``).
934 return detail::array_descriptor_proxy(m_ptr)->type_num;
935 }
936
937 /// Type number of dtype, normalized to match the return value of `num_of` for equivalent
938 /// types. This function can be used to write switch statements that correctly handle

Callers 1

TEST_SUBMODULEFunction · 0.80

Calls 1

array_descriptor_proxyFunction · 0.85

Tested by 1

TEST_SUBMODULEFunction · 0.64