First you should check if the machine is affected by https://support.apple.com/13-inch-macbook-pro-solid-state-drive-service
About compatibility between 2016/2017: https://beetstech.com/blog/apple-proprietary-ssd-ultimate-guide-to-specs-and-upgrades
After extensive testing with every Gen. 5A drive we could get our hands on, it appears that 128GB SSDs with part numbers beginning with 656-0074 and 256GB SSDs with part numbers beginning with 656-0076 are only compatible with the model A1708 laptops from the Mid 2017 release.
Note that the SSD_BOOT_L/SSD_PWR_EN_L circuit is different between 820-00875 (2016) and 820-00840 (2017). Only the schematics for 820-00875 is available, in this one U8640/R8645 are populated while R8641/R8642 are not. On the 820-00840 it's the opposite.