fork download
  1. import tensorflow as tf
  2. import numpy as np
  3.  
  4. # Initializing the input tensor
  5. a = tf.constant([[1, 2], [3, 4]], dtype = tf.float64)
  6.  
  7. # Printing the input tensor
  8. print('Input: ', a)
  9.  
  10. # Calculating result
  11. res = tf.math.reduce_max(a, axis = 1, keepdims = False)
  12.  
  13. # Printing the result
  14. print('Result: ', res)
Success #stdin #stdout 1.08s 196936KB
stdin
Standard input is empty
stdout
('Input: ', <tf.Tensor 'Const:0' shape=(2, 2) dtype=float64>)
('Result: ', <tf.Tensor 'Max:0' shape=(2,) dtype=float64>)