Issue 1:
System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Custom

OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10

TensorFlow installed from (source or binary): Binary

TensorFlow version (use command below): 1.9-rc0

Python version: 3.6

Bazel version (if compiling from source): NA

GCC/Compiler version (if compiling from source): NA

CUDA/cuDNN version: NA

GPU model and memory: NA

Exact command to reproduce: model.fit(get_iterator,steps_per_epoch=2,batch_size=2,epochs=2,shuffle =True,verbose=1)

and

model.fit(get_iterator,get_iterator,steps_per_epoch=2,batch_size=2,epochs=2,shuffle =True,verbose=1)

Describe the problem

When I pass one dataset iterator to fit method, I get:

Please provide data as a list or tuple of 2 elements - input and target pair. Received Tensor("IteratorGetNext_4:0", shape=(2, ?), dtype=float32)

When I pass two iterators I get the error:

ValueError: You passed a dataset or dataset iterator (<tensorflow.python.data.ops.iterator_ops.Iterator object at 0x000001FEABE88748>) as input x to your model. In that case, you should not specify a target (y) argument, since the dataset or dataset iterator generates both input data and target data. Received: <tensorflow.python.data.ops.iterator_ops.Iterator object at 0x000001FEABE88748>

When I create a new dataset after zipping the original x and y data set and pass that to fit I get the error described in #19912

According to 1.9-rc0 method release notes iterators should be usable with keras training methods. Please provide a solution or provide clarification in the documentation.

Source code / logs

dataset= tf.contrib.data.make_csv_dataset(file_name,48,select_columns= ['Load_residential_multi_0','Load_residential_multi_1'],shuffle=False)
dataset = dataset.map(lambda x: tf.stack(list(x.values())))
get_iterator = dataset.make_one_shot_iterator()
get_batch = get_iterator.get_next()

#Building and training a single layer model using Keras (Available within TensorFlow)
model = Sequential()
#Input Layer
model.add(InputLayer(input_shape=(48,),name='InputLayer'))#,input_tensor =dataset
#model.add(BatchNormalization(axis=1)) #Normalizing values
#Layer1
model.add(Dense(units=5,activation='relu',name='FeedForward1')) #Add a feed forward layer
#Layer2
model.add(Dense(units=5,activation='relu',name='FeedForward2')) #Add a feed forward layer
#Output layer
model.add(Dense(units=48,name='OutputLayer'))

#Specify los function and optimizer
model.compile(loss='mse',optimizer='adam',metrics=['mae'])

#Summarize model
model.summary()
#Train the model
model.fit(get_iterator,steps_per_epoch=2,batch_size=2,epochs=2,shuffle =True,verbose=1)
#model.fit(get_iterator,get_iterator,steps_per_epoch=2,batch_size=2,epochs=2,shuffle =True,verbose=1)

Issue 2:
Hi,

I ran into this performance issue while trying to upgrade tensorflow from version 0.12.1 to 1.X.

We ran a network with large embedding lookup tables:

100K X 32 (for example, word embedding - with 100K unique words)

300K X 128 (for example, categorical feature with cardinality of 300K unique items)

After upgrading TF version to 1.0.1, GPU usage dropped in from 60% to 30%.

Training time went up in 50%-200% (depends on how big is the embedding lookup table).

This is the commit that caused the performance degradation:

f9f56f9

The handling of unique indexes is very slow and does not run in parallel with others operations.

Please note the big unique blocks in the middle.

Here is a work around (not handling unique indexes ):

class MyOptimizer(tf.train.AdamOptimizer):
def __init__(self, learning_rate=0.001, beta1=0.9, beta2=0.999, epsilon=1e-8,
use_locking=False, name="Adam"):
super(MyOptimizer,self).__init__(learning_rate,beta1, beta2, epsilon, use_locking,name)

def _apply_sparse_duplicate_indices(self, grad, var):
return self._apply_sparse(grad, var)

Thanks,

Erez