Setting context of a loaded parameter

Let’s say that I have created a gloun block called Model, and I instantiate it by calling

net = Model()

I can load saved parameters to initialize this model by calling

net.load_parameters('myParameter.params', ctx=mx.gpu(0))

This is fine if I want to load all parameters to mx.gpu(0), but if I have a large model, I may want to stick some parameters on one context and some on another. Is there a good way to load subsets of parameters to specific contexts? Alternatively, is there a good way to change the context of a parameter that has already been loaded?

Never mind, I just realized that Parameter.reset_ctx is a thing.

1 Like