The two-way shape-memory effect is the effect that the material remembers two different shapes: one at low temperatures, and one at the high temperature.
A material that shows a shape-memory effect during both heating and cooling is said to have two-way shape memory. This can also be obtained without the application of an external force (intrinsic two-way effect).
The reason the material behaves so differently in these situations lies in training. Training implies that a shape memory can "learn" to behave in a certain way.
Under normal circumstances, a shape-memory alloy "remembers" its low-temperature shape, but upon heating to recover the high-temperature shape, immediately "forgets" the low-temperature shape. However, it can be "trained" to "remember" to leave some reminders of the deformed low-temperature condition in the high-temperature phases. One way of training the SMA consists in applying a cyclic thermal load under constant stress field. During this process, internal defects are introduced into the microstructure which generates internal permanent stresses that facilitate the orientation of the martensitic crystals. Therefore, while cooling a trained SMA in austenitic phase under no applied stress, the martensite is formed detwinned due to the internal stresses, which leads to the material shape change. And while heating back the SMA into austenite, it recovers its initial shape.
There are several ways of doing this. A shaped, trained object heated beyond a certain point will lose the two-way memory effect.