AI-TensorFlow-Libtensorflow
view release on metacpan or search on metacpan
lib/AI/TensorFlow/Libtensorflow/Output.pm view on Meta::CPAN
$class->_copy_to_other( $_[$idx], $output->[$idx] );
}
$output;
}
sub _from_array {
my ($class, $array) = @_;
[
map {
my $record = $class->new;
$class->_copy_to_other($array->[$_], $record);
$record;
} 0..$array->count-1
]
}
sub _copy_to_other {
my ($class, $this, $that) = @_;
$that->_oper ($this->_oper);
$that->_index($this->_index);
}
$ffi->load_custom_type(
RecordArrayRef( 'OutputArrayPtr',
record_module => __PACKAGE__, with_size => 0,
),
=> 'TF_Output_array');
$ffi->load_custom_type(
RecordArrayRef( 'OutputArrayPtrSz',
record_module => __PACKAGE__, with_size => 1,
),
=> 'TF_Output_array_sz');
use overload
'""' => \&_op_stringify;
sub _op_stringify {
join ":", (
( defined $_[0]->_oper ? $_[0]->oper->Name : '<undefined operation>' ),
( defined $_[0]->index ? $_[0]->index : '<no index>' )
);
}
sub _data_printer {
my ($self, $ddp) = @_;
my %data = (
oper => $self->oper,
index => $self->index,
);
return sprintf('%s %s',
$ddp->maybe_colorize(ref $self, 'class' ),
$ddp->parse(\%data) );
};
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
AI::TensorFlow::Libtensorflow::Output - Output of operation as (operation, index) pair
=head1 AUTHOR
Zakariyya Mughal <zmughal@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2022-2023 by Auto-Parallel Technologies, Inc.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
=cut
( run in 0.947 second using v1.01-cache-2.11-cpan-0c5ce583b80 )