Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include operator name in "Checkpointing unsupported" error #5128

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions dali/pipeline/operator/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class DLL_PUBLIC OperatorBase {
* Is called exactly once per epoch.
*/
virtual void SaveState(OpCheckpoint &cpt, AccessOrder order) {
DALI_FAIL("Checkpointing is not implemented for this operator.");
CheckpointingUnsupportedError();
}

/**
Expand All @@ -171,7 +171,7 @@ class DLL_PUBLIC OperatorBase {
* Implementation can be blocking, as the performance is not critical.
*/
virtual void RestoreState(const OpCheckpoint &cpt) {
DALI_FAIL("Checkpointing is not implemented for this operator.");
CheckpointingUnsupportedError();
}

/**
Expand All @@ -180,14 +180,14 @@ class DLL_PUBLIC OperatorBase {
* Passed OpCheckpoint should have the host access order.
*/
virtual std::string SerializeCheckpoint(const OpCheckpoint &cpt) const {
DALI_FAIL("Checkpointing is not implemented for this operator.");
CheckpointingUnsupportedError();
}

/**
* @brief Deserializes serialized operator state and sets it in the passed OpCheckpoint.
*/
virtual void DeserializeCheckpoint(OpCheckpoint &cpt, const std::string &data) const {
DALI_FAIL("Checkpointing is not implemented for this operator.");
CheckpointingUnsupportedError();
}

protected:
Expand All @@ -210,6 +210,10 @@ class DLL_PUBLIC OperatorBase {
dali::GetPerSampleArgument(output, argument_name, spec_, ws, batch_size);
}

[[noreturn]] void CheckpointingUnsupportedError() const {
DALI_FAIL(make_string("Checkpointing is not implemented for this operator: ", spec_.name()));
}

// TODO(mszolucha): remove these two to allow i2i variable batch size, when all ops are ready
template <typename Backend>
DLL_PUBLIC void EnforceUniformInputBatchSize(const Workspace &ws) const;
Expand Down