I am trying to use group norm as part of my CNN. But I get the following error which I believe is tied to the fact that the first dimension of the placeholder for my input images, being the batch size, is set to None. The group norm implementation involves a reshape operation that doesn't play well with this. Could you kindly suggest a workaround for this?
TypeError: Failed to convert object of type to Tensor. Contents: [None, 16, 64, 64, 12, 2]. Consider casting elements to a supported type.
Thank you for your time and effort.
I believe this is a known issue on Tensorflow and you can read up more about it here: https://github.com/tensorflow/tensorflow/issues/24409
In short, this error is due to normalization.py#L303 and can be fixed with the addition of the following two lines after Line 252 in normalization.py:
original_shape = [-1 if s.value is None else s for s in original_shape]
if len([s for s in original_shape if s == -1]) > 1:
raise ValueError('Only one axis dimension can be undefined in the input tensor')
and the following line after Line 302:
inputs_shape = [-1 if s is None else s for s in inputs_shape]
Source: This issue on the tensorflow github page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.