AI-TensorFlow-Libtensorflow
view release on metacpan or search on metacpan
lib/AI/TensorFlow/Libtensorflow/Manual/Notebook/InferenceUsingTFHubEnformerGeneExprPredModel.pod view on Meta::CPAN
$SHOW_ENCODER = 0;
say "One-hot encoding of sequence '$onehot_test_seq' is:";
say $test_encoded->info, $test_encoded;
}
package Interval {
use Bio::Location::Simple ();
use parent qw(Bio::Location::Simple);
sub center {
my $self = shift;
my $center = int( ($self->start + $self->end ) / 2 );
my $delta = ($self->start + $self->end ) % 2;
return $center + $delta;
}
sub resize {
my ($self, $width) = @_;
lib/AI/TensorFlow/Libtensorflow/Manual/Notebook/InferenceUsingTFHubEnformerGeneExprPredModel.pod view on Meta::CPAN
second dimension is the sequence length which matches the penultimate dimension of the input C<TFTensor>.
=back
Now we need a way to deal with the sequence interval. We're going to use 1-based coordinates as BioPerl does. In fact, we'll extend a BioPerl class.
package Interval {
use Bio::Location::Simple ();
use parent qw(Bio::Location::Simple);
sub center {
my $self = shift;
my $center = int( ($self->start + $self->end ) / 2 );
my $delta = ($self->start + $self->end ) % 2;
return $center + $delta;
}
sub resize {
my ($self, $width) = @_;
lib/AI/TensorFlow/Libtensorflow/Manual/Notebook/InferenceUsingTFHubEnformerGeneExprPredModel.pod view on Meta::CPAN
requires 'PDL';
requires 'PDL::Graphics::Gnuplot';
requires 'Path::Tiny';
requires 'Syntax::Construct';
requires 'Text::Table::Tiny';
requires 'URI';
requires 'constant';
requires 'feature';
requires 'lib::projectroot';
requires 'overload';
requires 'parent';
requires 'strict';
requires 'utf8';
requires 'warnings';
=head1 AUTHOR
Zakariyya Mughal <zmughal@cpan.org>
=head1 COPYRIGHT AND LICENSE
maint/inc/Pod/Elemental/Transformer/TF_CAPI.pm view on Meta::CPAN
sub __is_xformable {
my ($self, $para) = @_;
return unless $para->isa('Pod::Elemental::Element::Pod5::Command')
and exists $command_dispatch->{ $para->command };
return 1;
}
sub _expand {
my ($self, $parent) = @_;
$command_dispatch->{ $parent->command }->( @_ );
};
sub _expand_version {
my ($self, $parent) = @_;
my @replacements;
my $content = $parent->content;
die "Not a version string: $content"
unless $content =~ /\A v [0-9.]+ \Z/x;
push @replacements, Pod::Elemental::Element::Pod5::Ordinary->new(
content => 'C<libtensorflow> version: ' . $content
);
return @replacements;
}
sub _expand_capi {
my ($self, $parent) = @_;
my @replacements;
my $content = $parent->content;
my @ids = split /,\s*/, $content;
my $doc_name = 'AI::TensorFlow::Libtensorflow::Manual::CAPI';
my $new_content = "B<C API>: "
. join ", ", map {
die "$_ does not look like a TensorFlow identifier" unless /^TF[E]?_\w+$/;
"L<< C<$_>|$doc_name/$_ >>"
} @ids;
push @replacements, Pod::Elemental::Element::Pod5::Ordinary->new(
maint/process-capi.pl view on Meta::CPAN
TF_StartThread
TF_NewKernelBuilder
TFE_NewTensorHandleFromDeviceMemory
);
for my $data (@$data) {
my ($func_name) = $data->{fdecl} =~ m/ \A [^(]*? (\w+) \s* \( (?!\s*\*) /xs;
die "Could not extract function name" unless $func_name;
# defensive assertion for parsing
my $paren_count = () = $data->{fdecl} =~ /[\(]/sg;
warn "Got $func_name, but more than one open parenthesis [(] in\n@{[ $data->{fdecl} =~ s/^/ /gr ]}\n"
if(
$paren_count != 1
&& !(
$data->{fdecl} =~ /^ TF_CAPI_EXPORT \s+ extern \s+ void \s+ \Q@{[ $func_name ]}\E \s* \(/xs
||
exists $TF_func_ptr{$func_name}
)
);
$data->{func_name} = $func_name;
maint/process-capi.pl view on Meta::CPAN
=head1 SEE ALSO
L<https://github.com/tensorflow/tensorflow/tree/master/tensorflow/c>
=cut
EOF
my $output = $self->lib_path->child(module_notional_filename($doc_name) =~ s/\.pm$/.pod/r );
$output->parent->mkpath;
$output->spew_utf8($pod);
}
lazy typedef_struct_data => method() {
my $re = qr{
(?<opaque>
^
typedef \s+
struct \s+
(?<name>\w+) \s+
\k<name> \s*
;
)
|
(?<transparent>
^
typedef \s+
struct \s+
(?<name>\w+) \s+
\{
[^\}]+
\} \s+
\k<name> \s*
;
)
maint/process-notebook.pl view on Meta::CPAN
if [ -t 0 ]; then
perldoc $DST;
fi
## Check and run script in the directory of the original (e.g., to get data
## files).
perl -c $DST
#&& perl -MCwd -MPath::Tiny -E '
#my $nb = path(shift @ARGV);
#my $script = path(shift @ARGV)->absolute;
#chdir $nb->parent;
#do $script;
#' $SRC $DST
BASH
}
sub main {
run_notebook('notebook/InferenceUsingTFHubMobileNetV2Model.ipynb');
run_notebook('notebook/InferenceUsingTFHubEnformerGeneExprPredModel.ipynb');
( run in 0.346 second using v1.01-cache-2.11-cpan-4d50c553e7e )