public static Map < String , Object > getTimeDistributedLayerConfig ( Map < String , Object > layerConfig , KerasLayerConfiguration conf ) throws InvalidKerasConfigurationException { if ( ! layerConfig . containsKey ( conf . getLAYER_FIELD_CLASS_NAME ( ) ) ) throw new InvalidKerasConfigurationException ( "Field " + conf . getLAYER_FIELD_CLASS_NAME ( ) + " missing from layer config" ) ; if ( ! layerConfig . get ( conf . getLAYER_FIELD_CLASS_NAME ( ) ) . equals ( conf . getLAYER_CLASS_NAME_TIME_DISTRIBUTED ( ) ) ) throw new InvalidKerasConfigurationException ( "Expected " + conf . getLAYER_CLASS_NAME_TIME_DISTRIBUTED ( ) + " layer, found " + layerConfig . get ( conf . getLAYER_FIELD_CLASS_NAME ( ) ) ) ; if ( ! layerConfig . containsKey ( conf . getLAYER_FIELD_CONFIG ( ) ) ) throw new InvalidKerasConfigurationException ( "Field " + conf . getLAYER_FIELD_CONFIG ( ) + " missing from layer config" ) ; Map < String , Object > outerConfig = getInnerLayerConfigFromConfig ( layerConfig , conf ) ; Map < String , Object > innerLayer = ( Map < String , Object > ) outerConfig . get ( conf . getLAYER_FIELD_LAYER ( ) ) ; layerConfig . put ( conf . getLAYER_FIELD_CLASS_NAME ( ) , innerLayer . get ( conf . getLAYER_FIELD_CLASS_NAME ( ) ) ) ; Map < String , Object > innerConfig = getInnerLayerConfigFromConfig ( innerLayer , conf ) ; innerConfig . put ( conf . getLAYER_FIELD_NAME ( ) , outerConfig . get ( conf . getLAYER_FIELD_NAME ( ) ) ) ; outerConfig . putAll ( innerConfig ) ; outerConfig . remove ( conf . getLAYER_FIELD_LAYER ( ) ) ; return layerConfig ; }
Extract inner layer config from TimeDistributed configuration and merge it into the outer config .