Code locations for colocation context managers active at op creation. This property will return a dictionary for which the keys are nodes with which this Operation is colocated, and for which the values are traceable_stack.TraceableObject instances. The TraceableObject instances re
(self)
| 1927 | |
| 1928 | @property |
| 1929 | def _colocation_dict(self): |
| 1930 | """Code locations for colocation context managers active at op creation. |
| 1931 | |
| 1932 | This property will return a dictionary for which the keys are nodes with |
| 1933 | which this Operation is colocated, and for which the values are |
| 1934 | traceable_stack.TraceableObject instances. The TraceableObject instances |
| 1935 | record the location of the relevant colocation context manager but have the |
| 1936 | "obj" field set to None to prevent leaking private data. |
| 1937 | |
| 1938 | For example, suppose file_a contained these lines: |
| 1939 | |
| 1940 | file_a.py: |
| 1941 | 14: node_a = tf.constant(3, name='NODE_A') |
| 1942 | 15: with tf.compat.v1.colocate_with(node_a): |
| 1943 | 16: node_b = tf.constant(4, name='NODE_B') |
| 1944 | |
| 1945 | Then a TraceableObject t_obj representing the colocation context manager |
| 1946 | would have these member values: |
| 1947 | |
| 1948 | t_obj.obj -> None |
| 1949 | t_obj.filename = 'file_a.py' |
| 1950 | t_obj.lineno = 15 |
| 1951 | |
| 1952 | and node_b.op._colocation_dict would return the dictionary |
| 1953 | |
| 1954 | { 'NODE_A': t_obj } |
| 1955 | |
| 1956 | Returns: |
| 1957 | {str: traceable_stack.TraceableObject} as per this method's description, |
| 1958 | above. |
| 1959 | """ |
| 1960 | locations_dict = self._colocation_code_locations or {} |
| 1961 | return locations_dict.copy() |
| 1962 | |
| 1963 | @property |
| 1964 | def _output_types(self): |