code: def _put_valuer(sample_paths, time_index, strikes, dtype=None):
      """Produces a callable from samples to payoff of a simple basket put option.
  
      Args:
        sample_paths: A `Tensor` of either `float32` or `float64` dtype and of
          either shape `[num_samples, num_times, dim]` or
          `[batch_size, num_samples, num_times, dim]`.
        time_index: An integer scalar `Tensor` that corresponds to the time
          coordinate at which the basis function is computed.
        strikes: A `Tensor` of the same `dtype` as `sample_paths` and shape
          compatible with `[num_samples, batch_size]`.
        dtype: Optional `dtype`. Either `tf.float32` or `tf.float64`. The `dtype`
          If supplied, represents the `dtype` for the 'strikes' as well as
          for the input argument of the output payoff callable.
          Default value: `None`, which means that the `dtype` inferred by TensorFlow
          is used.
      Returns:
        A callable from `Tensor` of shape `sample_paths.shape`
        and a scalar `Tensor` representing current time to a `Tensor` of shape
        `[num_samples, batch_size]`.
      """
      strikes = tf.convert_to_tensor(
          strikes, dtype=dtype, name="strikes"
      )
      sample_paths = tf.convert_to_tensor(
          sample_paths, dtype=dtype, name="sample_paths"
      )
      if sample_paths.shape.rank == 3:
          # Expand shape to [num_samples, 1, num_times, dim]
          sample_paths = tf.expand_dims(sample_paths, axis=1)
      else:
          # Transpose to [num_samples, batch_size, num_times, dim]
          sample_paths = tf.transpose(sample_paths, [1, 0, 2, 3])
      num_samples, batch_size, _, dim = sample_paths.shape.as_list()
  
      slice_sample_paths = tf.slice(
          sample_paths,
          [0, 0, time_index, 0],
          [num_samples, batch_size, 1, dim],
      )
      slice_sample_paths = tf.squeeze(slice_sample_paths, 2)
      average = tf.math.reduce_mean(slice_sample_paths, axis=-1)
      return tf.nn.relu(strikes - average)
  
imports: import functools
  from typing import Callable
  import tensorflow.compat.v2
  from tf_quant_finance import types
label_desc: Use image node_id 2 for calling a global function with example usage: _put_valuer(sample_paths, time_index, strikes, dtype) and returns: tf