使用TF进行计算,出现:
Traceback (most recent call last):
File "infer.py", line 14, in <module>
logits = classifier.get_output_for(image, None)
File "/opt/stylegan2/dnnlib/tflib/network.py", line 219, in get_output_for
expr = tf.zeros([tf.shape(valid_inputs[0])[0]] + shape[1:], name=name)
File "/opt/AN/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py", line 2338, in zeros
output = _constant_if_small(zero, shape, dtype, name)
File "/opt/AN/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py", line 2295, in _constant_if_small
if np.prod(shape) < 1000:
File "<__array_function__ internals>", line 6, in prod
File "/opt/AN/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 3031, in prod
keepdims=keepdims, initial=initial, where=where)
File "/opt/AN/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
File "/opt/AN/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 736, in __array__
" array.".format(self.name))
NotImplementedError: Cannot convert a symbolic Tensor (celebahq-classifier-20-goatee_1/strided_slice:0) to a numpy array.
解决方式,降低版本numpy版本
pip install numpy==1.19.5