Class TensorProto

  • All Implemented Interfaces:
    Serializable, org.nd4j.shade.protobuf.Message, org.nd4j.shade.protobuf.MessageLite, org.nd4j.shade.protobuf.MessageLiteOrBuilder, org.nd4j.shade.protobuf.MessageOrBuilder, TensorProtoOrBuilder

    public final class TensorProto
    extends org.nd4j.shade.protobuf.GeneratedMessageV3
    implements TensorProtoOrBuilder
     Protocol buffer representing a tensor.
     
    Protobuf type tensorflow.TensorProto
    See Also:
    Serialized Form
    • Method Detail

      • newInstance

        protected Object newInstance​(org.nd4j.shade.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getUnknownFields

        public final org.nd4j.shade.protobuf.UnknownFieldSet getUnknownFields()
        Specified by:
        getUnknownFields in interface org.nd4j.shade.protobuf.MessageOrBuilder
        Overrides:
        getUnknownFields in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getDescriptor

        public static final org.nd4j.shade.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected org.nd4j.shade.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getDtypeValue

        public int getDtypeValue()
        .tensorflow.DataType dtype = 1;
        Specified by:
        getDtypeValue in interface TensorProtoOrBuilder
        Returns:
        The enum numeric value on the wire for dtype.
      • hasTensorShape

        public boolean hasTensorShape()
         Shape of the tensor.  TODO(touts): sort out the 0-rank issues.
         
        .tensorflow.TensorShapeProto tensor_shape = 2;
        Specified by:
        hasTensorShape in interface TensorProtoOrBuilder
        Returns:
        Whether the tensorShape field is set.
      • getTensorShape

        public TensorShapeProto getTensorShape()
         Shape of the tensor.  TODO(touts): sort out the 0-rank issues.
         
        .tensorflow.TensorShapeProto tensor_shape = 2;
        Specified by:
        getTensorShape in interface TensorProtoOrBuilder
        Returns:
        The tensorShape.
      • getVersionNumber

        public int getVersionNumber()
         Version number.
         In version 0, if the "repeated xxx" representations contain only one
         element, that element is repeated to fill the shape.  This makes it easy
         to represent a constant Tensor with a single value.
         
        int32 version_number = 3;
        Specified by:
        getVersionNumber in interface TensorProtoOrBuilder
        Returns:
        The versionNumber.
      • getTensorContent

        public org.nd4j.shade.protobuf.ByteString getTensorContent()
         Serialized raw tensor content from either Tensor::AsProtoTensorContent or
         memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation
         can be used for all tensor types. The purpose of this representation is to
         reduce serialization overhead during RPC call by avoiding serialization of
         many repeated small items.
         
        bytes tensor_content = 4;
        Specified by:
        getTensorContent in interface TensorProtoOrBuilder
        Returns:
        The tensorContent.
      • getHalfValList

        public List<Integer> getHalfValList()
         DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll
         have some pointless zero padding for each value here.
         
        repeated int32 half_val = 13 [packed = true];
        Specified by:
        getHalfValList in interface TensorProtoOrBuilder
        Returns:
        A list containing the halfVal.
      • getHalfValCount

        public int getHalfValCount()
         DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll
         have some pointless zero padding for each value here.
         
        repeated int32 half_val = 13 [packed = true];
        Specified by:
        getHalfValCount in interface TensorProtoOrBuilder
        Returns:
        The count of halfVal.
      • getHalfVal

        public int getHalfVal​(int index)
         DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll
         have some pointless zero padding for each value here.
         
        repeated int32 half_val = 13 [packed = true];
        Specified by:
        getHalfVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The halfVal at the given index.
      • getFloatValCount

        public int getFloatValCount()
         DT_FLOAT.
         
        repeated float float_val = 5 [packed = true];
        Specified by:
        getFloatValCount in interface TensorProtoOrBuilder
        Returns:
        The count of floatVal.
      • getFloatVal

        public float getFloatVal​(int index)
         DT_FLOAT.
         
        repeated float float_val = 5 [packed = true];
        Specified by:
        getFloatVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The floatVal at the given index.
      • getDoubleValCount

        public int getDoubleValCount()
         DT_DOUBLE.
         
        repeated double double_val = 6 [packed = true];
        Specified by:
        getDoubleValCount in interface TensorProtoOrBuilder
        Returns:
        The count of doubleVal.
      • getDoubleVal

        public double getDoubleVal​(int index)
         DT_DOUBLE.
         
        repeated double double_val = 6 [packed = true];
        Specified by:
        getDoubleVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The doubleVal at the given index.
      • getIntValList

        public List<Integer> getIntValList()
         DT_INT32, DT_INT16, DT_INT8, DT_UINT8.
         
        repeated int32 int_val = 7 [packed = true];
        Specified by:
        getIntValList in interface TensorProtoOrBuilder
        Returns:
        A list containing the intVal.
      • getIntValCount

        public int getIntValCount()
         DT_INT32, DT_INT16, DT_INT8, DT_UINT8.
         
        repeated int32 int_val = 7 [packed = true];
        Specified by:
        getIntValCount in interface TensorProtoOrBuilder
        Returns:
        The count of intVal.
      • getIntVal

        public int getIntVal​(int index)
         DT_INT32, DT_INT16, DT_INT8, DT_UINT8.
         
        repeated int32 int_val = 7 [packed = true];
        Specified by:
        getIntVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The intVal at the given index.
      • getStringValList

        public List<org.nd4j.shade.protobuf.ByteString> getStringValList()
         DT_STRING
         
        repeated bytes string_val = 8;
        Specified by:
        getStringValList in interface TensorProtoOrBuilder
        Returns:
        A list containing the stringVal.
      • getStringValCount

        public int getStringValCount()
         DT_STRING
         
        repeated bytes string_val = 8;
        Specified by:
        getStringValCount in interface TensorProtoOrBuilder
        Returns:
        The count of stringVal.
      • getStringVal

        public org.nd4j.shade.protobuf.ByteString getStringVal​(int index)
         DT_STRING
         
        repeated bytes string_val = 8;
        Specified by:
        getStringVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The stringVal at the given index.
      • getScomplexValList

        public List<Float> getScomplexValList()
         DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real
         and imaginary parts of i-th single precision complex.
         
        repeated float scomplex_val = 9 [packed = true];
        Specified by:
        getScomplexValList in interface TensorProtoOrBuilder
        Returns:
        A list containing the scomplexVal.
      • getScomplexValCount

        public int getScomplexValCount()
         DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real
         and imaginary parts of i-th single precision complex.
         
        repeated float scomplex_val = 9 [packed = true];
        Specified by:
        getScomplexValCount in interface TensorProtoOrBuilder
        Returns:
        The count of scomplexVal.
      • getScomplexVal

        public float getScomplexVal​(int index)
         DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real
         and imaginary parts of i-th single precision complex.
         
        repeated float scomplex_val = 9 [packed = true];
        Specified by:
        getScomplexVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The scomplexVal at the given index.
      • getInt64ValList

        public List<Long> getInt64ValList()
         DT_INT64
         
        repeated int64 int64_val = 10 [packed = true];
        Specified by:
        getInt64ValList in interface TensorProtoOrBuilder
        Returns:
        A list containing the int64Val.
      • getInt64ValCount

        public int getInt64ValCount()
         DT_INT64
         
        repeated int64 int64_val = 10 [packed = true];
        Specified by:
        getInt64ValCount in interface TensorProtoOrBuilder
        Returns:
        The count of int64Val.
      • getInt64Val

        public long getInt64Val​(int index)
         DT_INT64
         
        repeated int64 int64_val = 10 [packed = true];
        Specified by:
        getInt64Val in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The int64Val at the given index.
      • getBoolValCount

        public int getBoolValCount()
         DT_BOOL
         
        repeated bool bool_val = 11 [packed = true];
        Specified by:
        getBoolValCount in interface TensorProtoOrBuilder
        Returns:
        The count of boolVal.
      • getBoolVal

        public boolean getBoolVal​(int index)
         DT_BOOL
         
        repeated bool bool_val = 11 [packed = true];
        Specified by:
        getBoolVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The boolVal at the given index.
      • getDcomplexValList

        public List<Double> getDcomplexValList()
         DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real
         and imaginary parts of i-th double precision complex.
         
        repeated double dcomplex_val = 12 [packed = true];
        Specified by:
        getDcomplexValList in interface TensorProtoOrBuilder
        Returns:
        A list containing the dcomplexVal.
      • getDcomplexValCount

        public int getDcomplexValCount()
         DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real
         and imaginary parts of i-th double precision complex.
         
        repeated double dcomplex_val = 12 [packed = true];
        Specified by:
        getDcomplexValCount in interface TensorProtoOrBuilder
        Returns:
        The count of dcomplexVal.
      • getDcomplexVal

        public double getDcomplexVal​(int index)
         DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real
         and imaginary parts of i-th double precision complex.
         
        repeated double dcomplex_val = 12 [packed = true];
        Specified by:
        getDcomplexVal in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The dcomplexVal at the given index.
      • getVariantValCount

        public int getVariantValCount()
         DT_VARIANT
         
        repeated .tensorflow.VariantTensorDataProto variant_val = 15;
        Specified by:
        getVariantValCount in interface TensorProtoOrBuilder
      • getUint32ValCount

        public int getUint32ValCount()
         DT_UINT32
         
        repeated uint32 uint32_val = 16 [packed = true];
        Specified by:
        getUint32ValCount in interface TensorProtoOrBuilder
        Returns:
        The count of uint32Val.
      • getUint32Val

        public int getUint32Val​(int index)
         DT_UINT32
         
        repeated uint32 uint32_val = 16 [packed = true];
        Specified by:
        getUint32Val in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The uint32Val at the given index.
      • getUint64ValList

        public List<Long> getUint64ValList()
         DT_UINT64
         
        repeated uint64 uint64_val = 17 [packed = true];
        Specified by:
        getUint64ValList in interface TensorProtoOrBuilder
        Returns:
        A list containing the uint64Val.
      • getUint64ValCount

        public int getUint64ValCount()
         DT_UINT64
         
        repeated uint64 uint64_val = 17 [packed = true];
        Specified by:
        getUint64ValCount in interface TensorProtoOrBuilder
        Returns:
        The count of uint64Val.
      • getUint64Val

        public long getUint64Val​(int index)
         DT_UINT64
         
        repeated uint64 uint64_val = 17 [packed = true];
        Specified by:
        getUint64Val in interface TensorProtoOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The uint64Val at the given index.
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface org.nd4j.shade.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(org.nd4j.shade.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface org.nd4j.shade.protobuf.MessageLite
        Overrides:
        writeTo in class org.nd4j.shade.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface org.nd4j.shade.protobuf.MessageLite
        Overrides:
        getSerializedSize in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface org.nd4j.shade.protobuf.Message
        Overrides:
        equals in class org.nd4j.shade.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface org.nd4j.shade.protobuf.Message
        Overrides:
        hashCode in class org.nd4j.shade.protobuf.AbstractMessage
      • parseFrom

        public static TensorProto parseFrom​(ByteBuffer data)
                                     throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TensorProto parseFrom​(ByteBuffer data,
                                            org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                     throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TensorProto parseFrom​(org.nd4j.shade.protobuf.ByteString data)
                                     throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TensorProto parseFrom​(org.nd4j.shade.protobuf.ByteString data,
                                            org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                     throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TensorProto parseFrom​(byte[] data)
                                     throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TensorProto parseFrom​(byte[] data,
                                            org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                     throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TensorProto parseFrom​(org.nd4j.shade.protobuf.CodedInputStream input,
                                            org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                     throws IOException
        Throws:
        IOException
      • newBuilderForType

        public TensorProto.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface org.nd4j.shade.protobuf.Message
        Specified by:
        newBuilderForType in interface org.nd4j.shade.protobuf.MessageLite
      • toBuilder

        public TensorProto.Builder toBuilder()
        Specified by:
        toBuilder in interface org.nd4j.shade.protobuf.Message
        Specified by:
        toBuilder in interface org.nd4j.shade.protobuf.MessageLite
      • newBuilderForType

        protected TensorProto.Builder newBuilderForType​(org.nd4j.shade.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getDefaultInstance

        public static TensorProto getDefaultInstance()
      • parser

        public static org.nd4j.shade.protobuf.Parser<TensorProto> parser()
      • getParserForType

        public org.nd4j.shade.protobuf.Parser<TensorProto> getParserForType()
        Specified by:
        getParserForType in interface org.nd4j.shade.protobuf.Message
        Specified by:
        getParserForType in interface org.nd4j.shade.protobuf.MessageLite
        Overrides:
        getParserForType in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public TensorProto getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface org.nd4j.shade.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface org.nd4j.shade.protobuf.MessageOrBuilder