Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Adds error for building models with negative shapes #311

Merged
merged 2 commits into from
Sep 4, 2018
Merged

Conversation

bileschi
Copy link
Contributor

@bileschi bileschi commented Sep 4, 2018

Description

FEATURE: Adds error checking when adding layers to a sequential model which would result in outputs of negative size (matching behavior in py keras.
FIXES: tensorflow/tfjs#318


This change is Reviewable

@bileschi bileschi requested a review from caisq September 4, 2018 14:25
Copy link
Contributor

@caisq caisq left a comment

Choose a reason for hiding this comment

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

Thanks!

Reviewable status: 0 of 1 approvals obtained (waiting on @bileschi and @caisq)


src/models.ts, line 400 at r1 (raw file):

layer.inboundNodes[0].outputTensors[0].shape.some(

Since the same code is duplicated below, can you refactor the code into a helper method, maybe called "checkShape"?


src/models.ts, line 401 at r1 (raw file):

x !== null 

I think x !== null can be omitted here, because both null < 0 evaluates to false.

Same below.

Copy link
Contributor Author

@bileschi bileschi 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 @caisq)


src/models.ts, line 400 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
layer.inboundNodes[0].outputTensors[0].shape.some(

Since the same code is duplicated below, can you refactor the code into a helper method, maybe called "checkShape"?

Done.


src/models.ts, line 401 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
x !== null 

I think x !== null can be omitted here, because both null < 0 evaluates to false.

Same below.

Done.

Copy link
Contributor Author

@bileschi bileschi left a comment

Choose a reason for hiding this comment

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

Thanks for the review!

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

@bileschi bileschi merged commit a03eb8e into master Sep 4, 2018
@dsmilkov dsmilkov deleted the negshape branch February 21, 2019 15:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants