-
Notifications
You must be signed in to change notification settings - Fork 31
Changed transpose property to function. #137
Conversation
…entally creating new variables on access
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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). |
I don't think we should make this change, instead should just remove the transpose property altogether.
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. |
Conclusion on this? Do you want me to update the PR to remove the function entirely? |
That is my preference yeah Tom. Don't remove the operator, just the member method in Variable. |
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 propertyT
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.