fork download
  1. import tensorflow as tf
  2.  
  3. mat = tf.constant([[12,23,34,65], [2,25,1,8], [5,7,78,12],[95,21,47,20]])
  4.  
  5. print(mat)
  6.  
  7. matmax = tf.math.reduce_max(mat, axis = 1)
  8.  
  9. print(matmax)
  10.  
  11. vtr1 = tf.constant([[2,5,1], [7,12,4], [19,15,6]])
  12.  
  13. vtr2 = tf.constant([[13,4,11], [67,23,45], [71,11,10]])
  14.  
  15. vtr3=vtr1 + vtr2
  16.  
  17. print(vtr3)
  18.  
  19. vtr4 = tf.constant([[12,23],[34,45], [56,67]])
  20.  
  21. list1 = [[5,12], [34,1],[6,7]]
  22.  
  23. vtr5 = vtr4 + list1
  24.  
  25. print(vtr5)
Success #stdin #stdout 0.93s 197776KB
stdin
Standard input is empty
stdout
Tensor("Const:0", shape=(4, 4), dtype=int32)
Tensor("Max:0", shape=(4,), dtype=int32)
Tensor("add:0", shape=(3, 3), dtype=int32)
Tensor("add_1:0", shape=(3, 2), dtype=int32)