Libtensorflow/DeviceList.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 35 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package AI::TensorFlow::Libtensorflow::DeviceList;
2 # ABSTRACT: A list of devices available for the session to run on
3 $AI::TensorFlow::Libtensorflow::DeviceList::VERSION = '0.0.7';
4 use strict;
5 use warnings;
6 use namespace::autoclean;
7 use AI::TensorFlow::Libtensorflow::Lib qw(arg);
8  
9 my $ffi = AI::TensorFlow::Libtensorflow::Lib->ffi;
10 $ffi->mangler(AI::TensorFlow::Libtensorflow::Lib->mangler_default);
11  
12 $ffi->attach( [ 'DeleteDeviceList' => 'DESTROY' ] => [
13 arg TF_DeviceList => 'list',
14 ] => 'void' );
15  
16 $ffi->attach( [ 'DeviceListCount' => 'Count' ] => [
17 arg TF_DeviceList => 'list',
18 ] => 'int' );
19  
20 my %methods = (
21 Name => 'string',
22 Type => 'string',
23 MemoryBytes => 'int64_t',
24 Incarnation => 'uint64_t',
25 );
26 for my $method (keys %methods) {
27 $ffi->attach( [ "DeviceList${method}" => $method ] => [
28 arg TF_DeviceList => 'list',
29 arg int => 'index',
30 arg TF_Status => 'status'
31 ] => $methods{$method} );
32 }
33  
34 ### From tensorflow/core/framework/types.cc
35 my %DEVICE_TYPES = (
36 DEFAULT => "DEFAULT",
37 CPU => "CPU",
38 GPU => "GPU",
39 TPU => "TPU",
40 TPU_SYSTEM => "TPU_SYSTEM",
41 );
42  
43 1;
44  
45 __END__