Skip to content

Commit

Permalink
Move EagerContext methods from core.cc to context.cc.
Browse files Browse the repository at this point in the history
There are no circular dependencies that require these method to be in core.cc.

PiperOrigin-RevId: 478085600
  • Loading branch information
kenfranko authored and tensorflower-gardener committed Sep 30, 2022
1 parent dc2bfae commit 2c04e3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 14 additions & 0 deletions tensorflow/core/common_runtime/eager/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,20 @@ std::unique_ptr<RunMetadata> EagerContext::ExportRunMetadata() {
return result;
}

ImmediateExecutionTensorHandle* EagerContext::TFTensorHandleFromInterface(
ImmediateExecutionTensorHandle* handle) {
return handle;
}

Status EagerContext::RegisterFunction(AbstractFunction* f) {
FunctionDef* fdef;
TF_RETURN_IF_ERROR(f->GetFunctionDef(&fdef));
if (!fdef) {
return errors::InvalidArgument("GetFunctionDef returned nullptr.");
}
return AddFunctionDef(*fdef);
}

bool EagerContext::UsesTFRT() { return false; }

bool EagerContext::RunEagerOpAsFunction() const {
Expand Down
14 changes: 0 additions & 14 deletions tensorflow/core/common_runtime/eager/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,13 @@ ImmediateExecutionTensorHandle* EagerContext::CreateLocalHandleFromTFTensor(
/*op_device=*/nullptr, this);
}

ImmediateExecutionTensorHandle* EagerContext::TFTensorHandleFromInterface(
ImmediateExecutionTensorHandle* handle) {
return handle;
}

// TODO(b/152902651): We have to keep this function here since EagerOperation
// depends on EagerContext. Thus, the context build target can't depend on
// EagerOperation.
ImmediateExecutionOperation* EagerContext::CreateOperation() {
return new EagerOperation(this);
}

Status EagerContext::RegisterFunction(AbstractFunction* f) {
FunctionDef* fdef;
TF_RETURN_IF_ERROR(f->GetFunctionDef(&fdef));
if (!fdef) {
return errors::InvalidArgument("GetFunctionDef returned nullptr.");
}
return AddFunctionDef(*fdef);
}

// TODO(b/152902651): Once we move many execute.cc functions into
// eager_operation.cc we can avoid a circular dependency between them.
Status EagerOperation::Execute(absl::Span<AbstractTensorHandle*> retvals,
Expand Down

0 comments on commit 2c04e3f

Please sign in to comment.