Open KBS91 opened 6 years ago
Once a model has all input shapes determined, the InferredDimension in parameters are fixed too. So you cannot change just the input. Instead, you need to find out the part of graph that shares the same dimension before and after the input shape change, and replace anything before that. Below is an illustration of the concept:
import cntk as C
ii = C.input_variable(20)
dense_ii = C.layers.Dense(10)(ii)
z = dense_ii + C.parameter(10)
ii2 = C.input_variable(30)
dense_ii2 = C.layers.Dense(10)(ii2)
z_c = z.clone(C.CloneMethod.share, {dense_ii:dense_ii2})
z_c
Composite(Plus): Input('Input189', [#], [30]) -> Output('Plus230_Output_0', [#], [10])
I am working now on project in CNTK 2.2 in Python. I made code:
to replace input Feature dimensions in CNTK model that I load from file. Later I apply input map, so I scale features layer to dimension like I want. That Model is Resnet18
Problem is that I do not want to use .clone() funtion. It causes to run out my GPU memory.
Does enybody knows how to replace 'feature' layer without clone funtion?
Best regards, Chris