Home | History | Annotate | Download | only in native
      1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
      2 
      3 Licensed under the Apache License, Version 2.0 (the "License");
      4 you may not use this file except in compliance with the License.
      5 You may obtain a copy of the License at
      6 
      7     http://www.apache.org/licenses/LICENSE-2.0
      8 
      9 Unless required by applicable law or agreed to in writing, software
     10 distributed under the License is distributed on an "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 See the License for the specific language governing permissions and
     13 limitations under the License.
     14 ==============================================================================*/
     15 
     16 #ifndef TENSORFLOW_JAVA_TENSOR_JNI_H_
     17 #define TENSORFLOW_JAVA_TENSOR_JNI_H_
     18 
     19 #include <jni.h>
     20 
     21 #ifdef __cplusplus
     22 extern "C" {
     23 #endif
     24 
     25 /*
     26  * Class:     org_tensorflow_Tensor
     27  * Method:    allocate
     28  * Signature: (I[JJ)J
     29  */
     30 JNIEXPORT jlong JNICALL Java_org_tensorflow_Tensor_allocate(JNIEnv *, jclass,
     31                                                             jint, jlongArray,
     32                                                             jlong);
     33 
     34 /*
     35  * Class:     org_tensorflow_Tensor
     36  * Method:    allocateScalarBytes
     37  * Signature: ([B)J
     38  */
     39 JNIEXPORT jlong JNICALL
     40 Java_org_tensorflow_Tensor_allocateScalarBytes(JNIEnv *, jclass, jbyteArray);
     41 
     42 /*
     43  * Class:     org_tensorflow_Tensor
     44  * Method:    allocateNonScalarBytes
     45  * Signature: ([J[Ljava/lang/Object;)J
     46  */
     47 JNIEXPORT jlong JNICALL Java_org_tensorflow_Tensor_allocateNonScalarBytes(
     48     JNIEnv *, jclass, jlongArray, jobjectArray);
     49 
     50 /*
     51  * Class:     org_tensorflow_Tensor
     52  * Method:    delete
     53  * Signature: (J)V
     54  */
     55 JNIEXPORT void JNICALL Java_org_tensorflow_Tensor_delete(JNIEnv *, jclass,
     56                                                          jlong);
     57 
     58 /*
     59  * Class:     org_tensorflow_Tensor
     60  * Method:    buffer
     61  * Signature: (J)Ljava/nio/ByteBuffer;
     62  */
     63 JNIEXPORT jobject JNICALL Java_org_tensorflow_Tensor_buffer(JNIEnv *, jclass,
     64                                                             jlong);
     65 
     66 /*
     67  * Class:     org_tensorflow_Tensor
     68  * Method:    dtype
     69  * Signature: (J)I
     70  */
     71 JNIEXPORT jint JNICALL Java_org_tensorflow_Tensor_dtype(JNIEnv *, jclass,
     72                                                         jlong);
     73 
     74 /*
     75  * Class:     org_tensorflow_Tensor
     76  * Method:    shape
     77  * Signature: (J)[J
     78  */
     79 JNIEXPORT jlongArray JNICALL Java_org_tensorflow_Tensor_shape(JNIEnv *, jclass,
     80                                                               jlong);
     81 
     82 /*
     83  * Class:     org_tensorflow_Tensor
     84  * Method:    setValue
     85  * Signature: (JLjava/lang/Object;)V
     86  *
     87  * REQUIRES: The jobject's type and shape are compatible the with the DataType
     88  * and shape of the Tensor referred to by the jlong handle.
     89  */
     90 JNIEXPORT void JNICALL Java_org_tensorflow_Tensor_setValue(JNIEnv *, jclass,
     91                                                            jlong, jobject);
     92 
     93 /*
     94  * Class:     org_tensorflow_Tensor
     95  * Method:    scalarFloat
     96  * Signature: (J)F
     97  *
     98  */
     99 JNIEXPORT jfloat JNICALL Java_org_tensorflow_Tensor_scalarFloat(JNIEnv *,
    100                                                                 jclass, jlong);
    101 
    102 /*
    103  * Class:     org_tensorflow_Tensor
    104  * Method:    scalarDouble
    105  * Signature: (J)D
    106  */
    107 JNIEXPORT jdouble JNICALL Java_org_tensorflow_Tensor_scalarDouble(JNIEnv *,
    108                                                                   jclass,
    109                                                                   jlong);
    110 
    111 /*
    112  * Class:     org_tensorflow_Tensor
    113  * Method:    scalarInt
    114  * Signature: (J)I
    115  */
    116 JNIEXPORT jint JNICALL Java_org_tensorflow_Tensor_scalarInt(JNIEnv *, jclass,
    117                                                             jlong);
    118 
    119 /*
    120  * Class:     org_tensorflow_Tensor
    121  * Method:    scalarLong
    122  * Signature: (J)J
    123  */
    124 JNIEXPORT jlong JNICALL Java_org_tensorflow_Tensor_scalarLong(JNIEnv *, jclass,
    125                                                               jlong);
    126 
    127 /*
    128  * Class:     org_tensorflow_Tensor
    129  * Method:    scalarBoolean
    130  * Signature: (J)Z
    131  */
    132 JNIEXPORT jboolean JNICALL Java_org_tensorflow_Tensor_scalarBoolean(JNIEnv *,
    133                                                                     jclass,
    134                                                                     jlong);
    135 
    136 /*
    137  * Class:     org_tensorflow_Tensor
    138  * Method:    scalarBytes
    139  * Signature: (J)[B
    140  */
    141 JNIEXPORT jbyteArray JNICALL Java_org_tensorflow_Tensor_scalarBytes(JNIEnv *,
    142                                                                     jclass,
    143                                                                     jlong);
    144 
    145 /*
    146  * Class:     org_tensorflow_Tensor
    147  * Method:    readNDArray
    148  * Signature: (JLjava/lang/Object;)V
    149  */
    150 JNIEXPORT void JNICALL Java_org_tensorflow_Tensor_readNDArray(JNIEnv *, jclass,
    151                                                               jlong, jobject);
    152 
    153 #ifdef __cplusplus
    154 }  // extern "C"
    155 #endif  // __cplusplus
    156 #endif  // TENSORFLOW_JAVA_TENSOR_JNI_H_
    157