tensorflow / tensorflow/probability

AttributeError: 'float' object has no attribute 'dtype' When executing tfp.optimizer.differential_evolution_one_step, but not during tfp.optimizer.differential_evolution_minimize

Open
#652 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hi!

When running
tfp.optimizer.differential_evolution_one_step, I am receiving the error:

AttributeError: 'float' object has no attribute 'dtype'

line 196, in one_step
seed=seed_stream())
File "/<path_to_tensorflow>/differential_evolution.py", line 665, in _binary_crossover
dtype=crossover_prob.dtype.base_dtype,
AttributeError: 'float' object has no attribute 'dtype'

However, when using tfp.optimizer.differential_evolution_minimize(), the code works as intended, making me think that it is potentially an issue with TFP. I am currently running Tensorflow 2.0 and TFP version 0.8.0.

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with TensorFlow 2.0 and TFP 0.8.0 using differential_evolution_one_step, then inspect differential_evolution.py around one_step and _binary_crossover at line 665. Compare its handling with differential_evolution_minimize; done means one_step no longer raises the reported AttributeError for the same inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.