tensorflow dataset api input for training tuple object has no ndims attribute












-1















so I'm trying to train a GAN to color images using a the new TensorFlow data set API
and I cant get it to work



I'm trying to use the simple one shot iterator for my data set and I think it might be causing the problem but I can't figure out why



so what I'm asking is



can someone tell me whats wrong with the code



code:



creating the data set



def get_next():

#where gray_ls is just a list of image paths
gray_ds = tf.data.Dataset.from_tensor_slices(gray_ls).shuffle(50).map(in_parser).batch(30).repeat()
print(f"output types = {gray_ds.output_types}") # --> output types = <dtype: 'float32'>
print(f"output shapes = {gray_ds.output_shapes}") # --> output shapes = (?, ?, ?, ?)

gray_iter = gray_ds.make_one_shot_iterator()
next_gray = gray_iter.get_next()

# next_color is the same as next gray just different images
return next_color, next_gray

# mapping function
def in_parser(img_path):

img_file = tf.read_file(img_path)
img = tf.image.decode_image(img_file,channels=3)
img = tf.image.random_flip_left_right(img)
img = tf.image.random_brightness(img, max_delta = 0.1)
img = tf.image.random_contrast(img, lower = 0.9, upper = 1.1)
img = tf.cast(img, tf.float32)
img = img/255.0
print(img)
return img
#some global vars
stddev = 0.02
decay = 0.9
epsilon = 1e-4
k_size = [5,5]
strides = [2,2]
def gen(input, is_train):

#chanel number
c1 , c2 ,c3 ,c4 = 64, 128, 256, 512

with tf.variable_scope("gen",reuse=tf.AUTO_REUSE):

#this is where it crashes
conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
name='conv1')

bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,
decay=decay,epsilon=epsilon,scope='bn1')
ac1 = lrelu(bn1,'ac1')
#there is more code after this


trying to run it:



next_color, next_gray = get_next()

sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
foo = sess.run(next_gray)

print(f"foo ndims : {foo.ndim}") # --> foo ndims : 4
gen_image = gen(foo, True)
# some more code after this


now this rasises an error:



 AttributeError: 'tuple' object has no attribute 'ndims'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-701a9276e633> in <module>()
94
95
---> 96 train()

<ipython-input-1-701a9276e633> in train()
41 # print(foo.shape)
42 print("==========================+==============")
---> 43 gen_image = gen(foo, True)
44 # gen_image = gen(next_gray, True)
45 print("==========================+==============")

