Skip to content

Conversation

@annxingyuan
Copy link
Contributor

@annxingyuan annxingyuan commented Oct 22, 2019

This PR fixes #2194

Changes

  • In fused ops check whether we are in gradient mode, and the fused activation is not backproppable. If so, call the unfused ops instead.

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

@annxingyuan annxingyuan self-assigned this Oct 22, 2019
Copy link
Contributor

@nsthorat nsthorat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, 1 of 1 files at r2.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan, @dsmilkov, and @nsthorat)


tfjs-core/src/ops/fused_ops.ts, line 502 at r1 (raw file):

  preluActivationWeights?: Tensor
}): T {
  if (shouldNotFuse(ENGINE.state.gradientDepth, activation)) {

lets make this the inverse: shouldFuse


tfjs-core/src/ops/fused_test.ts, line 952 at r2 (raw file):

     });

  // tslint:disable-next-line:max-line-length

i think you can remove this tslint


tfjs-core/src/ops/fused_test.ts, line 953 at r2 (raw file):

  // tslint:disable-next-line:max-line-length
  it('calling fused op in gradient mode with activation that does not support fused gradients works',

instead of "that does not support fused gradient" how about we just have tests for all the combinations and dont talk about whether internally we support things


tfjs-core/src/ops/fused_util.ts, line 45 at r1 (raw file):

// Returns gradient for fused activation.
export const getDyActivation =

put "fused" in the name

also, optional: should this just live in the other file?


tfjs-core/src/ops/fused_util.ts, line 59 at r1 (raw file):

// Returns gradient for fused bias.
export const getBiasGradient = (bias: Tensor, dyActivation: Tensor): Tensor => {

getFusedBiasGradient

Copy link
Contributor Author

@annxingyuan annxingyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @dsmilkov)


tfjs-core/src/ops/fused_ops.ts, line 502 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

lets make this the inverse: shouldFuse

Done


tfjs-core/src/ops/fused_test.ts, line 952 at r2 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

i think you can remove this tslint

Done


tfjs-core/src/ops/fused_test.ts, line 953 at r2 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

instead of "that does not support fused gradient" how about we just have tests for all the combinations and dont talk about whether internally we support things

Done


tfjs-core/src/ops/fused_util.ts, line 45 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

put "fused" in the name

also, optional: should this just live in the other file?

Done


tfjs-core/src/ops/fused_util.ts, line 59 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

getFusedBiasGradient

Done

@annxingyuan annxingyuan merged commit 632785b into master Oct 22, 2019
@annxingyuan annxingyuan deleted the fix_fused branch October 22, 2019 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

convInfo undefined when fitting downloaded model for transfer learning

3 participants