lib/tensorflow/ffi.rb in tensorflow-0.1.0 vs lib/tensorflow/ffi.rb in tensorflow-0.1.1
- old
+ new
@@ -7,11 +7,18 @@
rescue LoadError => e
raise e if ENV["TENSORFLOW_DEBUG"]
raise LoadError, "Could not find TensorFlow"
end
+ class Buffer < ::FFI::Struct
+ layout :data, :pointer,
+ :length, :size_t,
+ :data_deallocator, :pointer
+ end
+
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/c/c_api.h
attach_function :TF_Version, %i[], :string
+ attach_function :TF_GetAllOpList, %i[], Buffer.by_ref
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/c/tf_attrtype.h
AttrType = enum(:string, :int, :float, :bool, :type, :shape, :tensor, :placeholder, :func)
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/c/tf_datatype.h