NotImplementedError occurs when plt.imshow (img) is executed on Jetson NX

I am currently running the following SRGAN code on Jetson NX.


However, plt.imshow(img) has a NotImplementedError error, and I am in trouble.
I thought it might be a problem with tensorflow==2.1.0+nv20.4 and asked here.

Here are the steps I took:

  1. Download the code as a zip from https://github.com/krasserm/super-resolution.
  2. unzip the zip
  3. Download weights-srgan.tar.gz from the link https://github.com/krasserm/super-resolution.
  4. Unzip weights-srgan.tar.gz and place it in the unzipped folder 2.
  5. Start jupyternotebook and execute SRGAN cells (1st and 2nd code cells) and Demo cells (8th to 10th code cells) in example-srgan.ipynb.
  6. I got the following error in resolve_and_plot (‘demo / 0869x4-crop.png’)

NotImplementedError Traceback (most recent call last)
in
----> 1 resolve_and_plot(‘demo/0869x4-crop.png’)

in resolve_and_plot(lr_image_path)
19 for i, (img, title, pos) in enumerate(zip(images, titles, positions)):
20 plt.subplot(2, 2, pos)
—> 21 plt.imshow(img)
22 plt.title(title)
23 plt.xticks()

~/.local/lib/python3.6/site-packages/matplotlib/pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, data, **kwargs)
2697 filternorm=filternorm, filterrad=filterrad, imlim=imlim,
2698 resample=resample, url=url, **({“data”: data} if data is not
-> 2699 None else {}), **kwargs)
2700 sci(__ret)
2701 return __ret

~/.local/lib/python3.6/site-packages/matplotlib/init.py in inner(ax, data, *args, **kwargs)
1808 “the Matplotlib list!)” % (label_namer, func.name),
1809 RuntimeWarning, stacklevel=2)
-> 1810 return func(ax, *args, **kwargs)
1811
1812 inner.doc = _add_data_doc(inner.doc,

~/.local/lib/python3.6/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
5492 resample=resample, **kwargs)
5493
-> 5494 im.set_data(X)
5495 im.set_alpha(alpha)
5496 if im.get_clip_path() is None:

~/.local/lib/python3.6/site-packages/matplotlib/image.py in set_data(self, A)
628 A : array-like
629 “”"
–> 630 self._A = cbook.safe_masked_invalid(A, copy=True)
631
632 if (self._A.dtype != np.uint8 and

~/.local/lib/python3.6/site-packages/matplotlib/cbook/init.py in safe_masked_invalid(x, copy)
782
783 def safe_masked_invalid(x, copy=False):
–> 784 x = np.array(x, subok=True, copy=copy)
785 if not x.dtype.isnative:
786 # Note that the argument to byteswap is ‘inplace’,

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in array(self)
726 def array(self):
727 raise NotImplementedError(“Cannot convert a symbolic Tensor ({}) to a numpy”
–> 728 " array.".format(self.name))
729
730 def len(self):

NotImplementedError: Cannot convert a symbolic Tensor (strided_slice_5:0) to a numpy array.

There is an error in the resolve_and_plot function plt.imshow(img).
Apparently, the super-resolved return type (img) Tensor is not supported.
By the way, when I did the same on a Windows PC, it succeeded without errors.

By the way, looking at the types of super-resolution return values (img), the differences between NX and PC are as follows.
NX: <class’tensorflow.python.framework.ops.Tensor’>
PC: <class’tensorflow.python.framework.ops.EagerTensor’>
I think this difference is the cause of the error.

The main environment of Windows PC and NX is as follows.

[WindowsPC environment]
Windows10
Python==3.7.3
matplotlib==3.0.3
tensorflow==2.1.0
keras==2.4.1
jupyter==1.0.0
numpy==1.16.4
pillow==6.0.0

[JetsonNX environment]
Ubuntu18.04
Jetpack v4.4
Python==3.6.9
matplotlib==3.0.3
tensorflow==2.1.0+nv20.4
keras==2.4.1
jupyter==1.0.0
numpy==1.16.4
pillow==6.0.0

Tensorflow of NX installed the one corresponding to v44 referring to the following.
https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html

Is there a solution for this error?
Or is it a tensorflow==2.1.0+nv20.4 bug?