@Namespace(value="tensorflow::ops") @NoOffset public static class tensorflow.Substr extends Pointer
Tensor of strings.
For each string in the input Tensor, creates a substring starting at index
pos with a total length of len.
If len defines a substring that would extend beyond the length of the input
string, then as many characters as possible are used.
A negative pos indicates distance within the string backwards from the end.
If pos specifies an index which is out of range for any of the input strings,
then an InvalidArgumentError is thrown.
pos and len must have the same shape, otherwise a ValueError is thrown on
Op creation.
*NOTE*: Substr supports broadcasting up to two dimensions. More about
broadcasting
[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
---
Examples
Using scalar pos and len:
python
input = [b'Hello', b'World']
position = 1
length = 3
output = [b'ell', b'orl']
Using pos and len with same shape as input:
python
input = [[b'ten', b'eleven', b'twelve'],
[b'thirteen', b'fourteen', b'fifteen'],
[b'sixteen', b'seventeen', b'eighteen']]
position = [[1, 2, 3],
[1, 2, 3],
[1, 2, 3]]
length = [[2, 3, 4],
[4, 3, 2],
[5, 5, 5]]
output = [[b'en', b'eve', b'lve'],
[b'hirt', b'urt', b'te'],
[b'ixtee', b'vente', b'hteen']]
Broadcasting pos and len onto input:
input = [[b'ten', b'eleven', b'twelve'],
[b'thirteen', b'fourteen', b'fifteen'],
[b'sixteen', b'seventeen', b'eighteen'],
[b'nineteen', b'twenty', b'twentyone']]
position = [1, 2, 3]
length = [1, 2, 3]
output = [[b'e', b'ev', b'lve'],
[b'h', b'ur', b'tee'],
[b'i', b've', b'hte'],
[b'i', b'en', b'nty']]
Broadcasting input onto pos and len:
input = b'thirteen'
position = [1, 5, 7]
length = [3, 2, 1]
output = [b'hir', b'ee', b'n']
Arguments:
* scope: A Scope object
* input: Tensor of strings
* pos: Scalar defining the position of first character in each substring
* len: Scalar defining the number of characters to include in each substring
Returns:
* Output: Tensor of substringsPointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator| Constructor and Description |
|---|
Substr(Pointer p)
Pointer cast constructor.
|
Substr(tensorflow.Scope scope,
tensorflow.Input input,
tensorflow.Input pos,
tensorflow.Input len) |
| Modifier and Type | Method and Description |
|---|---|
tensorflow.Input |
asInput() |
tensorflow.Output |
asOutput() |
tensorflow.Node |
node() |
tensorflow.Operation |
operation() |
tensorflow.Substr |
operation(tensorflow.Operation operation) |
tensorflow.Output |
output() |
tensorflow.Substr |
output(tensorflow.Output output) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, position, put, realloc, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic Substr(Pointer p)
Pointer.Pointer(Pointer).public Substr(@Const @ByRef tensorflow.Scope scope, @ByVal tensorflow.Input input, @ByVal tensorflow.Input pos, @ByVal tensorflow.Input len)
@ByVal @Name(value="operator tensorflow::Output") public tensorflow.Output asOutput()
@ByVal @Name(value="operator tensorflow::Input") public tensorflow.Input asInput()
public tensorflow.Node node()
@ByRef public tensorflow.Operation operation()
public tensorflow.Substr operation(tensorflow.Operation operation)
@ByRef public tensorflow.Output output()
public tensorflow.Substr output(tensorflow.Output output)
Copyright © 2019. All rights reserved.