Imported from https://github.com/google-research/neural-structural-optimization