You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to have a look at the TensorFlow implementation of NFNet,
and somehow got to fix the reference-before-assignment issue with some help from @prateekkrjain.
However, when I try to instantiate NFNetF0 as follows: x = NFNetF0(num_classes = num_classes)(x)
the Python interpreter complains that it has an error as follows:
TypeError: in user code:
C:\Users\<myUserName>\NFNet\nfnets_keras\nfnet.py:143 call *
for i, block in enumerate(self.blocks): out, res_avg_var = block(out, training = training)
C:\Users\<myUserName>\NFNet\nfnets_keras\nfnet.py:200 call *
out = self.stoch_depth(out, training)
C:\Users\<myUserName>\NFNet\nfnets_keras\nfnet_layers.py:47 call *
r = tf.random.uniform(shape = [batch_size, 1, 1, 1], dtype = x.dtype)
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\util\dispatch.py:201 wrapper **
return target(*args, **kwargs)
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\ops\random_ops.py:289 random_uniform
shape = tensor_util.shape_tensor(shape)
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\framework\tensor_util.py:1035 shape_tensor
return ops.convert_to_tensor(shape, dtype=dtype, name="shape")
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\profiler\trace.py:163 wrapped
return func(*args, **kwargs)
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\framework\ops.py:1540 convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\framework\constant_op.py:339 _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\framework\constant_op.py:264 constant
return _constant_impl(value, dtype, shape, name, verify_shape=False,
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\framework\constant_op.py:281 _constant_impl
tensor_util.make_tensor_proto(
C:\Users\<myUserName>\miniconda3\lib\site-packages\tensorflow\python\framework\tensor_util.py:551 make_tensor_proto
raise TypeError("Failed to convert object of type %s to Tensor. "
TypeError: Failed to convert object of type <class 'tuple'> to Tensor. Contents: (None, 1, 1, 1). Consider casting elements to a supported type.
It seems like there is something wrong with the arguments being passed to tf.random.uniform() function when initializing StochasticDepth Layer. The batch_size turns out to be None.
Any ideas on how to fix this?
Note that I am using the latest version of Miniconda with Python 3.8, along with TensorFlow 2.4.1 on a Windows 10.
The text was updated successfully, but these errors were encountered:
joonjeon
changed the title
Issues with initializing StochasticDepth Layer
Issues with initializing StochasticDepth Layer
May 22, 2021
The alternative implementation seems to give me some hints on how the issue could be fixed,
although it also seems to have some issues as well, such as "no inbound nodes" issue when attempting to use the network as base net for object detection.
Hi!
I am trying to have a look at the TensorFlow implementation of NFNet,
and somehow got to fix the reference-before-assignment issue with some help from @prateekkrjain.
However, when I try to instantiate NFNetF0 as follows:
x = NFNetF0(num_classes = num_classes)(x)
the Python interpreter complains that it has an error as follows:
It seems like there is something wrong with the arguments being passed to
tf.random.uniform()
function when initializingStochasticDepth
Layer. Thebatch_size
turns out to beNone
.Any ideas on how to fix this?
Note that I am using the latest version of Miniconda with Python 3.8, along with TensorFlow 2.4.1 on a Windows 10.
The text was updated successfully, but these errors were encountered: