code: def composed_sampler(logits, num_samples):
      # [batch size, num classes, num samples]
      unif = random_ops.random_uniform(
          logits.get_shape().concatenate(
              tensor_shape.TensorShape([num_samples])
          )
      )
      noise = -math_ops.log(-math_ops.log(unif))
      # [batch size, num classes, 1]
      logits = array_ops.expand_dims(logits, -1)
  
      # [batch size, num samples]
      return math_ops.argmax(logits + noise, axis=1)
  
imports: import collections
  import timeit
  import numpy
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling a global function with example usage: composed_sampler(logits, num_samples) and returns: math_ops