Skip to content

Commit

Permalink
PR #17980: [keras/benchmarks/benchmark_util.py] Use var rather than s…
Browse files Browse the repository at this point in the history
…tring literal for `is None` checks on `measure_performance`

Imported from GitHub PR #17980

Found by running `pydocstyle` on entire codebase.
Copybara import of the project:

--
f7de756 by Samuel Marks <[email protected]>:

[keras/benchmarks/benchmark_util.py] Use var rather than string literal for `is None` checks on `measure_performance`

Merging this change closes #17980

FUTURE_COPYBARA_INTEGRATE_REVIEW=#17980 from SamuelMarks:benchmark_util-is-check f7de756
PiperOrigin-RevId: 530510171
  • Loading branch information
SamuelMarks authored and tensorflower-gardener committed May 16, 2023
1 parent 5c20928 commit 497e745
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions keras/benchmarks/benchmark_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ def measure_performance(
ValueError: If `x` is none or if `optimizer` is not provided or
if `loss` is not provided or if `num_gpus` is negative.
"""
if "x" is None:
if x is None:
raise ValueError("Input data is required.")
if "optimizer" is None:
elif optimizer is None:
raise ValueError("Optimizer is required.")
if "loss" is None:
elif loss is None:
raise ValueError("Loss function is required.")
if num_gpus < 0:
elif num_gpus < 0:
raise ValueError("`num_gpus` cannot be negative")

# TODO(xingyulong): we will add tfds support later and
Expand Down

0 comments on commit 497e745

Please sign in to comment.