How Do I Resolve Core Dump Caused by Enabled memory_optimization?

Symptom

Core dump occurs due to the following configuration during porting:

1
config.graph_options.rewrite_options.memory_optimization = RewriterConfig.OFF

F tensorflow/core/grappler/optimizers/memory_optimizer.cc xxx (core dump)

Possible Cause

In the multi-device scenario, it is advised to use the internal optimization logic of the NPU as opposed to memory_optimization, as memory_optimization may incur errors when executed on the NPU.

However, the native TensorFlow code must ensure that the network runs properly regardless of the optimizer enabled or disabled. Thus, it is a native bug of TensorFlow that disabling the optimizer causes core dump.

Solution

You are advised to comment out the following line:

1
config.graph_options.rewrite_options.memory_optimization = RewriterConfig.OFF # Comment out this line.