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

Function TFE_Py_TapeSetShouldRecord

tensorflow/python/eager/pywrap_tfe_src.cc:1609–1634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1607}
1608
1609PyObject* TFE_Py_TapeSetShouldRecord(PyObject* tensors) {
1610 if (!TapeCouldPossiblyRecord(tensors)) {
1611 Py_RETURN_FALSE;
1612 }
1613 // TODO(apassos) consider not building a list and changing the API to check
1614 // each tensor individually.
1615 std::vector<tensorflow::int64> tensor_ids;
1616 std::vector<tensorflow::DataType> dtypes;
1617 if (!TensorShapesAndDtypes(tensors, &tensor_ids, &dtypes)) {
1618 return nullptr;
1619 }
1620 auto tape_set = *GetTapeSet();
1621 for (TFE_Py_Tape* tape : tape_set) {
1622 if (tape->tape->ShouldRecord(tensor_ids, dtypes)) {
1623 Py_RETURN_TRUE;
1624 }
1625 }
1626 auto forward_accumulators = *GetAccumulatorSet();
1627 for (TFE_Py_ForwardAccumulator* accumulator : forward_accumulators) {
1628 if (accumulator->accumulator->ShouldRecord(tensor_ids, dtypes)) {
1629 Py_RETURN_TRUE;
1630 }
1631 }
1632
1633 Py_RETURN_FALSE;
1634}
1635
1636PyObject* TFE_Py_TapeSetPossibleGradientTypes(PyObject* tensors) {
1637 if (!TapeCouldPossiblyRecord(tensors)) {

Callers

nothing calls this directly

Calls 3

TapeCouldPossiblyRecordFunction · 0.85
TensorShapesAndDtypesFunction · 0.85
ShouldRecordMethod · 0.80

Tested by

no test coverage detected