NAME
AI::TensorFlow::Libtensorflow::Buffer - Buffer that holds pointer to data with length
SYNOPSIS
use aliased 'AI::TensorFlow::Libtensorflow::Buffer' => 'Buffer';
DESCRIPTION
TFBuffer
is a data structure that stores a pointer to a block of data, the length of the data, and optionally a deallocator function for memory management.
This structure is typically used in libtensorflow
to store the data for a serialized protocol buffer.
CONSTRUCTORS
New
New()
my $buffer = Buffer->New();
ok $buffer, 'created an empty buffer';
is $buffer->length, 0, 'with a length of 0';
Create an empty buffer. Useful for passing as an output parameter.
Returns
- TFBuffer
-
Empty buffer.
C API: TF_NewBuffer
NewFromString
NewFromString( $proto )
Makes a copy of the input and sets an appropriate deallocator. Useful for passing in read-only, input protobufs.
my $data = 'bytes';
my $buffer = Buffer->NewFromString(\$data);
ok $buffer, 'create buffer from string';
is $buffer->length, bytes::length($data), 'same length as string';
Parameters
Returns
- TFBuffer
-
Contains a copy of the input data from
$proto
.
C API: TF_NewBufferFromString
ATTRIBUTES
data
An opaque
pointer to the buffer.
length
Length of the buffer as a size_t
.
data_deallocator
A CodeRef
for the deallocator.
DESTRUCTORS
DESTROY
C API: TF_DeleteBuffer
AUTHOR
Zakariyya Mughal <zmughal@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2022 by Auto-Parallel Technologies, Inc.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004