def get_bias_mod(self, name, shape, trainable): b = caffe_bias(name) indices, known = input_data.get_indices() B = np.array(np.zeros((len(indices),)), dtype=np.float32) B[known] = b[indices[known]] t = tf.Variable(B, name="bias") return t
def get_fc_weight_mod(self, name, shape, trainable, decay=None): cw = caffe_weights(name).transpose((1,0)) indices, known = input_data.get_indices() W = np.array(np.random.randn(cw.shape[0], len(indices)), dtype=np.float32) * 1e-2 for i in known: W[:, i] = cw[:, indices[i]] t = tf.Variable(W, name="weight") return t