Skip to content

Add additional script module functionality#6033

Merged
zdevito merged 3 commits intopytorch:masterfrom
zdevito:pr/addition_script_module
Mar 28, 2018
Merged

Add additional script module functionality#6033
zdevito merged 3 commits intopytorch:masterfrom
zdevito:pr/addition_script_module

Conversation

@zdevito
Copy link
Copy Markdown
Contributor

@zdevito zdevito commented Mar 27, 2018

  1. allow calls to non-script methods
  2. test that modules can have non-script attributes that these methods can access
  3. test that non-script modules cannot be changed after creation (since we resolve self.submodule right after __init__ is called, script methods would never see the modification to the submodules, hence instead of supporting this case we need to specifically disallow it).

Resolves 1--3 of #6015
Resolution order (4) is more complicated and will come in a later PR.

Copy link
Copy Markdown
Contributor

@apaszke apaszke left a comment

Choose a reason for hiding this comment

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

LGTM, but we also need a test that checks that non-script attributes can be changed, and that those changes are later visible in non-script methods (so e.g. change self.value in the first test, and later verify that it's no longer "hi")

@zdevito zdevito merged commit 0f198fa into pytorch:master Mar 28, 2018
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
* allow calls to non-script methods, allow python non-script attributes in methods
* add test to make sure submodules are not reassigned
* Test that we can change python attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants