code: public static LayerConstraint getConstraintsFromConfig(Map<String, Object> layerConfig, String constraintField,
                                                             KerasLayerConfiguration conf, int kerasMajorVersion)
              throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
          Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
          if (!innerConfig.containsKey(constraintField)) {
              // log.warn("Keras layer is missing " + constraintField + " field");
              return null;
          }
          HashMap constraintMap = (HashMap) innerConfig.get(constraintField);
          if (constraintMap == null)
              return null;
  
          String kerasConstraint;
          if (constraintMap.containsKey(conf.getLAYER_FIELD_CONSTRAINT_NAME())) {
              kerasConstraint = (String) constraintMap.get(conf.getLAYER_FIELD_CONSTRAINT_NAME());
          } else {
              throw new InvalidKerasConfigurationException("Keras layer is missing " +
                      conf.getLAYER_FIELD_CONSTRAINT_NAME() + " field");
          }
  
          Map<String, Object> constraintConfig;
          if (kerasMajorVersion == 2) {
              constraintConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(constraintMap, conf);
          } else {
              constraintConfig = constraintMap;
          }
          LayerConstraint layerConstraint = mapConstraint(kerasConstraint, conf, constraintConfig);
  
          return layerConstraint;
      }
docs: Get constraint initialization from Keras layer configuration.
  
  @param layerConfig       dictionary containing Keras layer configuration
  @param constraintField   string in configuration representing parameter to constrain
  @param conf              Keras layer configuration
  @param kerasMajorVersion Major keras version as integer (1 or 2)
  @return a valid LayerConstraint
  @throws InvalidKerasConfigurationException     Invalid configuration
  @throws UnsupportedKerasConfigurationException Unsupported configuration