Allow targets to pass with -fsanitize=null under --config=asan.

PiperOrigin-RevId: 306895712
Change-Id: I50cc7bf6332865631227b56d2f40215c38dcd056
This commit is contained in:
Mihai Maruseac 2020-04-16 12:10:04 -07:00 committed by TensorFlower Gardener
parent 28caea9247
commit 9419de0389
2 changed files with 12 additions and 2 deletions

View File

@ -2204,7 +2204,7 @@ Status SpaceToBatchShapeHelper(InferenceContext* c, ShapeHandle input_shape,
DimensionHandle batch_size = c->Dim(input_shape, 0);
std::vector<int64> block_shape_vec;
if (block_shape_t) {
if (block_shape_t && (block_shape_t->NumElements() > 0)) {
block_shape_vec = GetFlatInt64(*block_shape_t);
for (int64 dim = 0; dim < num_block_dims; ++dim) {
const int64 block_shape_value = block_shape_vec[dim];
@ -2225,7 +2225,7 @@ Status SpaceToBatchShapeHelper(InferenceContext* c, ShapeHandle input_shape,
std::vector<DimensionHandle> output_dims{batch_size};
output_dims.resize(num_block_dims + 1, c->UnknownDim());
if (paddings_t) {
if (paddings_t && (paddings_t->NumElements() > 0)) {
const std::vector<int64> paddings_vec = GetFlatInt64(*paddings_t);
for (int64 dim = 0; dim < num_block_dims; ++dim) {
const int64 pad_start = paddings_vec[dim * 2],

View File

@ -1442,6 +1442,16 @@ TEST(ArrayOpsTest, SpaceToBatchND_ShapeFn) {
op.input_tensors[2] = nullptr;
}
{
Tensor block_shape = test::AsTensor<int32>({});
op.input_tensors[1] = &block_shape;
Tensor paddings = test::AsTensor<int32>({});
op.input_tensors[2] = &paddings;
INFER_OK(op, "?;[0];[0,2]", "?");
op.input_tensors[1] = nullptr;
op.input_tensors[2] = nullptr;
}
INFER_ERROR("rank", op, "[1,3,3,1];[2];[1]");
INFER_ERROR("shape", op, "[1,3,3,1];[2];[1,2]");
}