~Desktopcodepythonimage_processingUntitled FolderUntitled Foldertesting1_2my_gen.py in gen(input, is_train)
30 conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
31 kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
---> 32 name='conv1')
33
34 bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersconvolutional.py in conv2d(inputs, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, trainable, name, reuse)
423 _reuse=reuse,
424 _scope=name)
--> 425 return layer.apply(inputs)
426
427

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in apply(self, inputs, *args, **kwargs)
803 Output tensor(s).
804 """
--> 805 return self.__call__(inputs, *args, **kwargs)
806
807 def _set_learning_phase_metadata(self, inputs, outputs):

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersbase.py in __call__(self, inputs, *args, **kwargs)
360
361 # Actually call layer
--> 362 outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
363
364 if not context.executing_eagerly():

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in __call__(self, inputs, *args, **kwargs)
718
719 # Check input assumptions set before layer building, e.g. input rank.
--> 720 self._assert_input_compatibility(inputs)
721 if input_list and self._dtype is None:
722 try:

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in _assert_input_compatibility(self, inputs)
1408 spec.min_ndim is not None or
1409 spec.max_ndim is not None):
-> 1410 if x.shape.ndims is None:
1411 raise ValueError('Input ' + str(input_index) + ' of layer ' +
1412 self.name + ' is incompatible with the layer: '

AttributeError: 'tuple' object has no attribute 'ndims'


thanks in advance










share|improve this question

























  • Please include the error in the body of your question, it is OK to copy and paste the error in as text, just format it as a code block and it will render OK.

    – SuperShoot
    Nov 25 '18 at 10:19











  • What is gen? That's where the error happens.

    – Matthieu Brucher
    Nov 25 '18 at 10:27
















-1















so I'm trying to train a GAN to color images using a the new TensorFlow data set API
and I cant get it to work



I'm trying to use the simple one shot iterator for my data set and I think it might be causing the problem but I can't figure out why



so what I'm asking is



can someone tell me whats wrong with the code



code:



creating the data set



def get_next():

#where gray_ls is just a list of image paths
gray_ds = tf.data.Dataset.from_tensor_slices(gray_ls).shuffle(50).map(in_parser).batch(30).repeat()
print(f"output types = {gray_ds.output_types}") # --> output types = <dtype: 'float32'>
print(f"output shapes = {gray_ds.output_shapes}") # --> output shapes = (?, ?, ?, ?)

gray_iter = gray_ds.make_one_shot_iterator()
next_gray = gray_iter.get_next()

# next_color is the same as next gray just different images
return next_color, next_gray

# mapping function
def in_parser(img_path):

img_file = tf.read_file(img_path)
img = tf.image.decode_image(img_file,channels=3)
img = tf.image.random_flip_left_right(img)
img = tf.image.random_brightness(img, max_delta = 0.1)
img = tf.image.random_contrast(img, lower = 0.9, upper = 1.1)
img = tf.cast(img, tf.float32)
img = img/255.0
print(img)
return img
#some global vars
stddev = 0.02
decay = 0.9
epsilon = 1e-4
k_size = [5,5]
strides = [2,2]
def gen(input, is_train):

#chanel number
c1 , c2 ,c3 ,c4 = 64, 128, 256, 512

with tf.variable_scope("gen",reuse=tf.AUTO_REUSE):

#this is where it crashes
conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
name='conv1')

bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,
decay=decay,epsilon=epsilon,scope='bn1')
ac1 = lrelu(bn1,'ac1')
#there is more code after this


trying to run it:



next_color, next_gray = get_next()

sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
foo = sess.run(next_gray)

print(f"foo ndims : {foo.ndim}") # --> foo ndims : 4
gen_image = gen(foo, True)
# some more code after this


now this rasises an error:



 AttributeError: 'tuple' object has no attribute 'ndims'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-701a9276e633> in <module>()
94
95
---> 96 train()

<ipython-input-1-701a9276e633> in train()
41 # print(foo.shape)
42 print("==========================+==============")
---> 43 gen_image = gen(foo, True)
44 # gen_image = gen(next_gray, True)
45 print("==========================+==============")

~Desktopcodepythonimage_processingUntitled FolderUntitled Foldertesting1_2my_gen.py in gen(input, is_train)
30 conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
31 kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
---> 32 name='conv1')
33
34 bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersconvolutional.py in conv2d(inputs, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, trainable, name, reuse)
423 _reuse=reuse,
424 _scope=name)
--> 425 return layer.apply(inputs)
426
427

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in apply(self, inputs, *args, **kwargs)
803 Output tensor(s).
804 """
--> 805 return self.__call__(inputs, *args, **kwargs)
806
807 def _set_learning_phase_metadata(self, inputs, outputs):

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersbase.py in __call__(self, inputs, *args, **kwargs)
360
361 # Actually call layer
--> 362 outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
363
364 if not context.executing_eagerly():

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in __call__(self, inputs, *args, **kwargs)
718
719 # Check input assumptions set before layer building, e.g. input rank.
--> 720 self._assert_input_compatibility(inputs)
721 if input_list and self._dtype is None:
722 try:

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in _assert_input_compatibility(self, inputs)
1408 spec.min_ndim is not None or
1409 spec.max_ndim is not None):
-> 1410 if x.shape.ndims is None:
1411 raise ValueError('Input ' + str(input_index) + ' of layer ' +
1412 self.name + ' is incompatible with the layer: '

AttributeError: 'tuple' object has no attribute 'ndims'


thanks in advance










share|improve this question

























  • Please include the error in the body of your question, it is OK to copy and paste the error in as text, just format it as a code block and it will render OK.

    – SuperShoot
    Nov 25 '18 at 10:19











  • What is gen? That's where the error happens.

    – Matthieu Brucher
    Nov 25 '18 at 10:27














-1












-1








-1








so I'm trying to train a GAN to color images using a the new TensorFlow data set API
and I cant get it to work



I'm trying to use the simple one shot iterator for my data set and I think it might be causing the problem but I can't figure out why



so what I'm asking is



can someone tell me whats wrong with the code



code:



creating the data set



def get_next():

#where gray_ls is just a list of image paths
gray_ds = tf.data.Dataset.from_tensor_slices(gray_ls).shuffle(50).map(in_parser).batch(30).repeat()
print(f"output types = {gray_ds.output_types}") # --> output types = <dtype: 'float32'>
print(f"output shapes = {gray_ds.output_shapes}") # --> output shapes = (?, ?, ?, ?)

gray_iter = gray_ds.make_one_shot_iterator()
next_gray = gray_iter.get_next()

# next_color is the same as next gray just different images
return next_color, next_gray

# mapping function
def in_parser(img_path):

img_file = tf.read_file(img_path)
img = tf.image.decode_image(img_file,channels=3)
img = tf.image.random_flip_left_right(img)
img = tf.image.random_brightness(img, max_delta = 0.1)
img = tf.image.random_contrast(img, lower = 0.9, upper = 1.1)
img = tf.cast(img, tf.float32)
img = img/255.0
print(img)
return img
#some global vars
stddev = 0.02
decay = 0.9
epsilon = 1e-4
k_size = [5,5]
strides = [2,2]
def gen(input, is_train):

#chanel number
c1 , c2 ,c3 ,c4 = 64, 128, 256, 512

with tf.variable_scope("gen",reuse=tf.AUTO_REUSE):

#this is where it crashes
conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
name='conv1')

bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,
decay=decay,epsilon=epsilon,scope='bn1')
ac1 = lrelu(bn1,'ac1')
#there is more code after this


trying to run it:



next_color, next_gray = get_next()

sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
foo = sess.run(next_gray)

print(f"foo ndims : {foo.ndim}") # --> foo ndims : 4
gen_image = gen(foo, True)
# some more code after this


now this rasises an error:



 AttributeError: 'tuple' object has no attribute 'ndims'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-701a9276e633> in <module>()
94
95
---> 96 train()

<ipython-input-1-701a9276e633> in train()
41 # print(foo.shape)
42 print("==========================+==============")
---> 43 gen_image = gen(foo, True)
44 # gen_image = gen(next_gray, True)
45 print("==========================+==============")

~Desktopcodepythonimage_processingUntitled FolderUntitled Foldertesting1_2my_gen.py in gen(input, is_train)
30 conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
31 kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
---> 32 name='conv1')
33
34 bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersconvolutional.py in conv2d(inputs, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, trainable, name, reuse)
423 _reuse=reuse,
424 _scope=name)
--> 425 return layer.apply(inputs)
426
427

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in apply(self, inputs, *args, **kwargs)
803 Output tensor(s).
804 """
--> 805 return self.__call__(inputs, *args, **kwargs)
806
807 def _set_learning_phase_metadata(self, inputs, outputs):

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersbase.py in __call__(self, inputs, *args, **kwargs)
360
361 # Actually call layer
--> 362 outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
363
364 if not context.executing_eagerly():

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in __call__(self, inputs, *args, **kwargs)
718
719 # Check input assumptions set before layer building, e.g. input rank.
--> 720 self._assert_input_compatibility(inputs)
721 if input_list and self._dtype is None:
722 try:

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in _assert_input_compatibility(self, inputs)
1408 spec.min_ndim is not None or
1409 spec.max_ndim is not None):
-> 1410 if x.shape.ndims is None:
1411 raise ValueError('Input ' + str(input_index) + ' of layer ' +
1412 self.name + ' is incompatible with the layer: '

AttributeError: 'tuple' object has no attribute 'ndims'


thanks in advance










share|improve this question
















so I'm trying to train a GAN to color images using a the new TensorFlow data set API
and I cant get it to work



I'm trying to use the simple one shot iterator for my data set and I think it might be causing the problem but I can't figure out why



so what I'm asking is



can someone tell me whats wrong with the code



code:



creating the data set



def get_next():

#where gray_ls is just a list of image paths
gray_ds = tf.data.Dataset.from_tensor_slices(gray_ls).shuffle(50).map(in_parser).batch(30).repeat()
print(f"output types = {gray_ds.output_types}") # --> output types = <dtype: 'float32'>
print(f"output shapes = {gray_ds.output_shapes}") # --> output shapes = (?, ?, ?, ?)

gray_iter = gray_ds.make_one_shot_iterator()
next_gray = gray_iter.get_next()

# next_color is the same as next gray just different images
return next_color, next_gray

# mapping function
def in_parser(img_path):

img_file = tf.read_file(img_path)
img = tf.image.decode_image(img_file,channels=3)
img = tf.image.random_flip_left_right(img)
img = tf.image.random_brightness(img, max_delta = 0.1)
img = tf.image.random_contrast(img, lower = 0.9, upper = 1.1)
img = tf.cast(img, tf.float32)
img = img/255.0
print(img)
return img
#some global vars
stddev = 0.02
decay = 0.9
epsilon = 1e-4
k_size = [5,5]
strides = [2,2]
def gen(input, is_train):

#chanel number
c1 , c2 ,c3 ,c4 = 64, 128, 256, 512

with tf.variable_scope("gen",reuse=tf.AUTO_REUSE):

#this is where it crashes
conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
name='conv1')

bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,
decay=decay,epsilon=epsilon,scope='bn1')
ac1 = lrelu(bn1,'ac1')
#there is more code after this


trying to run it:



next_color, next_gray = get_next()

sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
foo = sess.run(next_gray)

print(f"foo ndims : {foo.ndim}") # --> foo ndims : 4
gen_image = gen(foo, True)
# some more code after this


now this rasises an error:



 AttributeError: 'tuple' object has no attribute 'ndims'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-701a9276e633> in <module>()
94
95
---> 96 train()

<ipython-input-1-701a9276e633> in train()
41 # print(foo.shape)
42 print("==========================+==============")
---> 43 gen_image = gen(foo, True)
44 # gen_image = gen(next_gray, True)
45 print("==========================+==============")

~Desktopcodepythonimage_processingUntitled FolderUntitled Foldertesting1_2my_gen.py in gen(input, is_train)
30 conv1 = tf.layers.conv2d(input,c1,k_size,strides,'SAME',
31 kernel_initializer=tf.truncated_normal_initializer(stddev=stddev),
---> 32 name='conv1')
33
34 bn1 = tf.contrib.layers.batch_norm(conv1,is_training=is_train, updates_collections=None,

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersconvolutional.py in conv2d(inputs, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, trainable, name, reuse)
423 _reuse=reuse,
424 _scope=name)
--> 425 return layer.apply(inputs)
426
427

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in apply(self, inputs, *args, **kwargs)
803 Output tensor(s).
804 """
--> 805 return self.__call__(inputs, *args, **kwargs)
806
807 def _set_learning_phase_metadata(self, inputs, outputs):

~Anaconda2envsimage_reclibsite-packagestensorflowpythonlayersbase.py in __call__(self, inputs, *args, **kwargs)
360
361 # Actually call layer
--> 362 outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
363
364 if not context.executing_eagerly():

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in __call__(self, inputs, *args, **kwargs)
718
719 # Check input assumptions set before layer building, e.g. input rank.
--> 720 self._assert_input_compatibility(inputs)
721 if input_list and self._dtype is None:
722 try:

~Anaconda2envsimage_reclibsite-packagestensorflowpythonkerasenginebase_layer.py in _assert_input_compatibility(self, inputs)
1408 spec.min_ndim is not None or
1409 spec.max_ndim is not None):
-> 1410 if x.shape.ndims is None:
1411 raise ValueError('Input ' + str(input_index) + ' of layer ' +
1412 self.name + ' is incompatible with the layer: '

AttributeError: 'tuple' object has no attribute 'ndims'


thanks in advance







python tensorflow tensorflow-datasets






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 10:51







Adi Goldner

















asked Nov 25 '18 at 9:57









Adi GoldnerAdi Goldner

63




63













  • Please include the error in the body of your question, it is OK to copy and paste the error in as text, just format it as a code block and it will render OK.

    – SuperShoot
    Nov 25 '18 at 10:19











  • What is gen? That's where the error happens.

    – Matthieu Brucher
    Nov 25 '18 at 10:27



















  • Please include the error in the body of your question, it is OK to copy and paste the error in as text, just format it as a code block and it will render OK.

    – SuperShoot
    Nov 25 '18 at 10:19











  • What is gen? That's where the error happens.

    – Matthieu Brucher
    Nov 25 '18 at 10:27

















Please include the error in the body of your question, it is OK to copy and paste the error in as text, just format it as a code block and it will render OK.

– SuperShoot
Nov 25 '18 at 10:19





Please include the error in the body of your question, it is OK to copy and paste the error in as text, just format it as a code block and it will render OK.

– SuperShoot
Nov 25 '18 at 10:19













What is gen? That's where the error happens.

– Matthieu Brucher
Nov 25 '18 at 10:27





What is gen? That's where the error happens.

– Matthieu Brucher
Nov 25 '18 at 10:27












1 Answer
1






active

oldest

votes


















0














so apparently casting the out put to a tf.float32 solves the problem



next_color, next_gray = get_next()

sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
foo = sess.run(next_gray)
gray_batch = tf.cast(foo, dtype = tf.float32)

gen_image = gen(gray_batch, True)





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466396%2ftensorflow-dataset-api-input-for-training-tuple-object-has-no-ndims-attribute%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    so apparently casting the out put to a tf.float32 solves the problem



    next_color, next_gray = get_next()

    sess = tf.Session()
    sess.run(tf.global_variables_initializer())
    sess.run(tf.local_variables_initializer())
    foo = sess.run(next_gray)
    gray_batch = tf.cast(foo, dtype = tf.float32)

    gen_image = gen(gray_batch, True)





    share|improve this answer




























      0














      so apparently casting the out put to a tf.float32 solves the problem



      next_color, next_gray = get_next()

      sess = tf.Session()
      sess.run(tf.global_variables_initializer())
      sess.run(tf.local_variables_initializer())
      foo = sess.run(next_gray)
      gray_batch = tf.cast(foo, dtype = tf.float32)

      gen_image = gen(gray_batch, True)





      share|improve this answer


























        0












        0








        0







        so apparently casting the out put to a tf.float32 solves the problem



        next_color, next_gray = get_next()

        sess = tf.Session()
        sess.run(tf.global_variables_initializer())
        sess.run(tf.local_variables_initializer())
        foo = sess.run(next_gray)
        gray_batch = tf.cast(foo, dtype = tf.float32)

        gen_image = gen(gray_batch, True)





        share|improve this answer













        so apparently casting the out put to a tf.float32 solves the problem



        next_color, next_gray = get_next()

        sess = tf.Session()
        sess.run(tf.global_variables_initializer())
        sess.run(tf.local_variables_initializer())
        foo = sess.run(next_gray)
        gray_batch = tf.cast(foo, dtype = tf.float32)

        gen_image = gen(gray_batch, True)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 28 '18 at 15:25









        Adi GoldnerAdi Goldner

        63




        63
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466396%2ftensorflow-dataset-api-input-for-training-tuple-object-has-no-ndims-attribute%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            To store a contact into the json file from server.js file using a class in NodeJS

            Marschland