X_width = get_width(X)
model.set_dim("nI", X_width)
for layer in model.layers:
if layer.has_dim("nI"):
layer.set_dim("nI", X_width)
for layer in model.layers:
layer.initialize(X=X, Y=Y)
After Change
if model.has_dim("nI") is not False:
model.set_dim("nI", get_width(X))
for layer in model.layers:
if layer.has_dim("nI") is not False:
layer.set_dim("nI", get_width(X))
for layer in model.layers:
layer.initialize(X=X, Y=Y)