[DataPipe] Slight refactoring IterDataPipe serialization test (#73922)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/73922
Test Plan: Imported from OSS
Reviewed By: ejguan
Differential Revision: D34732288
Pulled By: NivekT
fbshipit-source-id: f31229332fe4eac85cc2085484f6e1b1d802987d
(cherry picked from commit ace20054e4f3f9bd9610640755400fbde82650c3)