Extension function to create a network within a NetworkContext. This bridges the context wrapper with the network DSL using the context's tensor factory.