code: def weights_multi_problem(labels, taskid=-1):
    
    taskid = check_nonnegative(taskid)
    past_taskid = tf.cumsum(to_float(tf.equal(labels, taskid)), axis=1)
    # Additionally zero out the task id location
    past_taskid *= to_float(tf.not_equal(labels, taskid))
    non_taskid = to_float(labels)
    return to_float(tf.not_equal(past_taskid * non_taskid, 0))
docs: Assign weight 1.0 to only the "targets" portion of the labels.
  
    Weight 1.0 is assigned to all labels past the taskid.
  
    Args:
      labels: A Tensor of int32s.
      taskid: an int32 representing the task id for a problem.
  
    Returns:
      A Tensor of floats.
  
    Raises:
      ValueError: The Task ID must be valid.