code: def set_dlatents(self, dlatents):
      if self.tiled_dlatent:
          if (dlatents.shape != (self.batch_size, 512)) and (
              dlatents.shape[1] != 512
          ):
              dlatents = np.mean(dlatents, axis=1)
          if dlatents.shape != (self.batch_size, 512):
              dlatents = np.vstack(
                  [
                      dlatents,
                      np.zeros(
                          (self.batch_size - dlatents.shape[0], 512)
                      ),
                  ]
              )
          assert dlatents.shape == (self.batch_size, 512)
      else:
          if dlatents.shape[1] > self.model_scale:
              dlatents = dlatents[:, : self.model_scale, :]
          if isinstance(dlatents.shape[0], int):
              if dlatents.shape != (
                  self.batch_size,
                  self.model_scale,
                  512,
              ):
                  dlatents = np.vstack(
                      [
                          dlatents,
                          np.zeros(
                              (
                                  self.batch_size - dlatents.shape[0],
                                  self.model_scale,
                                  512,
                              )
                          ),
                      ]
                  )
              assert dlatents.shape == (
                  self.batch_size,
                  self.model_scale,
                  512,
              )
              self.sess.run(
                  [self._assign_dlantent],
                  {self._assign_dlatent_ph: dlatents},
              )
              return
          else:
              self._assign_dlantent = tf.assign(
                  self.dlatent_variable, dlatents
              )
              return
      self.sess.run(
          [self._assign_dlantent], {self._assign_dlatent_ph: dlatents}
      )
  
file_path: insightface/reconstruction/ostec/core/generator_model.py
imports: import math
  import tensorflow
  import numpy
  import external.stylegan2.dnnlib.tflib
  from functools import partial
label_desc: Use image node_id 3 for calling the Generator obj's underlying member method code with example usage: obj.set_dlatents(dlatents) without return types