docs: def dynamic_shape(self, max_elements):
          """Determine the dynamic shape, given incoming data that is big enough
          to hold `max_elements` elements.
          """
          known = 1
          unknown_pos = -1
          for i, x in enumerate(self.shape):
              if x is not None:
                  known *= x
              else:
                  assert unknown_pos == -1, 'Shape has multiple unknown dimensions'
                  unknown_pos = i
          if unknown_pos == -1:
              return self.shape
          else:
              shape = list(self.shape)
              if known == 0:
                  shape[unknown_pos] = 0
              else:
                  shape[unknown_pos] = max_elements // known
              return shape