fork download
  1. from numpy import loadtxt
  2. from tensorflow.keras.models import Sequential
  3. from tensorflow.keras.layers import Dense
  4. from matplotlib import pyplot
  5.  
  6.  
  7. def calculate(x):
  8. return x * x
  9.  
  10. # define inputs
  11. inputs = [-0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5]
  12. # calculate outputs
  13. outputs = [calculate(x) for x in inputs]
  14. # plot the result
  15. pyplot.plot(inputs, outputs)
  16. pyplot.show()
Success #stdin #stdout 2.42s 213892KB
stdin
Standard input is empty
stdout
Standard output is empty