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

TensorFlow SKFlow Estimators Fail when Using read_batch_examples #4026

Closed
craymichael opened this issue Aug 24, 2016 · 3 comments
Closed

TensorFlow SKFlow Estimators Fail when Using read_batch_examples #4026

craymichael opened this issue Aug 24, 2016 · 3 comments
Assignees
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower

Comments

@craymichael
Copy link

Environment info

Operating System: Ubuntu

Package: https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl
Version: 0.10.0rc0

I'm currently trying to use tf.contrib.learn.read_batch_examples working while using a TensorFlow (SKFlow/tf.contrib) Estimator, specifically the LinearClassifier. I create a read_batch_examples op feeding in a CSV file with a tf.decode_csv for the parse_fn parameter with appropriate default records. I then feed that op to my input_fn for fitting the Estimator, but when that's run I receive the following error:

Error Message

ValueError: Tensor("centered_bias_weight:0", shape=(1,), dtype=float32_ref) must be from the same graph as Tensor("linear/linear/BiasAdd:0", shape=(?, 1), dtype=float32).

What I've Tried

The code works if I run the op beforehand and then feed the input instead as an array of values. While this workaround exists, it is unhelpful because I am working with large datasets in which I need to batch in my inputs. Currently going over Estimator.fit (currently equivalent to Estimator.partial_fit in iterations isn't nearly as fast as being able to feed in data as it trains, so having this working is ideal. Additionally I've tried wrapping everything with with tf.Graph().asdefault(). Any ideas? The non-functioning code is below.

Shortened Source Code to Reproduce

read_batch_examples_fails_with_estimator.txt

Any alternatives for batching would be appreciated as well!

@prb12
Copy link
Member

prb12 commented Aug 26, 2016

@ilblackdragon Could you please take a look at this?

@prb12 prb12 added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Aug 26, 2016
@ilblackdragon ilblackdragon self-assigned this Aug 26, 2016
@gilberthendry
Copy link

You have to call read_batch_examples from somewhere inside input_fn so that the tensors it creates are in the graph that Estimator creates in fit().

@craymichael
Copy link
Author

Oh I feel like an idiot! I've been creating the op outside of the graph scope. It works now, can't believe I didn't think to try that. Thanks a lot! This is a non-issue and has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower
Projects
None yet
Development

No branches or pull requests

4 participants