code: def testStepWithInferenceHelperMultilabel(self):
      batch_size = 5
      vocabulary_size = 7
      cell_depth = vocabulary_size
      start_token = 0
      end_token = 6
  
      start_inputs = tf.one_hot(
          np.ones(batch_size) * start_token, vocabulary_size
      )
  
      # The sample function samples independent bernoullis from the logits.
      sample_fn = lambda x: seq2seq.bernoulli_sample(
          logits=x, dtype=tf.bool
      )
      # The next inputs are a one-hot encoding of the sampled labels.
      next_inputs_fn = tf.to_float
      end_fn = lambda sample_ids: sample_ids[:, end_token]
  
      with self.session(use_gpu=True) as sess:
          with tf.variable_scope(
              "testStepWithInferenceHelper",
              initializer=tf.constant_initializer(0.01),
          ):
              cell = tf.nn.rnn_cell.LSTMCell(vocabulary_size)
              helper = seq2seq.InferenceHelper(
                  sample_fn,
                  sample_shape=[cell_depth],
                  sample_dtype=tf.bool,
                  start_inputs=start_inputs,
                  end_fn=end_fn,
                  next_inputs_fn=next_inputs_fn,
              )
              my_decoder = seq2seq.BasicDecoder(
                  cell=cell,
                  helper=helper,
                  initial_state=cell.zero_state(
                      dtype=tf.float32, batch_size=batch_size
                  ),
              )
              output_size = my_decoder.output_size
              output_dtype = my_decoder.output_dtype
              self.assertEqual(
                  seq2seq.BasicDecoderOutput(cell_depth, cell_depth),
                  output_size,
              )
              self.assertEqual(
                  seq2seq.BasicDecoderOutput(tf.float32, tf.bool),
                  output_dtype,
              )
  
              (
                  first_finished,
                  first_inputs,
                  first_state,
              ) = my_decoder.initialize()
              (
                  step_outputs,
                  step_state,
                  step_next_inputs,
                  step_finished,
              ) = my_decoder.step(
                  tf.constant(0), first_inputs, first_state
              )
              batch_size_t = my_decoder.batch_size
  
              self.assertIsInstance(
                  first_state, tf.nn.rnn_cell.LSTMStateTuple
              )
              self.assertIsInstance(
                  step_state, tf.nn.rnn_cell.LSTMStateTuple
              )
              self.assertIsInstance(
                  step_outputs, seq2seq.BasicDecoderOutput
              )
              self.assertEqual(
                  (batch_size, cell_depth), step_outputs[0].get_shape()
              )
              self.assertEqual(
                  (batch_size, cell_depth), step_outputs[1].get_shape()
              )
              self.assertEqual(
                  (batch_size, cell_depth), first_state[0].get_shape()
              )
              self.assertEqual(
                  (batch_size, cell_depth), first_state[1].get_shape()
              )
              self.assertEqual(
                  (batch_size, cell_depth), step_state[0].get_shape()
              )
              self.assertEqual(
                  (batch_size, cell_depth), step_state[1].get_shape()
              )
  
              sess.run(tf.global_variables_initializer())
              sess_results = sess.run(
                  {
                      "batch_size": batch_size_t,
                      "first_finished": first_finished,
                      "first_inputs": first_inputs,
                      "first_state": first_state,
                      "step_outputs": step_outputs,
                      "step_state": step_state,
                      "step_next_inputs": step_next_inputs,
                      "step_finished": step_finished,
                  }
              )
  
              sample_ids = sess_results["step_outputs"].sample_id
              self.assertEqual(output_dtype.sample_id, sample_ids.dtype)
              expected_step_finished = sample_ids[:, end_token]
              expected_step_next_inputs = sample_ids.astype(np.float32)
              self.assertAllEqual(
                  expected_step_finished, sess_results["step_finished"]
              )
              self.assertAllEqual(
                  expected_step_next_inputs,
                  sess_results["step_next_inputs"],
              )
  
imports: from magenta.contrib import seq2seq
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 11 for calling the BasicDecoderTest obj's underlying member method code with example usage: obj.testStepWithInferenceHelperMultilabel() without return types