How to expand a Tensorflow Variable -


is there way make tensorflow variable larger? like, let's wanted add neuron layer of neural network in middle of training. how go doing that? answer in this question told me how change shape of variable, expand fit row of weights, don't know how initialize new weights.

i figure way of going might involve combining variables, in initializing weights first in second variable , adding in new row or column of first variable, can't find lets me either.

there various ways accomplish this.

1) second answer in post (https://stackoverflow.com/a/33662680/5548115) explains how can change shape of variable calling 'assign' validate_shape=false. example, like

# assume var [m, n]  # add new 'data' of shape [1, n] new values new_neuron = tf.constant(...)    # if concatenating add row, concat on first dimension. # if new_neuron [m, 1], concat on second dimension. new_variable_data = tf.concat(0, [var, new_neuron])  # [m+1, n]  resize_var = tf.assign(var, new_variable_data, validate_shape=false) 

then when run resize_var, data pointed 'var' have updated data.

2) create large initial variable, , call tf.slice on different regions of variable training progresses, since can dynamically change 'begin' , 'size' attributes of slice.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -