Last active
January 4, 2017 05:21
-
-
Save arafatkatze/d6b5f7265dc02ceb2b38484965806eb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tensorflow' | |
graph = Tensorflow::Graph2.new | |
tensor_1 = Tensorflow::Tensor.new([2,3,4,6]) | |
tensor_2 = Tensorflow::Tensor.new([2,3,4,6]) | |
const_1 = graph.const("m1", tensor_1) | |
const_2 = graph.const("m2", tensor_2) | |
opec = Tensorflow::OpSpec.new | |
opec.name = "Additionofconstants" | |
opec.type = "Add" | |
opec.input = [const_1, const_2] | |
op = graph.AddOperation(opec) | |
session_op = Tensorflow::Session_options.new | |
sess = Tensorflow::Session.new(graph, session_op) | |
out_tensor = sess.run([],[op.output(0)],[]) | |
graph.write_file("proto") | |
print out_tensor, "\n" | |
# [[4, 6, 8, 12]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment