Python TypeError:/:';非类型';和';int';,用于提取\u图像\u面片

Python TypeError:/:';非类型';和';int';,用于提取\u图像\u面片,python,tensorflow,Python,Tensorflow,我正在为具有动态维度的图像数据集使用extract_image_补丁 我收到以下错误日志: array_grad.py", line 604, in _ExtractImagePatchesGrad rows_out = int(ceil(rows_in / stride_r)) TypeError: unsupported operand type(s) for /: 'NoneType' and 'int' 我试着用 1) 图像。设置形状方法 2) image使用\u crop\

我正在为具有动态维度的图像数据集使用extract_image_补丁

我收到以下错误日志:

 array_grad.py", line 604, in _ExtractImagePatchesGrad     rows_out = int(ceil(rows_in / stride_r))
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
我试着用

1) 图像。设置形状方法

2) image使用\u crop\u或\u pad调整大小以避免此错误,但错误仍然存在

更新1:以下是代码片段

#######
#shape=[batch_size,height,width, target_size2

out_processed_model2 =tf.reshape(out_processed2, shape = [tf.shape(image_patch_tf2)[0], tf.shape(image_patch_tf2)[1], tf.shape(image_patch_tf2)[2], target_size2]) 

#PostProcessing

as0, as1, as2, as3, as4, as5= tf.split(out_processed_model2, target_size, 0)
out_model2_batch_to_depth = tf.concat([as0, as1, as2, as3, as4, as5],3)
#Model-3 Preprocessing

s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15,s16, s17, s18, s19= tf.split(out_model2_batch_to_depth , target_size2, 3)
A_3= tf.concat([s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15,s16, s17, s18, s19],1)
out_model2_depth_to_batch=tf.reshape(A_3, [tf.shape(image_patch_tf2)[0]*target_size2, tf.shape(image_patch_tf2)[1], tf.shape(image_patch_tf2)[2], 1])
############################Model -3#######################
stride_h3= 2
stride_w3 = 4
cell3 = 50
target_size3 = 80
input_size3 =stride_h3*stride_w3
image_patch_tf3 = tf.extract_image_patches(images = out_model2_depth_to_batch, ksizes = [1, stride_h3, stride_w3, 1], strides = [1, stride_h3, stride_w3, 1], rates = [1,1,1,1], padding="SAME", name="Extract_Image_Patches3")

根据错误,您正试图对中的
行使用
NoneType
。这可能意味着您设置的变量不正确


错误消息准确地告诉您发生了什么
不支持的/
操作数类型告诉您,无论是什么原因导致的错误都发生在您的除法中。它随后提供的两种类型,
NoneType
int
告诉您与该操作一起使用的两个变量的类型。由于无法将none除以int,因此会发生错误。

中的行\u似乎是none,而不是您认为的值。检查它。我尝试访问image\u数据维度。我可以看到它的形状为[114441]。在这种情况下,行大小为144。但它抛出了同样的错误。问题不在于图像数据。请在第604行“打印(中的行)”之前尝试这一行。输出将不是您所想的。除非你真的发布你的代码,否则我们无法帮助你了解更多细节。你认为这是一个bug还是别的??我尝试了不同的方法,但得到了相同的错误:(你曾经解决过这个问题吗?我得到了相同的错误!