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

Method BuildEagerOp

tensorflow/lite/delegates/flex/kernel.cc:235–266  ·  view source on GitHub ↗

Build thew new EagerOperation. In case of error, the returned 'op' is guaranteed to be 'nullptr'.

Source from the content-addressed store, hash-verified

233 // Build thew new EagerOperation. In case of error, the returned 'op' is
234 // guaranteed to be 'nullptr'.
235 tensorflow::Status BuildEagerOp(tensorflow::EagerContext* eager_context) {
236 op_.reset();
237
238 const tensorflow::AttrTypeMap* attr_types;
239 bool is_function = false;
240 TF_RETURN_WITH_CONTEXT_IF_ERROR(
241 tensorflow::AttrTypeMapForOp(name_.c_str(), &attr_types, &is_function),
242 " (while processing attributes of '", name_, "')");
243 if (is_function) {
244 return tensorflow::errors::NotFound(
245 "Operation '", name_,
246 "' is not registered. (while processing attributes of '", name_,
247 "')");
248 }
249
250 op_.reset(new tensorflow::EagerOperation(eager_context, name_.c_str(),
251 /*is_function=*/false,
252 attr_types));
253
254 op_->MutableAttrs()->NumInputs(inputs_.Size());
255 for (const auto& attr : nodedef_.attr()) {
256 op_->MutableAttrs()->Set(attr.first, attr.second);
257 }
258
259 // Precalculating a cache key saves about 10% of inference time for very
260 // small models.
261 tensorflow::Device* device = op_->Device();
262 op_->MutableAttrs()->CacheKey(device == nullptr ? "unspecified"
263 : device->name());
264
265 return tensorflow::Status::OK();
266 }
267
268 void ClearEagerInputs() {
269 for (tensorflow::TensorHandle* h : *op_->MutableInputs()) {

Callers 1

InitFunction · 0.80

Calls 12

AttrTypeMapForOpFunction · 0.85
NotFoundFunction · 0.85
c_strMethod · 0.80
MutableAttrsMethod · 0.80
attrMethod · 0.80
CacheKeyMethod · 0.80
nameMethod · 0.65
resetMethod · 0.45
NumInputsMethod · 0.45
SizeMethod · 0.45
SetMethod · 0.45
DeviceMethod · 0.45

Tested by

no test coverage detected