How to shard computing graphs by layer

I want to collect a common set of smaller computing graphs, which may be a block, an encoder or others.
I would like to obtain this collection by slicing an existing larger machine learning model computing graphs, possibly by layer. Are there related algorithms or library functions that can support such segmentation?

I want to collect a common set of smaller computing graphs, which may be a block, an encoder or others.
I would like to obtain this collection by sharding an existing larger machine learning model computing graphs, possibly by layer. Are there related algorithms or library functions that can support such segmentation?