class_docstr: Core layer of IRV classifier, architecture described in:
  https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2750043/
class_docstr_tok: ["Core","layer","of","IRV","classifier",",","architecture","described","in",":","https",":","\/\/www.ncbi.nlm.nih.gov\/pmc\/articles\/PMC2750043\/"]
code: def call(self, inputs):
      K = self.K
      outputs = []
      for count in range(self.n_tasks):
          # Similarity values
          similarity = inputs[:, 2 * K * count : (2 * K * count + K)]
          # Labels for all top K similar samples
          ys = tf.cast(
              inputs[:, (2 * K * count + K) : 2 * K * (count + 1)],
              tf.int32,
          )
  
          R = (
              self.b
              + self.W[0] * similarity
              + self.W[1]
              * tf.constant(np.arange(K) + 1, dtype=tf.float32)
          )
          R = tf.sigmoid(R)
          z = tf.reduce_sum(R * tf.gather(self.V, ys), axis=1) + self.b2
          outputs.append(tf.reshape(z, shape=[-1, 1]))
      loss = (
          tf.nn.l2_loss(self.W)
          + tf.nn.l2_loss(self.V)
          + tf.nn.l2_loss(self.b)
          + tf.nn.l2_loss(self.b2)
      ) * self.penalty
      self.add_loss(loss)
      return tf.concat(outputs, axis=1)
  
imports: import numpy
  import tensorflow
  from deepchem.models import KerasModel, layers
  from deepchem.models.losses import SigmoidCrossEntropy
  from tensorflow.keras.layers import Input, Layer, Activation, Concatenate, Lambda
  import warnings
label_desc: Use image node_id 3 for calling the IRVLayer obj's underlying member method code with example usage: obj.call(inputs) and returns: tf