AI-TensorFlow-Libtensorflow

 view release on metacpan or  search on metacpan

lib/AI/TensorFlow/Libtensorflow/OperationDescription.pm  view on Meta::CPAN

package AI::TensorFlow::Libtensorflow::OperationDescription;
# ABSTRACT: Operation being built
$AI::TensorFlow::Libtensorflow::OperationDescription::VERSION = '0.0.7';
use strict;
use warnings;
use namespace::autoclean;
use AI::TensorFlow::Libtensorflow::Lib qw(arg);
use AI::TensorFlow::Libtensorflow::Lib::FFIType::Variant::PackableArrayRef;

my $ffi = AI::TensorFlow::Libtensorflow::Lib->ffi;
$ffi->mangler(AI::TensorFlow::Libtensorflow::Lib->mangler_default);
$ffi->load_custom_type('AI::TensorFlow::Libtensorflow::Lib::FFIType::TFPtrSizeScalarRef'
        => 'tf_attr_string_buffer'
);
$ffi->load_custom_type('AI::TensorFlow::Libtensorflow::Lib::FFIType::TFPtrPtrLenSizeArrayRefScalar'
        => 'tf_attr_string_list'
);
$ffi->load_custom_type(PackableArrayRef('Int64ArrayRef', pack_type => 'q')
        => 'tf_attr_int_list'
);
$ffi->load_custom_type(PackableArrayRef('Float32ArrayRef', pack_type => 'f')
	=> 'tf_attr_float_list'
);
$ffi->load_custom_type(PackableArrayRef('BoolArrayRef', pack_type => 'C')
	=> 'tf_attr_bool_list',
);

$ffi->attach( [ 'NewOperation' => 'New' ] => [
	arg 'TF_Graph' => 'graph',
	arg 'string'   => 'op_type',
	arg 'string'   => 'oper_name',
] => 'TF_OperationDescription' => sub {
	my ($xs, $class, @rest) = @_;
	$xs->(@rest);
});

$ffi->attach( [ 'NewOperationLocked' => 'NewLocked' ] => [
	arg 'TF_Graph' => 'graph',
	arg 'string'   => 'op_type',
	arg 'string'   => 'oper_name',
] => 'TF_OperationDescription' );

$ffi->attach( 'SetDevice' => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'device',
] => 'void');

$ffi->attach( 'AddInput' => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'TF_Output' => 'input',
] => 'void');

$ffi->attach( AddInputList => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'TF_Output_struct_array' => 'inputs',
	arg 'int' => 'num_inputs',
] => 'void' => sub {
	my $xs = shift;
	$_[1]  = AI::TensorFlow::Libtensorflow::Output->_as_array( @{ $_[1] } );
	$_[2]  = $_[1]->count;
	$xs->(@_);
});

$ffi->attach( AddControlInput => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'TF_Operation' => 'input',
] => 'void');

$ffi->attach( ColocateWith => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'TF_Operation' => 'op',
] => 'void');

$ffi->attach( SetAttrString => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg tf_attr_string_buffer => [qw(value length)],
] => 'void');

$ffi->attach(SetAttrStringList => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_attr_string_list' => [qw(values lengths num_values)],
] => 'void');

$ffi->attach( SetAttrInt => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg int64_t  => 'value',
] => 'void');

$ffi->attach( SetAttrIntList => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_attr_int_list' => [qw(values num_values)],
] => 'void');

$ffi->attach( SetAttrFloat => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'float' => 'value',
] => 'void');

$ffi->attach(SetAttrFloatList => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_attr_float_list' => [qw(values num_values)],
] => 'void');

$ffi->attach( SetAttrBool => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'unsigned char' => 'value',
] => 'void');

$ffi->attach( SetAttrBoolList => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_attr_bool_list' => [qw(values num_values)],
] => 'void');

$ffi->attach(SetAttrType => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'TF_DataType' => 'value',
] => 'void');

$ffi->attach( SetAttrTypeList => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',

	# TODO
	arg 'opaque' => 'values',
	#arg 'TF_DataType*' => 'values',
	arg 'int' => 'num_values',
]);

$ffi->attach( SetAttrPlaceholder => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'string' => 'placeholder',
] => 'void');

$ffi->attach( SetAttrFuncName => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_attr_string_buffer' => [qw(value length)],
] => 'void');

$ffi->attach( SetAttrShape => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_dims_buffer' => [qw(dims num_dims)],
] => 'void');

$ffi->attach( SetAttrShapeList => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	# TODO
	arg 'opaque' => 'const int64_t* const* dims',
	arg 'opaque' => 'const int* num_dims',
	arg 'int'    => 'num_shapes',
]);

$ffi->attach(SetAttrTensorShapeProto => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_tensor_shape_proto_buffer' => [qw(proto proto_len)],
	arg 'TF_Status' => 'status',
] => 'void');

$ffi->attach( SetAttrTensorShapeProtoList => [
	# TODO
] => 'void');

$ffi->attach( SetAttrTensor => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'TF_Tensor' => 'value',
	arg 'TF_Status' => 'status',
] => 'void');

$ffi->attach( SetAttrTensorList => [
	# TODO
] => 'void');

$ffi->attach(SetAttrValueProto => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'string' => 'attr_name',
	arg 'tf_attr_value_proto_buffer' => [qw(proto proto_len)],
	arg 'TF_Status' => 'status',
] => 'void');

$ffi->attach(FinishOperation => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'TF_Status' => 'status',
] => 'TF_Operation');

$ffi->attach(FinishOperationLocked => [
	arg 'TF_OperationDescription' => 'desc',
	arg 'TF_Status' => 'status',
] => 'TF_Operation');

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

AI::TensorFlow::Libtensorflow::OperationDescription - Operation being built

=head1 CONSTRUCTORS

=head2 New

B<C API>: L<< C<TF_NewOperation>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_NewOperation >>

=head2 NewLocked

B<C API>: L<< C<TF_NewOperationLocked>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_NewOperationLocked >>

=head1 METHODS

=head2 SetDevice

B<C API>: L<< C<TF_SetDevice>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_SetDevice >>

=head2 AddInput

B<C API>: L<< C<TF_AddInput>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_AddInput >>

=head2 AddInputList

B<C API>: L<< C<TF_AddInputList>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_AddInputList >>

=head2 AddControlInput

B<C API>: L<< C<TF_AddControlInput>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_AddControlInput >>

=head2 ColocateWith

B<C API>: L<< C<TF_ColocateWith>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_ColocateWith >>

=head2 SetAttrString

B<C API>: L<< C<TF_SetAttrString>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_SetAttrString >>

=head2 SetAttrStringList

B<C API>: L<< C<TF_SetAttrStringList>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_SetAttrStringList >>

=head2 SetAttrInt

B<C API>: L<< C<TF_SetAttrInt>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_SetAttrInt >>



( run in 1.770 second using v1.01-cache-2.11-cpan-ceb78f64989 )