tfp.bijectors.pack_sequence_as
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
Returns a Bijector variant of tf.nest.pack_sequence_as.
tfp.bijectors.pack_sequence_as(
    example, name='restructure'
)
See also the Restructure bijector for general rearrangements.
| Args | 
|---|
| example | A Tensor or (potentially nested) collection of Tensors. | 
| name | An optional Python string, inserted into names of TF ops
created by this bijector. | 
| Returns | 
|---|
| pack | A Bijector whose forwardmethod packs a list of Tensors of
the right length into a structure parallel toexample, and
whoseinversemethod flattens structures parallel toexampleinto a list of Tensors. | 
Example
x = tf.constant(1)
example = collections.OrderedDict([
    ('a', [x, x, x]),
    ('b', x)])
bij = tfb.pack_sequence_as(example)
bij.forward([1, 2, 3, 4.])
# Returns
# collections.OrderedDict([
#     ('a', [1, 2, 3]),
#     ('b', 4.)])
  
  
 
  
    
    
      
       
    
    
  
  
  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.
  Last updated 2023-11-21 UTC.
  
  
  
    
      [null,null,["Last updated 2023-11-21 UTC."],[],[]]