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

Function PlaceholderHelper

tensorflow/c/c_test_util.cc:108–119  ·  view source on GitHub ↗

All the *Helper methods are used as a workaround for the restrictions that one cannot call ASSERT_* methods in non-void-returning functions (when exceptions are disabled during compilation)

Source from the content-addressed store, hash-verified

106// one cannot call ASSERT_* methods in non-void-returning functions (when
107// exceptions are disabled during compilation)
108void PlaceholderHelper(TF_Graph* graph, TF_Status* s, const char* name,
109 TF_DataType dtype, const std::vector<int64_t>& dims,
110 TF_Operation** op) {
111 TF_OperationDescription* desc = TF_NewOperation(graph, "Placeholder", name);
112 TF_SetAttrType(desc, "dtype", dtype);
113 if (!dims.empty()) {
114 TF_SetAttrShape(desc, "shape", dims.data(), dims.size());
115 }
116 *op = TF_FinishOperation(desc, s);
117 ASSERT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s);
118 ASSERT_NE(*op, nullptr);
119}
120
121TF_Operation* Placeholder(TF_Graph* graph, TF_Status* s, const char* name,
122 TF_DataType dtype, const std::vector<int64_t>& dims) {

Callers 1

PlaceholderFunction · 0.85

Calls 9

TF_NewOperationFunction · 0.85
TF_SetAttrTypeFunction · 0.85
TF_SetAttrShapeFunction · 0.85
TF_FinishOperationFunction · 0.85
TF_GetCodeFunction · 0.85
TF_MessageFunction · 0.85
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected