tf.compat.v1.tables_initializer
    
    
       
    
    
      
      Stay organized with collections
     
    
      
      Save and categorize content based on your preferences.
     
    
  
      
     
  
  
  
   
  
    
  
  
    
    
Returns an Op that initializes all tables of the default graph.
tf . compat . v1 . tables_initializer ( 
    name = 'init_all_tables' 
) 
 
Caution:  This API was designed for TensorFlow v1.
Continue reading for details on how to migrate from this API to a native
TensorFlow v2 equivalent. See the
TensorFlow v1 to TensorFlow v2 migration guide 
for instructions on how to migrate the rest of your code.  
tf.compat.v1.tables_initializer  is no longer needed with eager execution and
tf.function . In TF2, when creating an initializable table like a
tf.lookup.StaticHashTable , the table will automatically be initialized on
creation.
Before & After Usage Example 
Before:
with  tf . compat . v1 . Session (): 
  init  =  tf . compat . v1 . lookup . KeyValueTensorInitializer ([ 'a' ,  'b' ],  [ 1 ,  2 ]) 
  table  =  tf . compat . v1 . lookup . StaticHashTable ( init ,  default_value =- 1 ) 
  tf . compat . v1 . tables_initializer () . run () 
  result  =  table . lookup ( tf . constant ([ 'a' ,  'c' ])) . eval () 
result 
array ([  1 ,  - 1 ],  dtype = int32 )  
After:
init  =  tf . lookup . KeyValueTensorInitializer ([ 'a' ,  'b' ],  [ 1 ,  2 ]) 
table  =  tf . lookup . StaticHashTable ( init ,  default_value =- 1 ) 
table . lookup ( tf . constant ([ 'a' ,  'c' ])) . numpy () 
array ([  1 ,  - 1 ],  dtype = int32 )  
Description 
 
Args  
name 
 
Optional name for the initialization op.
 
 
 
Returns  
An Op that initializes all tables.  Note that if there are
not tables the returned Op is a NoOp.
 
 
  
  
 
  
    
    
      
    
     
  
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license .
  Last updated 2023-10-06 UTC.
 
 
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[],[]]