tf.linalg.normalize
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
Normalizes tensor along dimension axis using specified norm.
tf.linalg.normalize(
    tensor, ord='euclidean', axis=None, name=None
)
This uses tf.linalg.norm to compute the norm along axis.
This function can compute several different vector norms (the 1-norm, the
Euclidean or 2-norm, the inf-norm, and in general the p-norm for p > 0) and
matrix norms (Frobenius, 1-norm, 2-norm and inf-norm).
| Args | 
|---|
| tensor | Tensorof typesfloat32,float64,complex64,complex128 | 
| ord | Order of the norm. Supported values are 'fro','euclidean',1,2,np.infand any positive real number yielding the corresponding
p-norm. Default is'euclidean'which is equivalent to Frobenius norm iftensoris a matrix and equivalent to 2-norm for vectors.
Some restrictions apply: a) The Frobenius norm'fro'is not defined for
vectors, b) If axis is a 2-tuple (matrix norm), only'euclidean',
'fro',1,2,np.infare supported. See the description ofaxison how to compute norms for a batch of vectors or matrices stored in a
tensor. | 
| axis | If axisisNone(the default), the input is considered a vector
and a single vector norm is computed over the entire set of values in the
tensor, i.e.norm(tensor, ord=ord)is equivalent tonorm(reshape(tensor, [-1]), ord=ord). Ifaxisis a Python integer, the
input is considered a batch of vectors, andaxisdetermines the axis intensorover which to compute vector norms. Ifaxisis a 2-tuple of
Python integers it is considered a batch of matrices andaxisdetermines
the axes intensorover which to compute a matrix norm.
Negative indices are supported. Example: If you are passing a tensor that
can be either a matrix or a batch of matrices at runtime, passaxis=[-2,-1]instead ofaxis=Noneto make sure that matrix norms are
computed. | 
| name | The name of the op. | 
| Returns | 
|---|
| normalized | A normalized Tensorwith the same shape astensor. | 
| norm | The computed norms with the same shape and dtype tensorbut the
final axis is 1 instead. Same as runningtf.cast(tf.linalg.norm(tensor, ord, axis keepdims=True), tensor.dtype). | 
| Raises | 
|---|
| ValueError | If ordoraxisis invalid. | 
  
  
 
  
    
    
      
       
    
    
  
  
  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 2020-10-01 UTC.
  
  
  
    
      [null,null,["Last updated 2020-10-01 UTC."],[],[]]