Skip to content

Commit e6a92c0

Browse files
authored
Make Engine explicitly implement TensorTracker (tensorflow#1488)
INTERNAL Fix by Martin Probst. Previously, Engine would only structurally match TensorTracker, by implementing the right methods. This works on the TypeScript level, but fails when compiling with Closure Compiler. The optimizer never sees an assignment of an `Engine` type into a `TensorTracker` due to the indirection in the code, and then removes and disambiguates properties incorrectly. This is a known limitation of Closure Compiler. The fix to explicitly implement the interface that's used to refer to the type, and Closure Compiler is aware of the property use/name collision.
1 parent 1790146 commit e6a92c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/engine.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import {BackendTimingInfo, DataMover, KernelBackend} from './kernels/backend';
1919
import {Profiler} from './profiler';
2020
import {backpropagateGradients, getFilteredNodesXToY, NamedGradientMap, TapeNode} from './tape';
21-
import {DataId, Tensor, Tensor3D, Variable} from './tensor';
21+
import {DataId, Tensor, Tensor3D, TensorTracker, Variable} from './tensor';
2222
import {NamedTensorMap, NamedVariableMap, TensorContainer} from './tensor_types';
2323
import {getTensorsInContainer, isTensorInList} from './tensor_util';
2424
import {DataType, DataValues} from './types';
@@ -78,7 +78,7 @@ interface ScopeState {
7878
name: string;
7979
}
8080

81-
export class Engine implements TensorManager, DataMover {
81+
export class Engine implements TensorManager, TensorTracker, DataMover {
8282
// Public since optimizers will use it.
8383
registeredVariables: NamedVariableMap = {};
8484

0 commit comments

Comments
 (0)