| 1 | package AI::TensorFlow::Libtensorflow::Lib::Types; | ||
| 2 | # ABSTRACT: Type library | ||
| 3 | $AI::TensorFlow::Libtensorflow::Lib::Types::VERSION = '0.0.7'; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use Type::Library 0.008 -base, | ||
| 7 | -declare => [qw( | ||
| 8 | TFTensor | ||
| 9 | TFGraph | ||
| 10 | TFDataType | ||
| 11 | |||
| 12 | Dims | ||
| 13 | )]; | ||
| 14 | use Type::Utils -all; | ||
| 15 | use Types::Standard qw(ArrayRef Int Tuple InstanceOf); | ||
| 16 | |||
| 17 | class_type TFTensor => { class => 'AI::TensorFlow::Libtensorflow::Tensor' }; | ||
| 18 | |||
| 19 | class_type TFGraph => { class => 'AI::TensorFlow::Libtensorflow::Graph' }; | ||
| 20 | |||
| 21 | class_type TFDataType => { class => 'AI::TensorFlow::Libtensorflow::DataType' }; | ||
| 22 | |||
| 23 | class_type TFSession => { class => 'AI::TensorFlow::Libtensorflow::Session' }; | ||
| 24 | |||
| 25 | class_type TFSessionOptions => { class => 'AI::TensorFlow::Libtensorflow::SessionOptions' }; | ||
| 26 | |||
| 27 | class_type TFStatus => { class => 'AI::TensorFlow::Libtensorflow::Status' }; | ||
| 28 | |||
| 29 | class_type TFBuffer => { class => 'AI::TensorFlow::Libtensorflow::Buffer' }; | ||
| 30 | |||
| 31 | class_type TFOperation => { class => 'AI::TensorFlow::Libtensorflow::Operation' }; | ||
| 32 | |||
| 33 | |||
| 34 | declare Dims => as ArrayRef[Int]; | ||
| 35 | |||
| 36 | class_type TFOutput => { class => 'AI::TensorFlow::Libtensorflow::Output' }; | ||
| 37 | |||
| 38 | declare_coercion "TFOutputFromTuple", | ||
| 39 | to_type 'TFOutput', | ||
| 40 | from Tuple[InstanceOf['AI::TensorFlow::Libtensorflow::Operation'],Int], | ||
| 41 | q { | ||
| 42 | AI::TensorFlow::Libtensorflow::Output->New({ | ||
| 43 | oper => $_->[0], | ||
| 44 | index => $_->[1], | ||
| 45 | }); | ||
| 46 | }; | ||
| 47 | |||
| 48 | class_type TFInput => { class => 'AI::TensorFlow::Libtensorflow::Input' }; | ||
| 49 | |||
| 50 | declare_coercion "TFInputFromTuple", | ||
| 51 | to_type 'TFInput', | ||
| 52 | from Tuple[InstanceOf['AI::TensorFlow::Libtensorflow::Operation'],Int], | ||
| 53 | q { | ||
| 54 | AI::TensorFlow::Libtensorflow::Input->New({ | ||
| 55 | oper => $_->[0], | ||
| 56 | index => $_->[1], | ||
| 57 | }); | ||
| 58 | }; | ||
| 59 | |||
| 60 | 1; | ||
| 61 | |||
| 62 | __END__ |