MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / PyBfloat16_FromBfloat16

Function PyBfloat16_FromBfloat16

tensorflow/python/lib/core/bfloat16.cc:96–104  ·  view source on GitHub ↗

Constructs a PyBfloat16 object from a bfloat16.

Source from the content-addressed store, hash-verified

94
95// Constructs a PyBfloat16 object from a bfloat16.
96Safe_PyObjectPtr PyBfloat16_FromBfloat16(bfloat16 x) {
97 Safe_PyObjectPtr ref =
98 make_safe(PyBfloat16_Type.tp_alloc(&PyBfloat16_Type, 0));
99 PyBfloat16* p = reinterpret_cast<PyBfloat16*>(ref.get());
100 if (p) {
101 p->value = x;
102 }
103 return ref;
104}
105
106// Converts a Python object to a bfloat16 value. Returns true on success,
107// returns false and reports a Python error on failure.

Callers 2

PyBfloat16_NegativeFunction · 0.70
bfloat16.ccFile · 0.70

Calls 2

make_safeFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected