code: def DistanceMatrix(D):
      """Calcuates the distance matrix from the distance tensor
  
      B = batch_size, N = max_num_atoms, M = max_num_neighbors, d = num_features
  
      Parameters
      ----------
      D: tf.Tensor of shape (B, N, M, d)
        Distance tensor.
  
      Returns
      -------
      R: tf.Tensor of shape (B, N, M)
         Distance matrix.
  
      """
  
      R = tf.reduce_sum(tf.multiply(D, D), 3)
      R = tf.sqrt(R)
      return R
  
file_path: deepchem/contrib/atomicconv/models/atomicnet_ops.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import unicode_literals
  import numpy
  import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: DistanceMatrix(D) and returns: R