AI-TensorFlow-Libtensorflow
view release on metacpan or search on metacpan
lib/AI/TensorFlow/Libtensorflow/Lib.pm view on Meta::CPAN
package AI::TensorFlow::Libtensorflow::Lib;
# ABSTRACT: Private class for AI::TensorFlow::Libtensorflow
$AI::TensorFlow::Libtensorflow::Lib::VERSION = '0.0.7';
use strict;
use warnings;
use feature qw(state);
use FFI::CheckLib 0.28 qw( find_lib_or_die );
use Alien::Libtensorflow;
use FFI::Platypus;
use AI::TensorFlow::Libtensorflow::Lib::FFIType::Variant::PackableArrayRef;
use AI::TensorFlow::Libtensorflow::Lib::FFIType::Variant::PackableMaybeArrayRef;
use AI::TensorFlow::Libtensorflow::Lib::FFIType::TFPtrSizeScalar;
use base 'Exporter::Tiny';
our @EXPORT_OK = qw(arg);
sub lib {
$ENV{AI_TENSORFLOW_LIBTENSORFLOW_LIB_DLL}
// find_lib_or_die(
lib => 'tensorflow',
symbol => ['TF_Version'],
alien => ['Alien::Libtensorflow'] );
}
sub ffi {
state $ffi;
$ffi ||= do {
my $ffi = FFI::Platypus->new( api => 2 );
$ffi->lib( __PACKAGE__->lib );
$ffi->load_custom_type('::PointerSizeBuffer' => 'tf_config_proto_buffer');
$ffi->load_custom_type('::PointerSizeBuffer' => 'tf_tensor_shape_proto_buffer');
$ffi->load_custom_type('::PointerSizeBuffer' => 'tf_attr_value_proto_buffer');
$ffi->load_custom_type('AI::TensorFlow::Libtensorflow::Lib::FFIType::TFPtrSizeScalar'
=> 'tf_text_buffer');
$ffi->load_custom_type( PackableMaybeArrayRef( 'DimsBuffer', pack_type => 'q' )
=> 'tf_dims_buffer'
);
$ffi->type('object(AI::TensorFlow::Libtensorflow::SessionOptions)' => 'TF_SessionOptions');
$ffi->type('object(AI::TensorFlow::Libtensorflow::Graph)' => 'TF_Graph');
$ffi->type('object(AI::TensorFlow::Libtensorflow::OperationDescription)'
=> 'TF_OperationDescription');
$ffi->load_custom_type('::PtrObject', 'TF_Operation' => 'AI::TensorFlow::Libtensorflow::Operation');
$ffi->type('opaque' => 'TF_Function');
$ffi->type('opaque' => 'TF_FunctionOptions');
$ffi->type('object(AI::TensorFlow::Libtensorflow::ImportGraphDefOptions)' => 'TF_ImportGraphDefOptions');
$ffi->type('object(AI::TensorFlow::Libtensorflow::ImportGraphDefResults)' => 'TF_ImportGraphDefResults');
$ffi->type('object(AI::TensorFlow::Libtensorflow::Session)' => 'TF_Session');
$ffi->type('opaque' => 'TF_DeprecatedSession');
$ffi->type('object(AI::TensorFlow::Libtensorflow::DeviceList)' => 'TF_DeviceList');
$ffi->type('object(AI::TensorFlow::Libtensorflow::TFLibrary)' => 'TF_Library');
( run in 2.843 seconds using v1.01-cache-2.11-cpan-63c85eba8c4 )