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

Function ValueOrThrow

tensorflow/compiler/xla/python/types.h:44–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42// For use only inside pybind11 code.
43template <typename T>
44T ValueOrThrow(StatusOr<T> v) {
45 if (!v.ok()) {
46 throw std::runtime_error(v.status().ToString());
47 }
48 return v.ConsumeValueOrDie();
49}
50
51// Converts a NumPy dtype to a PrimitiveType.
52StatusOr<PrimitiveType> DtypeToPrimitiveType(const pybind11::dtype& np_type);

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 4

ConsumeValueOrDieMethod · 0.80
okMethod · 0.45
ToStringMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected