Skip to content

Create a new tf.env() getter that returns the global ENV #2034

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

Merged
merged 11 commits into from
Oct 1, 2019
Merged

Conversation

nsthorat
Copy link
Contributor

@nsthorat nsthorat commented Sep 12, 2019

This is for the no exported objects rule which is against ES2015 module semantics.

This will be a replacement for anyone using tf.ENV as a global getter (we will not remove tf.ENV until the next major version bump).

We won't use exports = {} because it breaks the OSS build.


This change is Reviewable

Copy link
Contributor

@dsmilkov dsmilkov left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @dsmilkov)

@dsmilkov
Copy link
Contributor

File a bug and assign it to the 2.0 project: https://github.com/tensorflow/tfjs/projects/10

@nsthorat nsthorat changed the title Upstream exports={} for mutable exported objects. Create a new tf.environment() getter that returns the global ENV. Sep 30, 2019
Copy link
Contributor

@dsmilkov dsmilkov left a comment

Choose a reason for hiding this comment

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

Reviewed 46 of 46 files at r2.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @nsthorat)


tfjs-converter/src/data/compiled_api.ts, line 25 at r2 (raw file):

// tslint:disable-next-line:ban-ts-ignore see above
// @ts-ignore
exports = {};

this is something we now do in the sync script internally? Revert here?


tfjs-core/src/environment.ts, line 168 at r2 (raw file):

      `Could not parse value flag value ${value} for flag ${flagName}.`);
}

add jsdoc and export it in globals.ts so it shows up in our API docs


tfjs-core/src/environment.ts, line 169 at r2 (raw file):

}

export function environment() {

how about making it shorter: tf.env() -- still clear what it returns.

@dsmilkov
Copy link
Contributor

dsmilkov commented Oct 1, 2019

Also can you file a bug and assign to this project https://github.com/tensorflow/tfjs/projects/10 which tracks 2.0

@nsthorat
Copy link
Contributor Author

nsthorat commented Oct 1, 2019

Issue already filed: #2124

Copy link
Contributor Author

@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.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained


tfjs-converter/src/data/compiled_api.ts, line 25 at r2 (raw file):

Previously, dsmilkov (Daniel Smilkov) wrote…

this is something we now do in the sync script internally? Revert here?

Done


tfjs-core/src/environment.ts, line 168 at r2 (raw file):

Previously, dsmilkov (Daniel Smilkov) wrote…

add jsdoc and export it in globals.ts so it shows up in our API docs

Done


tfjs-core/src/environment.ts, line 169 at r2 (raw file):

Previously, dsmilkov (Daniel Smilkov) wrote…

how about making it shorter: tf.env() -- still clear what it returns.

Done

@nsthorat nsthorat changed the title Create a new tf.environment() getter that returns the global ENV. Create a new tf.env() getter that returns the global ENV Oct 1, 2019
@nsthorat nsthorat merged commit fe4627f into master Oct 1, 2019
@nsthorat nsthorat deleted the exportsobj branch October 1, 2019 18:21
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.

3 participants