未验证 提交 54a04cbe 编写于 作者: T TFLM-bot 提交者: GitHub

Automated sync from github.com/tensorflow/tensorflow (#214)

上级 7c605afa
......@@ -497,6 +497,11 @@ typedef struct {
TfLiteType value_dtype;
} TfLiteHashtableParams;
typedef struct {
const char* container;
const char* shared_name;
} TfLiteVarHandleParams;
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
......
......@@ -793,6 +793,19 @@ TfLiteStatus ParseOpDataTfLite(const Operator* op, BuiltinOperator op_type,
*builtin_data = params.release();
return kTfLiteOk;
}
case BuiltinOperator_VAR_HANDLE: {
auto params = safe_allocator.Allocate<TfLiteVarHandleParams>();
TF_LITE_ENSURE(error_reporter, params != nullptr);
params->container = nullptr;
params->shared_name = nullptr;
if (const auto* var_handle_params =
op->builtin_options_as_VarHandleOptions()) {
params->container = var_handle_params->container()->c_str();
params->shared_name = var_handle_params->shared_name()->c_str();
}
*builtin_data = params.release();
return kTfLiteOk;
}
// Below are the ops with no builtin_data structure.
// TODO(aselle): Implement call in BuiltinOptions, but nullptrs are
// ok for now, since there is no call implementation either.
......@@ -829,6 +842,8 @@ TfLiteStatus ParseOpDataTfLite(const Operator* op, BuiltinOperator op_type,
case BuiltinOperator_HASHTABLE_FIND:
case BuiltinOperator_HASHTABLE_IMPORT:
case BuiltinOperator_HASHTABLE_SIZE:
case BuiltinOperator_READ_VARIABLE:
case BuiltinOperator_ASSIGN_VARIABLE:
return kTfLiteOk;
case BuiltinOperator_PLACEHOLDER_FOR_GREATER_OP_CODES:
return kTfLiteError;
......
......@@ -15,6 +15,8 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPACE_TO_DEPTH_H_
#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPACE_TO_DEPTH_H_
#include <cstdint>
#include "tensorflow/lite/kernels/internal/types.h"
namespace tflite {
......
......@@ -438,6 +438,10 @@ TfLiteStatus CalculateShapeForBroadcast(TfLiteContext* context,
*output_shape = TfLiteIntArrayCopy(input1->dims);
return kTfLiteOk;
}
if (NumElements(input2) == 0) {
*output_shape = TfLiteIntArrayCopy(input2->dims);
return kTfLiteOk;
}
std::unique_ptr<TfLiteIntArray, void (*)(TfLiteIntArray*)> shape(
TfLiteIntArrayCreate(out_dims), TfLiteIntArrayFree);
for (int i = 0; i < out_dims; ++i) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册