diff --git a/docs/index.rst b/docs/index.rst index cafe58037c0a0..30b1a47f0e31e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -62,7 +62,7 @@ The Taichi Programming Language :caption: Miscellaneous :maxdepth: 3 - external_libraries + extension_libraries gui export_results cli_utilities diff --git a/python/taichi/misc/gui.py b/python/taichi/misc/gui.py index b9574c3b46a98..a9bd9906ac3ca 100644 --- a/python/taichi/misc/gui.py +++ b/python/taichi/misc/gui.py @@ -80,10 +80,11 @@ def set_image(self, img): import taichi as ti if isinstance(img, ti.Expr): - if ti.core.is_integral(img.data_type()): - # image of uint is not optimized by xxx_to_image + if ti.core.is_integral(img.data_type()) or len(img.shape()) != 2: + # Images of uint is not optimized by xxx_to_image self.img = self.cook_image(img.to_numpy()) else: + # Type matched! We can use an optimized copy kernel. assert img.shape( ) == self.res, "Image resolution does not match GUI resolution" from taichi.lang.meta import tensor_to_image @@ -94,6 +95,7 @@ def set_image(self, img): if ti.core.is_integral(img.data_type()): self.img = self.cook_image(img.to_numpy()) else: + # Type matched! We can use an optimized copy kernel. assert img.shape( ) == self.res, "Image resolution does not match GUI resolution" assert img.n in [