Skip to content

Commit 9a23c2d

Browse files
committed
2 parents 994b926 + 21a38c6 commit 9a23c2d

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ To release a new version, please update the changelog as followed:
106106

107107
### Fixed
108108
- Fix `tf.models.Model._construct_graph` for list of outputs, e.g. STN case (PR #1010)
109-
- Enable better `in_channels` exception raise. (pR #1015)
109+
- Enable better `in_channels` exception raise. (PR #1015)
110110
- Set allow_pickle=True in np.load() (#PR 1021)
111+
- Remove `private_method` decorator (#PR 1025)
112+
- Copy original model's `trainable_weights` and `nontrainable_weights` when initializing `ModelLayer` (#PR 1026)
111113

112114
### Removed
113115

@@ -116,8 +118,8 @@ To release a new version, please update the changelog as followed:
116118
### Contributors
117119

118120
- @zsdonghao
119-
- @ChrisWu1997: #1010 #1015
120-
- @warshallrho: #1017 #1021
121+
- @ChrisWu1997: #1010 #1015 #1025
122+
- @warshallrho: #1017 #1021 #1026
121123
- @ArnoldLIULJ: #1023
122124
- @JingqingZ: #1023
123125

tensorlayer/layers/convolution/deformable_conv.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,26 +235,22 @@ def forward(self, inputs):
235235
outputs = self.act(outputs)
236236
return outputs
237237

238-
@private_method
239238
def _to_bc_h_w(self, x, x_shape):
240239
"""(b, h, w, c) -> (b*c, h, w)"""
241240
x = tf.transpose(a=x, perm=[0, 3, 1, 2])
242241
x = tf.reshape(x, (-1, x_shape[1], x_shape[2]))
243242
return x
244243

245-
@private_method
246244
def _to_b_h_w_n_c(self, x, x_shape):
247245
"""(b*c, h, w, n) -> (b, h, w, n, c)"""
248246
x = tf.reshape(x, (-1, x_shape[4], x_shape[1], x_shape[2], x_shape[3]))
249247
x = tf.transpose(a=x, perm=[0, 2, 3, 4, 1])
250248
return x
251249

252-
@private_method
253250
def tf_flatten(self, a):
254251
"""Flatten tensor"""
255252
return tf.reshape(a, [-1])
256253

257-
@private_method
258254
def _get_vals_by_coords(self, inputs, coords, idx, out_shape):
259255
indices = tf.stack(
260256
[idx, self.tf_flatten(coords[:, :, :, :, 0]),
@@ -264,7 +260,6 @@ def _get_vals_by_coords(self, inputs, coords, idx, out_shape):
264260
vals = tf.reshape(vals, out_shape)
265261
return vals
266262

267-
@private_method
268263
def _tf_repeat(self, a, repeats):
269264
"""Tensorflow version of np.repeat for 1D"""
270265
# https://github.com/tensorflow/tensorflow/issues/8521
@@ -277,7 +272,6 @@ def _tf_repeat(self, a, repeats):
277272
a = self.tf_flatten(a)
278273
return a
279274

280-
@private_method
281275
def _tf_batch_map_coordinates(self, inputs, coords):
282276
"""Batch version of tf_map_coordinates
283277
@@ -324,7 +318,6 @@ def _tf_batch_map_coordinates(self, inputs, coords):
324318

325319
return mapped_vals
326320

327-
@private_method
328321
def _tf_batch_map_offsets(self, inputs, offsets, grid_offset):
329322
"""Batch map offsets into input
330323

tensorlayer/layers/convolution/super_resolution.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def forward(self, inputs):
8787
outputs = self.act(outputs)
8888
return outputs
8989

90-
@private_method
9190
def _PS(self, I, r):
9291
X = tf.transpose(a=I, perm=[2, 1, 0]) # (r, w, b)
9392
X = tf.batch_to_space(input=X, block_shape=[r], crops=[[0, 0]]) # (1, r*w, b)
@@ -188,7 +187,6 @@ def forward(self, inputs):
188187
outputs = self.act(outputs)
189188
return outputs
190189

191-
@private_method
192190
def _PS(self, X, r, n_out_channels):
193191

194192
_err_log = "SubpixelConv2d: The number of input channels == (scale x scale) x The number of output channels"

tensorlayer/layers/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ def __init__(self, model, name=None):
512512

513513
# Layer weight state
514514
self._all_weights = model.all_weights
515+
self._trainable_weights = model.trainable_weights
516+
self._nontrainable_weights = model.nontrainable_weights
515517

516518
# Layer training state
517519
self.is_train = True

tensorlayer/layers/noise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def build(self, inputs=None):
7272
pass
7373

7474
def forward(self, inputs):
75-
if (self.is_train and self.is_always) is False:
75+
if (self.is_train or self.is_always) is False:
7676
return inputs
7777
else:
7878
# noise = np.random.normal(0.0 , sigma , tf.to_int64(self.inputs).get_shape())

0 commit comments

Comments
 (0)