code: def _attach_graph_hooks(self):
      session = get_session()
  
      for (
          graph_tensor_hook_attr_name
      ) in self.graph_tensor_hook_attr_names:
          graph_tensor_hook_node_name = (
              self.graph_tensor_hook_node_names[
                  graph_tensor_hook_attr_name
              ]
          )
          node = session.graph.get_tensor_by_name(
              name=graph_tensor_hook_node_name
          )
          self.__setattr__(graph_tensor_hook_attr_name, node)
  
      for (
          graph_operation_hook_attr_name
      ) in self.graph_operation_hook_attr_names:
          graph_operation_hook_node_name = (
              self.graph_operation_hook_node_names[
                  graph_operation_hook_attr_name
              ]
          )
          node = session.graph.get_operation_by_name(
              name=graph_operation_hook_node_name
          )
          self.__setattr__(graph_operation_hook_attr_name, node)
  
      for (
          graph_iterator_hook_attr_name
      ) in self.graph_iterator_hook_attr_names:
          (
              iterator_resource_name,
              output_types,
              output_shapes,
              output_classes,
          ) = self.graph_iterator_hook_node_names[
              graph_iterator_hook_attr_name
          ]
          iterator_resource = session.graph.get_tensor_by_name(
              name=iterator_resource_name
          )
          iterator = tf.data.Iterator(
              iterator_resource,
              None,
              output_types,
              output_shapes,
              output_classes,
          )
          self.__setattr__(graph_iterator_hook_attr_name, iterator)
  
imports: from functools import partial
  from itertools import cycle
  import logging
  import numpy
  import os
  import pickle
  from scipy import sparse
  import tensorflow
  from .errors import ModelNotBiasedException, ModelNotFitException, ModelWithoutAttentionException, BatchNonSparseInputException, TfVersionException
  from .input_utils import create_tensorrec_iterator, get_dimensions_from_tensorrec_dataset
  from .loss_graphs import AbstractLossGraph, RMSELossGraph
  from .prediction_graphs import AbstractPredictionGraph, DotProductPredictionGraph
  from .recommendation_graphs import project_biases, split_sparse_tensor_indices, bias_prediction_dense, bias_prediction_serial, rank_predictions, densify_sampled_item_predictions, collapse_mixture_of_tastes, predict_similar_items
  from .representation_graphs import AbstractRepresentationGraph, LinearRepresentationGraph
  from .session_management import get_session
  from .util import sample_items, calculate_batched_alpha, datasets_from_raw_input
label_desc: Use image node_id 3 for calling the TensorRec obj's underlying member method code with example usage: obj._attach_graph_hooks() without return types