class_docstr: Seq2Seq model for sequence processing in O(n log n) time.
docstr: Loss function for Neural Shuffle-Exchange network.
  
  We use custom loss function as default loss function doesn't
  use padding for calculating loss. We assume that output string is same
  length as the input. If you need other type of output please feel
  free to modify this.
  
  Args:
    logits: Logits from model
    features: Features, not in one-hot format
  
  Returns:
     tf.Tensor: Loss value
docstr_tok: ["Loss","function","for","Neural","Shuffle-Exchange","network",".","We","use","custom","loss","function","as","default","loss","function","doesn't","use","padding","for","calculating","loss",".","We","assume","that","output","string","is","same","length","as","the","input",".","If","you","need","other","type","of","output","please","feel","free","to","modify","this",".","Args",":","logits",":","Logits","from","model","features",":","Features",",","not","in","one-hot","format","Returns",":","tf.Tensor",":","Loss","value"]
code: def loss(self, logits, features):
      """Loss function for Neural Shuffle-Exchange network.
  
      We use custom loss function as default loss function doesn't
      use padding for calculating loss. We assume that output string is same
      length as the input. If you need other type of output please feel
      free to modify this.
  
      Args:
        logits: Logits from model
        features: Features, not in one-hot format
  
      Returns:
         tf.Tensor: Loss value
      """
  
      onehot_labels = tf.one_hot(
          features["targets"],
          self._problem_hparams.vocab_size["targets"],
      )
      cost_vector = tf.nn.softmax_cross_entropy_with_logits_v2(
          logits=logits, labels=onehot_labels
      )
      return tf.reduce_mean(cost_vector)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 5 for calling the ShuffleNetwork obj's underlying member method code with example usage: obj.loss(logits, features) and returns: tf