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

Method ShouldRecord

tensorflow/c/eager/tape.h:339–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337
338template <typename Gradient, typename BackwardFunction, typename TapeTensor>
339bool GradientTape<Gradient, BackwardFunction, TapeTensor>::ShouldRecord(
340 gtl::ArraySlice<int64> tensor_ids,
341 gtl::ArraySlice<tensorflow::DataType> dtypes) {
342 CHECK_EQ(tensor_ids.size(), dtypes.size());
343 for (size_t i = 0; i < tensor_ids.size(); ++i) {
344 if (tensor_tape_.find(tensor_ids[i]) != tensor_tape_.end()) {
345 if (IsDtypeTrainable(dtypes[i])) {
346 return true;
347 }
348 }
349 }
350 return false;
351}
352
353template <typename Gradient, typename BackwardFunction, typename TapeTensor>
354void GradientTape<Gradient, BackwardFunction, TapeTensor>::Watch(

Callers 3

RecordGradientFunction · 0.80

Calls 4

IsDtypeTrainableFunction · 0.85
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected