Skip to content

Commit

Permalink
Removing unnecessary file writing spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
arafatkatze committed Mar 4, 2017
1 parent 41dd55f commit 1802f8a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
Binary file removed abc
Binary file not shown.
73 changes: 36 additions & 37 deletions spec/scope_spec.rb
Expand Up @@ -2,43 +2,42 @@

describe 'Scope' do
it 'Should Test Sub Scope' do
root = Tensorflow::Scope.new
sub1 = root.subscope("x")
sub2 = root.subscope("x")
sub1a = sub1.subscope("y")
sub2a = sub2.subscope("y")
expect(Const(root,1).operation.name).to match('Const')
expect(Const(sub1,1).operation.name).to match('x/Const')
expect(Const(sub2,1).operation.name).to match('x_1/Const')
expect(Const(sub1a,1).operation.name).to match('x/y/Const')
expect(Const(sub2a,1).operation.name).to match('x_1/y/Const')
root = Tensorflow::Scope.new
sub1 = root.subscope('x')
sub2 = root.subscope('x')
sub1a = sub1.subscope('y')
sub2a = sub2.subscope('y')
expect(Const(root, 1).operation.name).to match('Const')
expect(Const(sub1, 1).operation.name).to match('x/Const')
expect(Const(sub2, 1).operation.name).to match('x_1/Const')
expect(Const(sub1a, 1).operation.name).to match('x/y/Const')
expect(Const(sub2a, 1).operation.name).to match('x_1/y/Const')
end
# TODO: add placeholder Tests
it 'Should test subscope naming is correct' do
root = Tensorflow::Scope.new
expect(Const(root.subscope('x'), 1).operation.name).to match('x/Const')
expect(Const(root.subscope('x'), 1).operation.name).to match('x_1/Const')
end
#TODO add placeholder Tests
it 'Should test subscope naming is correct' do
root = Tensorflow::Scope.new
expect(Const(root.subscope("x"),1).operation.name).to match('x/Const')
expect(Const(root.subscope("x"),1).operation.name).to match('x_1/Const')
end

it 'Should test subscope naming is correct' do
s = Tensorflow::Scope.new
input = Placeholder(s, 7)
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ReadFile', 'ReadFile', nil, [input]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('DecodeJpeg', 'DecodeJpeg', Hash["channels"=> 3], [output.output(0)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Cast', 'Cast', Hash["DstT"=> 1], [output.output(0)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ExpandDims', 'ExpandDims', nil, [output.output(0),Const(s.subscope("make_batch"), 0, :int32)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ResizeBilinear', 'ResizeBilinear', nil, [output.output(0),Const(s.subscope("size"), [224, 224], :int32)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Sub', 'Sub', nil, [output.output(0),Const(s.subscope("mean"), 117.00, :float)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Div', 'Div', nil, [output.output(0),Const(s.subscope("scale"), 1.00, :float)])).output(0)
graph = s.graph
graph.write_file("abc")
file_name ="/home/arafat/Desktop/tensorflow/gotest/mysore_palace.jpg"
data = File.read(file_name)
tensor = Tensorflow::Tensor.new("/home/arafat/Desktop/tensorflow/gotest/mysore_palace.jpg")
session_op = Tensorflow::Session_options.new
session = Tensorflow::Session.new(graph, session_op)
hash = {}
hash[input] = tensor
# out_tensor = session.run(hash, [output], [])
end
it 'Should test subscope naming is correct' do
s = Tensorflow::Scope.new
input = Placeholder(s, 7)
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ReadFile', 'ReadFile', nil, [input]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('DecodeJpeg', 'DecodeJpeg', Hash['channels' => 3], [output.output(0)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Cast', 'Cast', Hash['DstT' => 1], [output.output(0)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ExpandDims', 'ExpandDims', nil, [output.output(0), Const(s.subscope('make_batch'), 0, :int32)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('ResizeBilinear', 'ResizeBilinear', nil, [output.output(0), Const(s.subscope('size'), [224, 224], :int32)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Sub', 'Sub', nil, [output.output(0), Const(s.subscope('mean'), 117.00, :float)]))
output = input.operation.g.AddOperation(Tensorflow::OpSpec.new('Div', 'Div', nil, [output.output(0), Const(s.subscope('scale'), 1.00, :float)])).output(0)
graph = s.graph
file_name = '/home/arafat/Desktop/tensorflow/gotest/mysore_palace.jpg'
data = File.read(file_name)
tensor = Tensorflow::Tensor.new('/home/arafat/Desktop/tensorflow/gotest/mysore_palace.jpg')
session_op = Tensorflow::Session_options.new
session = Tensorflow::Session.new(graph, session_op)
hash = {}
hash[input] = tensor
# out_tensor = session.run(hash, [output], [])
end
end

0 comments on commit 1802f8a

Please sign in to comment.