code: def test_cosine_dist():
      """Test invoking cosine_dist."""
      x = tf.ones((5, 4), dtype=tf.dtypes.float32, name=None)
      y_same = tf.ones((5, 4), dtype=tf.dtypes.float32, name=None)
      # x and y are the same tensor (equivalent at every element)
      # the pairwise inner product of the rows in x and y will always be 1
      # the output tensor will be of shape (5,5)
      cos_sim_same = layers.cosine_dist(x, y_same)
      diff = cos_sim_same - tf.ones(
          (5, 5), dtype=tf.dtypes.float32, name=None
      )
      assert tf.abs(tf.reduce_sum(diff)) < 1e-5  # True
  
      identity_tensor = tf.eye(
          512, dtype=tf.dtypes.float32
      )  # identity matrix of shape (512,512)
      x1 = identity_tensor[0:256, :]
      x2 = identity_tensor[256:512, :]
      # each row in x1 is orthogonal to each row in x2
      # the pairwise inner product of the rows in x and y will always be 0
      # the output tensor will be of shape (256,256)
      cos_sim_orth = layers.cosine_dist(x1, x2)
      assert tf.abs(tf.reduce_sum(cos_sim_orth)) < 1e-5  # True
      assert all([cos_sim_orth.shape[dim] == 256 for dim in range(2)])
  
imports: import deepchem
  import numpy
  import pytest
  import os
label_desc: Use image node_id 1 for calling a global function with example usage: test_cosine_dist() without return types