Update the checks in (bidi/uni) lstm to use nullptr.

PiperOrigin-RevId: 225844636
This commit is contained in:
Jian Li 2018-12-17 10:05:05 -08:00 committed by TensorFlower Gardener
parent 9fd8253129
commit fa7b38a5ea
2 changed files with 14 additions and 14 deletions

View File

@ -182,7 +182,7 @@ TfLiteStatus CheckLstmTensorDimensionsAndTypes(
const TfLiteTensor* input_to_input_weights =
GetOptionalInputTensor(context, node, input_to_input_weights_tensor);
if (input_to_input_weights) {
if (input_to_input_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, input_to_input_weights->dims->size, 2);
TF_LITE_ENSURE_EQ(context, input_to_input_weights->dims->data[0], n_cell);
TF_LITE_ENSURE_EQ(context, input_to_input_weights->dims->data[1], n_input);
@ -208,7 +208,7 @@ TfLiteStatus CheckLstmTensorDimensionsAndTypes(
const TfLiteTensor* recurrent_to_input_weights =
GetOptionalInputTensor(context, node, recurrent_to_input_weights_tensor);
if (recurrent_to_input_weights) {
if (recurrent_to_input_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, recurrent_to_input_weights->dims->size, 2);
TF_LITE_ENSURE_EQ(context, recurrent_to_input_weights->dims->data[0],
n_cell);
@ -248,7 +248,7 @@ TfLiteStatus CheckLstmTensorDimensionsAndTypes(
const TfLiteTensor* cell_to_input_weights =
GetOptionalInputTensor(context, node, cell_to_input_weights_tensor);
if (cell_to_input_weights) {
if (cell_to_input_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, cell_to_input_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_input_weights->dims->data[0], n_cell);
TF_LITE_ENSURE_EQ(context, cell_to_input_weights->type,
@ -257,7 +257,7 @@ TfLiteStatus CheckLstmTensorDimensionsAndTypes(
const TfLiteTensor* cell_to_forget_weights =
GetOptionalInputTensor(context, node, cell_to_forget_weights_tensor);
if (cell_to_forget_weights) {
if (cell_to_forget_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, cell_to_forget_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_forget_weights->dims->data[0], n_cell);
TF_LITE_ENSURE_EQ(context, cell_to_forget_weights->type,
@ -266,7 +266,7 @@ TfLiteStatus CheckLstmTensorDimensionsAndTypes(
const TfLiteTensor* cell_to_output_weights =
GetOptionalInputTensor(context, node, cell_to_output_weights_tensor);
if (cell_to_output_weights) {
if (cell_to_output_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, cell_to_output_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_output_weights->dims->data[0], n_cell);
TF_LITE_ENSURE_EQ(context, cell_to_output_weights->type,
@ -315,7 +315,7 @@ TfLiteStatus CheckLstmTensorDimensionsAndTypes(
const TfLiteTensor* projection_weights =
GetOptionalInputTensor(context, node, projection_weights_tensor);
if (projection_weights) {
if (projection_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, projection_weights->dims->size, 2);
TF_LITE_ENSURE_EQ(context, projection_weights->dims->data[0], n_output);
TF_LITE_ENSURE_EQ(context, projection_weights->dims->data[1], n_cell);
@ -325,7 +325,7 @@ TfLiteStatus CheckLstmTensorDimensionsAndTypes(
const TfLiteTensor* projection_bias =
GetOptionalInputTensor(context, node, projection_bias_tensor);
if (projection_bias) {
if (projection_bias != nullptr) {
TF_LITE_ENSURE_EQ(context, projection_bias->dims->size, 1);
TF_LITE_ENSURE_EQ(context, projection_bias->dims->data[0], n_output);
TF_LITE_ENSURE_EQ(context, projection_bias->type, kTfLiteFloat32);

View File

@ -110,7 +110,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
const TfLiteTensor* input_to_input_weights =
GetOptionalInputTensor(context, node, kInputToInputWeightsTensor);
if (input_to_input_weights) {
if (input_to_input_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, input_to_input_weights->dims->size, 2);
TF_LITE_ENSURE_EQ(context, input_to_input_weights->dims->data[0], n_cell);
TF_LITE_ENSURE_EQ(context, input_to_input_weights->dims->data[1], n_input);
@ -130,7 +130,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
const TfLiteTensor* recurrent_to_input_weights =
GetOptionalInputTensor(context, node, kRecurrentToInputWeightsTensor);
if (recurrent_to_input_weights) {
if (recurrent_to_input_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, recurrent_to_input_weights->dims->size, 2);
TF_LITE_ENSURE_EQ(context, recurrent_to_input_weights->dims->data[0],
n_cell);
@ -164,21 +164,21 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
const TfLiteTensor* cell_to_input_weights =
GetOptionalInputTensor(context, node, kCellToInputWeightsTensor);
if (cell_to_input_weights) {
if (cell_to_input_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, cell_to_input_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_input_weights->dims->data[0], n_cell);
}
const TfLiteTensor* cell_to_forget_weights =
GetOptionalInputTensor(context, node, kCellToForgetWeightsTensor);
if (cell_to_forget_weights) {
if (cell_to_forget_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, cell_to_forget_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_forget_weights->dims->data[0], n_cell);
}
const TfLiteTensor* cell_to_output_weights =
GetOptionalInputTensor(context, node, kCellToOutputWeightsTensor);
if (cell_to_output_weights) {
if (cell_to_output_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, cell_to_output_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_output_weights->dims->data[0], n_cell);
}
@ -220,7 +220,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
const TfLiteTensor* projection_weights =
GetOptionalInputTensor(context, node, kProjectionWeightsTensor);
if (projection_weights) {
if (projection_weights != nullptr) {
TF_LITE_ENSURE_EQ(context, projection_weights->dims->size, 2);
TF_LITE_ENSURE_EQ(context, projection_weights->dims->data[0], n_output);
TF_LITE_ENSURE_EQ(context, projection_weights->dims->data[1], n_cell);
@ -228,7 +228,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
const TfLiteTensor* projection_bias =
GetOptionalInputTensor(context, node, kProjectionBiasTensor);
if (projection_bias) {
if (projection_bias != nullptr) {
TF_LITE_ENSURE_EQ(context, projection_bias->dims->size, 1);
TF_LITE_ENSURE_EQ(context, projection_bias->dims->data[0], n_output);
}