Code clean, fix indent and remove unnecessary space.
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
/**
* @brief mxnet class constructor.
*/
-
TensorFilterMXNet::TensorFilterMXNet ()
: tensor_filter_subplugin (), empty_model_ (true), ctx_ (Context::cpu ()),
enable_tensorrt_ (false)
static GstFlowReturn gst_tensor_src_tizensensor_fill (GstBaseSrc * src,
guint64 offset, guint size, GstBuffer * buf);
-/** internal functions */
-
#define gst_tensor_src_tizensensor_parent_class parent_class
G_DEFINE_TYPE (GstTensorSrcTIZENSENSOR, gst_tensor_src_tizensensor,
GST_TYPE_BASE_SRC);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-
/**
* @brief start function
* @details This is called when state changed null to ready.
}
/* 2. Do not timestamp. Let BaseSrc timestamp */
-
nns_logd ("read sensor_data at %" GST_TIME_FORMAT,
GST_TIME_ARGS (event->timestamp * 1000));
#define DEFAULT_PROP_EPOCHS 1
/**
- * @brief Default string property value
+ * @brief Default string property value
*/
#define DEFAULT_STR_PROP_VALUE ""
/**
- * @brief Default string property value
+ * @brief Default string property value
*/
enum
{
/**
* @brief Refrain from heavy operations on float16
* @todo Remove this after applying SIMD or ORC
- * */
+ */
static void
refrain_from_heavy_op_on_float16 (gulong n)
{
* @brief set alignment that default allocator would align to
* @param alignment bytes of alignment
*/
-extern void gst_tensor_alloc_init (gsize alignment);
+extern void
+gst_tensor_alloc_init (gsize alignment);
/**
* @brief Parse memory and fill the tensor meta.
* @param[in] info GstTensorsInfo to be used in parsing buffer.
* @param[in] index Index of GstMemory to be returned.
* @return GstMemory if found, otherwise NULL (Caller should free returned memory using gst_memory_unref()).
-*/
+ */
extern GstMemory *
gst_tensor_buffer_get_nth_memory (GstBuffer * buffer, const GstTensorsInfo * info, const guint index);
* @param[in] memory GstMemory to append. This function will take ownership of this.
* @param[in] info GstTensorInfo of given @a memory.
* @return TRUE if successfully appended, otherwise FALSE.
-*/
+ */
extern gboolean
gst_tensor_buffer_append_memory (GstBuffer * buffer, GstMemory * memory, const GstTensorInfo * info);
/**
* @brief Allocate and initialize the extra info in given tensors info.
* @param[in,out] info GstTensorsInfo to be updated.
-*/
+ */
extern gboolean
gst_tensors_info_extra_create (GstTensorsInfo * info);
/**
* @brief Free allocated extra info in given tensors info.
* @param[in,out] info GstTensorsInfo to be updated
-*/
+ */
extern void
gst_tensors_info_extra_free (GstTensorsInfo * info);
return caps;
}
-
/**
* @brief Get tensor caps from tensors config
* @param config tensors config info
/**
* @brief Data structure to describe a "extra" tensor data.
* This represents the information of the NNS_TENSOR_SIZE_LIMIT-th memory block for tensor stream.
-*/
+ */
typedef struct
{
uint32_t magic;
* @brief Check if given @a mem has extra tensors.
* @param[in] mem GstMemory to be checked.
* @return TRUE if @mem has extra tensors, otherwise FALSE.
-*/
+ */
static gboolean
gst_tensor_is_extra_memory (GstMemory * mem)
{
* @brief Initialize GstTensorExtraInfo structure with given @a memory.
* @param[in/out] extra GstTensorExtraInfo to be initialized.
* @param[in] memory The information of given memory is used to initialize @a extra.
-*/
+ */
static void
gst_tensor_extra_info_init (GstTensorExtraInfo * extra, GstMemory * memory)
{
* @param[in] info GstTensorsInfo to be used in parsing buffer.
* @param[in] index Index of GstMemory to be returned.
* @return GstMemory if found, otherwise NULL (Caller should free returned memory using gst_memory_unref()).
-*/
+ */
GstMemory *
gst_tensor_buffer_get_nth_memory (GstBuffer * buffer,
const GstTensorsInfo * info, const guint index)
* @param[in] memory GstMemory to append. This function will take ownership of this.
* @param[in] info GstTensorInfo of given @a memory.
* @return TRUE if successfully appended, otherwise FALSE.
-*/
+ */
gboolean
gst_tensor_buffer_append_memory (GstBuffer * buffer, GstMemory * memory,
const GstTensorInfo * info)
/**
* @brief Allocate and initialize the extra info in given tensors info.
* @param[in,out] info tensors info to be updated.
-*/
+ */
gboolean
gst_tensors_info_extra_create (GstTensorsInfo * info)
{
break;
}
-
/** @todo update meta info for each version */
return gst_tensor_meta_info_validate (meta);
}
}
}
-
/**
* @brief Track estimated latency and notify pipeline when it changes.
* Latency estimates may be a bit jittery. On the principle we want to
* However, according to gstreamer doxygen entry, if filter is given, that's not to be ignored.
* For now, we assume that if caps-size is 0, filter is "ANY".
*/
-
intersection =
gst_caps_intersect_full (result, filter, GST_CAPS_INTERSECT_FIRST);
/**
* To get the out-caps, GstTensorFilter has to parse tensor info from NN model.
*/
-
result = gst_tensor_filter_transform_caps (trans, direction, caps, othercaps);
gst_caps_unref (othercaps);
result = gst_caps_make_writable (result);
gchar *filename = g_build_path ("/", dir, "nnstreamer.ini", NULL);
const gchar *extra_conf = "/opt/usr/vd/product.ini";
gchar *confenv = g_strdup (g_getenv ("NNSTREAMER_CONF"));
- ;
FILE *fp = g_fopen (filename, "w");
ASSERT_TRUE (fp != NULL);
/* state chagne failure is expected */
EXPECT_NE (setPipelineStateSync (pipeline, GST_STATE_PLAYING, UNITTEST_STATECHANGE_TIMEOUT), 0);
-
gst_object_unref (pipeline);
}
/* double close */
sp->close (&prop, &data);
- ;
}
g_free (pipeline);
}
-
/**
* @brief Test for invalid properties of tensor_if
*/
g_free (content1);
g_free (content2);
-
/* False action result */
EXPECT_TRUE (g_file_get_contents ("./gamut.golden", &content1, &len1, NULL));
_wait_pipeline_save_files (tmp_false, content2, len2, len1, TEST_TIMEOUT_MS);
"tif.src_0 ! queue ! tensor_sink name=sink_true async=false "
"tif.src_1 ! queue ! tensor_sink name=sink_false async=false");
-
GstElement *pipeline = gst_parse_launch (str_pipeline, NULL);
EXPECT_NE (pipeline, nullptr);
EXPECT_NE (0, nnstreamer_if_custom_unregister ("tifx"));
}
-
/**
* @brief Main GTest
*/
#include <string.h>
#include <nnstreamer_conf.h>
+#include <tensor_filter_custom_easy.h>
#include <unittest_util.h>
#include "nnstreamer_plugin_api_filter.h"
#include "tensor_common.h"
_free_test_data (option);
}
-
/**
* @brief Test for flexible tensors with tensor_mux (nego failure).
*/
_free_test_data (option);
}
-#include <tensor_filter_custom_easy.h>
-
/**
* @brief In-Code Test Function for custom-easy filter
*/
}
}
-
try {
ret = RUN_ALL_TESTS ();
} catch (...) {
return file_path;
}
-
/**
* @brief Model training test using mnist.data (MNIST Test), model.bin is
* created.
* of training samples and validation smaples. number of samples received for
* model training is (num-training-samples + num-validation-samples) * epochs
*/
-
TEST (tensor_trainer, SetParams)
{
gchar *file_path = NULL;
pipeline = g_strdup_printf ("tensor_src_tizensensor type=SENSOR_HRM_LED_GREEN ! tensor_sink");
pipe = gst_parse_launch (pipeline, &err);
- if (pipe) {
+ if (err) {
+ failed = TRUE;
+ } else if (pipe) {
ret = gst_element_set_state (pipe, GST_STATE_PAUSED);
failed = (ret == GST_STATE_CHANGE_FAILURE);
gst_object_unref (pipe);