code: def _sample(a, temperature=1.0):
      # helper function to sample an index from a probability array
      a = np.log(a) / temperature
      a = np.exp(a) / np.sum(np.exp(a))
      return np.argmax(np.random.multinomial(1, a, 1))
  
file_path: tflearn/tflearn/models/generator.py
imports: from __future__ import division, print_function, absolute_import
  import sys
  import numpy
  import tensorflow.compat.v1
  from ..helpers.trainer import Trainer, evaluate
  from ..helpers.evaluator import Evaluator
  from ..utils import feed_dict_builder, is_none
label_desc: Use image node_id 2 for calling a global function with example usage: _sample(a, temperature) and returns: np