Merge pull request #49285 from geetachavan1/cherrypicks_TH27G

Allowlist certain data types to avoid a seg fault.
This commit is contained in:
Mihai Maruseac 2021-05-19 08:43:16 -07:00 committed by GitHub
commit 4695308afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,8 @@ limitations under the License.
#include <unordered_set>
#include "tensorflow/core/framework/types.pb.h"
namespace tensorflow {
namespace {
@ -86,6 +88,9 @@ ImmutableConstantOp::ImmutableConstantOp(OpKernelConstruction* context)
OP_REQUIRES_OK(context,
context->GetAttr(kMemoryRegionNameAttr, &region_name_));
OP_REQUIRES_OK(context, context->GetAttr(kDTypeAttr, &dtype_));
OP_REQUIRES(context, dtype_ != DT_RESOURCE && dtype_ != DT_VARIANT,
errors::InvalidArgument(
"Resource and variant dtypes are invalid for this op."));
OP_REQUIRES_OK(context, context->GetAttr(kShapeAttr, &shape_));
}