code: def loss_fn(params, inputs, targets):
      predicted = params[0] * inputs + params[1]
      loss = tf.reduce_mean(input_tensor=tf.square(predicted - targets))
      return tf_np.asarray(loss)
  
imports: import functools
  import itertools
  from absl import flags
  from absl.testing import parameterized
  from jax import lax
  import numpy
  import tensorflow.compat.v2
  from trax.tf_numpy import extensions
  import trax.tf_numpy.numpy
label_desc: Use image node_id 2 for calling a global function with example usage: loss_fn(params, inputs, targets) and returns: tf_np