code: def imdecode(self, s):
          
          def locate():
              """Locate the image file/index if decode fails."""
              if self.seq is not None:
                  idx = self.seq[(self.cur % self.num_image) - 1]
              else:
                  idx = (self.cur % self.num_image) - 1
              if self.imglist is not None:
                  _, fname = self.imglist[idx]
                  msg = "filename: {}".format(fname)
              else:
                  msg = "index: {}".format(idx)
              return "Broken image " + msg
          try:
              img = imdecode(s)
          except Exception as e:
              raise RuntimeError("{}, {}".format(locate(), e))
          return img
docs: Decodes a string or byte string to an NDArray.
          See mx.img.imdecode for more details.