1. update condition to check the given params.
2. update api description about ml model.
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
* NNStreamer is a set of GStreamer plugins that allow GStreamer developers to adopt neural network models easily and efficiently
* and neural network developers to manage stream pipelines and their filters easily and efficiently.<br>
* <br>
+ * Note that, to open a machine learning model in the storage,
+ * the permission <code>Manifest.permission.READ_EXTERNAL_STORAGE</code> is required before constructing the pipeline.
+ * <br>
* See <a href="https://github.com/nnsuite/nnstreamer">https://github.com/nnsuite/nnstreamer</a> for the details.
*/
public final class NNStreamer {
* @throws IllegalStateException if failed to construct the pipeline
*/
public SingleShot(@NonNull File model, @Nullable TensorsInfo in, @Nullable TensorsInfo out) {
- if (model == null) {
- throw new IllegalArgumentException("The param model is null");
+ if (model == null || !model.exists()) {
+ throw new IllegalArgumentException("The param model is invalid");
}
String path = model.getAbsolutePath();
* @return The new byte buffer
*/
public static ByteBuffer allocateByteBuffer(int size) {
- ByteBuffer buffer = ByteBuffer.allocateDirect(size);
-
- buffer.order(ByteOrder.nativeOrder());
+ if (size <= 0) {
+ throw new IllegalArgumentException("The param size is invalid");
+ }
- return buffer;
+ return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder());
}
/**