Skip to content

Models exported as graphdef protos for Tensorflow cannot be trained. #447

@abhigyan7

Description

@abhigyan7

When graphdefs are imported using tf.import_graph_def(), variable collections within tensorflow such as GLOBAL_VARIABLES and TRAINABLE_VARIABLES are not updated. Since tensorflow optimizers look for variables to optimize in the above collections by default, calling tf.train.Optimizer.minimize() fails with an error saying that there are no variables to be optimized.

This strangely seems to be an issue only with graphdefs extracted from the keras backend session and not a problem with Fabrik.

A better way would be to export metagraphdefs, which contain the graphdef along with information about variable collections, which are restored when the metagraphdef is imported. Exporting models for tensorflow as .meta files can be done with very little change in the export logic as it is now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions