class_docstr: This code was developed by jbpatel@mit.edu.
      
class_docstr_tok: ["This","code","was","developed","by","jbpatel","@","mit.edu","."]
code: def smoothness(self, y_pred_max_mat):
      from keras import backend as K
      from keras.layers import Lambda, Conv3D
  
      # smoothness constraint
      y_p1 = Lambda((lambda arg: K.cast(arg, K.floatx())))(
          y_pred_max_mat
      )
  
      lap = Conv3D(
          filters=1,
          kernel_size=(3, 3, 3),
          padding="same",
          activation="relu",
          kernel_initializer=self.init_f,
          trainable=False,
      )(y_p1)
      lap = K.abs(lap)
      lap_f = K.batch_flatten(lap[..., 0])
  
      # sum up the curvatures
      beta = K.sum(lap_f, axis=-1)
      return beta
  
imports: import numpy
  import itertools
label_desc: Use image node_id 13 for calling the WeightedCategoricalCrossEntropy obj's underlying member method code with example usage: obj.smoothness(y_pred_max_mat) and returns: beta