| 337 | |
| 338 | template <typename Gradient, typename BackwardFunction, typename TapeTensor> |
| 339 | bool 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 | |
| 353 | template <typename Gradient, typename BackwardFunction, typename TapeTensor> |
| 354 | void GradientTape<Gradient, BackwardFunction, TapeTensor>::Watch( |
no test coverage detected