Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Changed transpose property to function. #137

Merged
merged 3 commits into from
Dec 10, 2018

Conversation

tdiethe
Copy link
Contributor

@tdiethe tdiethe commented Nov 23, 2018

This stops the debugger accidentally creating new variables on access.

Description of changes:
When using an interactive debugger (e.g. PyCharm), inspecting any Variable object invokes the property T which has the side effect of creating new variables that are not part of the graph. By changing this to a function .transpose() the functionality is maintained (at the slight expense of ease of use) whilst preventing this from happening.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-io
Copy link

codecov-io commented Nov 24, 2018

Codecov Report

Merging #137 into develop will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #137   +/-   ##
========================================
  Coverage    85.11%   85.11%           
========================================
  Files           77       77           
  Lines         3817     3817           
  Branches       653      653           
========================================
  Hits          3249     3249           
  Misses         375      375           
  Partials       193      193
Impacted Files Coverage Δ
mxfusion/components/variables/variable.py 87.16% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82e7120...a7de816. Read the comment docs.

@zhenwendai
Copy link
Contributor

inspecting any Variable object invokes the property T which has the side effect of creating new variables that are not part of the graph.

Could you give an example? I think the resulting variable should be in the graph but without an explicit reference.

One way to provide the property T is to cache the outcome variable (as the transpose of a variable should always be the same).

meissnereric
meissnereric previously approved these changes Nov 27, 2018
@meissnereric meissnereric dismissed their stale review November 27, 2018 16:09

I don't think we should make this change, instead should just remove the transpose property altogether.

@meissnereric
Copy link
Contributor

I think you're right that a property like this shouldn't have side effects. But if it's not a property, I would rather remove the transpose function altogether from the Variable class, and ask users to just call the transpose operator.

@tdiethe
Copy link
Contributor Author

tdiethe commented Nov 28, 2018

Conclusion on this? Do you want me to update the PR to remove the function entirely?

@meissnereric
Copy link
Contributor

That is my preference yeah Tom. Don't remove the operator, just the member method in Variable.

@zhenwendai zhenwendai merged commit 32b3c3b into amzn:develop Dec 10, 2018
@zhenwendai zhenwendai added this to the MXFusion v0.3.0 milestone Feb 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants