Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove call to layer.apply and just use __call__ #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions tf_slim/layers/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def avg_pool2d(inputs,
padding=padding,
data_format=df,
_scope=sc)
outputs = layer.apply(inputs)
outputs = layer(inputs)
return utils.collect_named_outputs(outputs_collections, sc, outputs)


Expand Down Expand Up @@ -164,7 +164,7 @@ def avg_pool3d(inputs,
padding=padding,
data_format=df,
_scope=sc)
outputs = layer.apply(inputs)
outputs = layer(inputs)
return utils.collect_named_outputs(outputs_collections, sc, outputs)


Expand Down Expand Up @@ -675,7 +675,7 @@ def batch_norm(inputs,
_scope=sc,
_reuse=reuse,
fused=fused)
outputs = layer.apply(inputs, training=is_training)
outputs = layer(inputs, training=is_training)

# Add variables to collections.
_add_variable_to_collections(layer.moving_mean, variables_collections,
Expand Down Expand Up @@ -1080,7 +1080,7 @@ def convolution(inputs,
dtype=inputs.dtype.base_dtype,
_scope=sc,
_reuse=reuse)
outputs = layer.apply(inputs)
outputs = layer(inputs)

# Add variables to collections.
_add_variable_to_collections(layer.kernel, variables_collections, 'weights')
Expand Down Expand Up @@ -1440,7 +1440,7 @@ def convolution2d_transpose(
dtype=inputs.dtype.base_dtype,
_scope=sc,
_reuse=reuse)
outputs = layer.apply(inputs)
outputs = layer(inputs)

# Add variables to collections.
_add_variable_to_collections(layer.kernel, variables_collections, 'weights')
Expand Down Expand Up @@ -1554,7 +1554,7 @@ def convolution3d_transpose(
dtype=inputs.dtype.base_dtype,
_scope=sc,
_reuse=reuse)
outputs = layer.apply(inputs)
outputs = layer(inputs)

# Add variables to collections.
_add_variable_to_collections(layer.kernel, variables_collections, 'weights')
Expand Down Expand Up @@ -1635,7 +1635,7 @@ def dropout(inputs,
seed=seed,
name=sc.name,
_scope=sc)
outputs = layer.apply(inputs, training=is_training)
outputs = layer(inputs, training=is_training)
return utils.collect_named_outputs(outputs_collections, sc.name, outputs)


Expand Down Expand Up @@ -1889,7 +1889,7 @@ def fully_connected(inputs,
dtype=inputs.dtype.base_dtype,
_scope=sc,
_reuse=reuse)
outputs = layer.apply(inputs)
outputs = layer(inputs)

# Add variables to collections.
_add_variable_to_collections(layer.kernel, variables_collections, 'weights')
Expand Down Expand Up @@ -2221,7 +2221,7 @@ def gdn(inputs,
dtype=inputs.dtype.base_dtype,
_scope=name,
_reuse=reuse)
return layer.apply(inputs)
return layer(inputs)


@add_arg_scope
Expand Down Expand Up @@ -2438,7 +2438,7 @@ def max_pool2d(inputs,
padding=padding,
data_format=df,
_scope=sc)
outputs = layer.apply(inputs)
outputs = layer(inputs)
return utils.collect_named_outputs(outputs_collections, sc, outputs)


Expand Down Expand Up @@ -2488,7 +2488,7 @@ def max_pool3d(inputs,
padding=padding,
data_format=df,
_scope=sc)
outputs = layer.apply(inputs)
outputs = layer(inputs)
return utils.collect_named_outputs(outputs_collections, sc, outputs)


Expand Down Expand Up @@ -2794,7 +2794,7 @@ def separable_convolution2d(
dtype=inputs.dtype.base_dtype,
_scope=sc,
_reuse=reuse)
outputs = layer.apply(inputs)
outputs = layer(inputs)

# Add variables to collections.
_add_variable_to_collections(layer.depthwise_kernel,
Expand Down