forked from ntgiang71096/vfdetector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtf_pos.csv
We can't make this file beautiful and searchable because it's too large.
16407 lines (14814 loc) · 769 KB
/
tf_pos.csv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
commit_id,repo,msg,filename,diff,label
3218043d6d3a019756607643cf65574fbfef5d7a,tensorflow/tensorflow,"Internal change
PiperOrigin-RevId: 411896058
Change-Id: Ia031058247e3cf382957a6662d3f9e1cbb481ca2",op_level_cost_estimator.cc,"@@ -2153,7 +2153,7 @@ OpInfo::TensorProperties OpLevelCostEstimator::DescribeTensor(
}
/* static */
-OpLevelCostEstimator::ConvolutionDimensions
+StatusOr<OpLevelCostEstimator::ConvolutionDimensions>
OpLevelCostEstimator::OpDimensionsFromInputs(
const TensorShapeProto& original_image_shape, const OpInfo& op_info,
bool* found_unknown_shapes) {
@@ -2190,6 +2190,11 @@ OpLevelCostEstimator::OpDimensionsFromInputs(
std::vector<int64_t> strides = GetStrides(op_info);
int64_t sx = strides[x_index];
int64_t sy = strides[y_index];
+ if (sx == 0 || sy == 0) {
+ return errors::InvalidArgument(
+ ""Stride must be > 0 for Height and Width, but got ("", sy, "", "", sx,
+ "")"");
+ }
const auto padding = GetPadding(op_info);
int64_t ox = GetOutputSize(ix, kx, sx, padding);
@@ -2206,8 +2211,9 @@ Status OpLevelCostEstimator::PredictMaxPool(const OpContext& op_context,
bool found_unknown_shapes = false;
const auto& op_info = op_context.op_info;
// x: op_info.inputs(0)
- ConvolutionDimensions dims = OpDimensionsFromInputs(
- op_info.inputs(0).shape(), op_info, &found_unknown_shapes);
+ TF_ASSIGN_OR_RETURN(ConvolutionDimensions dims,
+ OpDimensionsFromInputs(op_info.inputs(0).shape(), op_info,
+ &found_unknown_shapes));
// kx * ky - 1 comparisons per output (kx * xy > 1)
// or 1 copy per output (kx * k1 = 1).
int per_output_ops = dims.kx * dims.ky == 1 ? 1 : dims.kx * dims.ky - 1;
@@ -2248,8 +2254,9 @@ Status OpLevelCostEstimator::PredictMaxPoolGrad(const OpContext& op_context,
op_info.ShortDebugString());
}
- ConvolutionDimensions dims = OpDimensionsFromInputs(
- op_info.inputs(0).shape(), op_info, &found_unknown_shapes);
+ TF_ASSIGN_OR_RETURN(ConvolutionDimensions dims,
+ OpDimensionsFromInputs(op_info.inputs(0).shape(), op_info,
+ &found_unknown_shapes));
int64_t ops = 0;
if (dims.kx == 1 && dims.ky == 1) {
@@ -2324,8 +2331,9 @@ Status OpLevelCostEstimator::PredictAvgPool(const OpContext& op_context,
bool found_unknown_shapes = false;
const auto& op_info = op_context.op_info;
// x: op_info.inputs(0)
- ConvolutionDimensions dims = OpDimensionsFromInputs(
- op_info.inputs(0).shape(), op_info, &found_unknown_shapes);
+ TF_ASSIGN_OR_RETURN(ConvolutionDimensions dims,
+ OpDimensionsFromInputs(op_info.inputs(0).shape(), op_info,
+ &found_unknown_shapes));
// kx * ky - 1 additions and 1 multiplication per output.
int64_t ops = dims.batch * dims.ox * dims.oy * dims.oz * dims.kx * dims.ky;
@@ -2382,8 +2390,9 @@ Status OpLevelCostEstimator::PredictAvgPoolGrad(const OpContext& op_context,
found_unknown_shapes = true;
}
- ConvolutionDimensions dims =
- OpDimensionsFromInputs(x_shape, op_info, &found_unknown_shapes);
+ TF_ASSIGN_OR_RETURN(
+ ConvolutionDimensions dims,
+ OpDimensionsFromInputs(x_shape, op_info, &found_unknown_shapes));
int64_t ops = 0;
if (dims.kx <= dims.sx && dims.ky <= dims.sy) {
@@ -2409,8 +2418,9 @@ Status OpLevelCostEstimator::PredictFusedBatchNorm(
// offset: op_info.inputs(2)
// mean: op_info.inputs(3) --> only for inference
// variance: op_info.inputs(4) --> only for inference
- ConvolutionDimensions dims = OpDimensionsFromInputs(
- op_info.inputs(0).shape(), op_info, &found_unknown_shapes);
+ TF_ASSIGN_OR_RETURN(ConvolutionDimensions dims,
+ OpDimensionsFromInputs(op_info.inputs(0).shape(), op_info,
+ &found_unknown_shapes));
const bool is_training = IsTraining(op_info);
int64_t ops = 0;
@@ -2459,8 +2469,9 @@ Status OpLevelCostEstimator::PredictFusedBatchNormGrad(
// scale: op_info.inputs(2)
// mean: op_info.inputs(3)
// variance or inverse of variance: op_info.inputs(4)
- ConvolutionDimensions dims = OpDimensionsFromInputs(
- op_info.inputs(1).shape(), op_info, &found_unknown_shapes);
+ TF_ASSIGN_OR_RETURN(ConvolutionDimensions dims,
+ OpDimensionsFromInputs(op_info.inputs(1).shape(), op_info,
+ &found_unknown_shapes));
int64_t ops = 0;
const auto rsqrt_cost = Eigen::internal::functor_traits<
",1
3218043d6d3a019756607643cf65574fbfef5d7a,tensorflow/tensorflow,"Internal change
PiperOrigin-RevId: 411896058
Change-Id: Ia031058247e3cf382957a6662d3f9e1cbb481ca2",op_level_cost_estimator.h,"@@ -290,7 +290,7 @@ class OpLevelCostEstimator {
bool* found_unknown_shapes);
// For Pooling, FusedBatchNorm, and their grad ops.
- static ConvolutionDimensions OpDimensionsFromInputs(
+ static StatusOr<ConvolutionDimensions> OpDimensionsFromInputs(
const TensorShapeProto& original_image_shape, const OpInfo& op_info,
bool* found_unknown_shapes);
",1
3218043d6d3a019756607643cf65574fbfef5d7a,tensorflow/tensorflow,"Internal change
PiperOrigin-RevId: 411896058
Change-Id: Ia031058247e3cf382957a6662d3f9e1cbb481ca2",op_level_cost_estimator_test.cc,"@@ -24,6 +24,7 @@ limitations under the License.
#include ""tensorflow/core/framework/tensor_shape.h""
#include ""tensorflow/core/framework/tensor_shape.pb.h""
#include ""tensorflow/core/framework/types.h""
+#include ""tensorflow/core/platform/status_matchers.h""
#include ""tensorflow/core/platform/test.h""
#include ""tensorflow/core/protobuf/device_properties.pb.h""
@@ -558,9 +559,10 @@ class OpLevelCostEstimatorTest : public ::testing::Test {
}
bool found_unknown_shapes;
- auto dims = OpLevelCostEstimator::OpDimensionsFromInputs(
- op_context.op_info.inputs(0).shape(), op_context.op_info,
- &found_unknown_shapes);
+ TF_ASSERT_OK_AND_ASSIGN(
+ auto dims, OpLevelCostEstimator::OpDimensionsFromInputs(
+ op_context.op_info.inputs(0).shape(), op_context.op_info,
+ &found_unknown_shapes));
Padding padding_enum;
if (padding == ""VALID"") {
padding_enum = Padding::VALID;
@@ -581,6 +583,38 @@ class OpLevelCostEstimatorTest : public ::testing::Test {
EXPECT_EQ(padding_enum, dims.padding);
}
+ StatusOr<OpLevelCostEstimator::ConvolutionDimensions>
+ CallOpDimensionsFromInputs(const int n, const int h, const int w, const int c,
+ const int kx, const int ky, const int sx,
+ const int sy, const string& data_format,
+ const string& padding) {
+ OpContext op_context;
+
+ const std::vector<int> x = {n, h, w, c};
+ const std::vector<int> ksize = {1, kx, ky, 1};
+ std::vector<int> strides;
+ if (data_format == ""NHWC"") {
+ strides = {1, sy, sx, 1};
+ } else {
+ strides = {1, 1, sy, sx};
+ }
+
+ auto& op_info = op_context.op_info;
+ SetCpuDevice(&op_info);
+ op_info.set_op(""MaxPool"");
+
+ DescribeTensor4D(x[0], x[1], x[2], x[3], op_info.add_inputs());
+ auto* attr = op_info.mutable_attr();
+ SetAttrValue(data_format, &(*attr)[""data_format""]);
+ SetAttrValue(padding, &(*attr)[""padding""]);
+ SetAttrValue(strides, &(*attr)[""strides""]);
+ SetAttrValue(ksize, &(*attr)[""ksize""]);
+ bool found_unknown_shapes;
+ return OpLevelCostEstimator::OpDimensionsFromInputs(
+ op_context.op_info.inputs(0).shape(), op_context.op_info,
+ &found_unknown_shapes);
+ }
+
OpLevelCostEstimator estimator_;
};
@@ -1383,6 +1417,26 @@ TEST_F(OpLevelCostEstimatorTest, OpDimensionsFromInputs) {
}
}
+TEST_F(OpLevelCostEstimatorTest, OpDimensionsFromInputsError) {
+ std::vector<string> paddings = {""VALID"", ""SAME""};
+ std::vector<string> formats = {""NHWC"", ""NCHW""};
+ for (const auto& p : paddings) {
+ for (const auto& f : formats) {
+ // n, h, w, c, kx, ky, sx, sy, data_format, padding.
+ ASSERT_THAT(
+ CallOpDimensionsFromInputs(10, 14, 14, 3840, 3, 3, 0, 2, f, p),
+ testing::StatusIs(
+ error::INVALID_ARGUMENT,
+ ""Stride must be > 0 for Height and Width, but got (2, 0)""));
+ ASSERT_THAT(
+ CallOpDimensionsFromInputs(10, 14, 14, 3840, 3, 3, 2, 0, f, p),
+ testing::StatusIs(
+ error::INVALID_ARGUMENT,
+ ""Stride must be > 0 for Height and Width, but got (0, 2)""));
+ }
+ }
+}
+
TEST_F(OpLevelCostEstimatorTest, PredictMaxPool) {
auto predict_max_pool = [this](const int n, const int in, const int c,
const int k, const int s,
",1
23968a8bf65b009120c43b5ebcceaf52dbc9e943,tensorflow/tensorflow,"Fix out of bound access in DequantizeOp by adding check for axis < input dimension
PiperOrigin-RevId: 411214268
Change-Id: I3249d2a69ddc82f182c589a3a5bbfb71543f4b29",dequantize_op.cc,"@@ -94,6 +94,11 @@ class DequantizeOp : public OpKernel {
const Tensor& input_min_tensor = ctx->input(1);
const Tensor& input_max_tensor = ctx->input(2);
+ OP_REQUIRES(
+ ctx, axis_ < input.dims(),
+ errors::InvalidArgument(""Axis must be less than input dimension("",
+ input.dims(), ""), got "", axis_));
+
int num_slices = 1;
if (axis_ > -1) {
num_slices = input.dim_size(axis_);
",1
b64638ec5ccaa77b7c1eb90958e3d85ce381f91b,tensorflow/tensorflow,"Fix Integer overflow error in Dequantize op shape function, by adding a bound check on axis.
PiperOrigin-RevId: 412121389
Change-Id: I3088dbad9e90f9998d406b618c16694388a9dfb4",array_ops.cc,"@@ -24,6 +24,7 @@ limitations under the License.
#include ""tensorflow/core/framework/types.h""
#include ""tensorflow/core/framework/types.pb.h""
#include ""tensorflow/core/lib/core/errors.h""
+#include ""tensorflow/core/platform/types.h""
#include ""tensorflow/core/util/mirror_pad_mode.h""
#include ""tensorflow/core/util/padding.h""
#include ""tensorflow/core/util/strided_slice_op.h""
@@ -3028,6 +3029,12 @@ REGISTER_OP(""Dequantize"")
return errors::InvalidArgument(""axis should be at least -1, got "",
axis);
}
+ auto input_dims = c->Rank(c->input(0));
+ if (axis > input_dims) {
+ return errors::InvalidArgument(
+ ""Axis must be less than input dimension("", input_dims, ""), got "",
+ axis);
+ }
const int minmax_rank = (axis == -1) ? 0 : 1;
TF_RETURN_IF_ERROR(shape_inference::UnchangedShape(c));
ShapeHandle minmax;
@@ -3035,6 +3042,13 @@ REGISTER_OP(""Dequantize"")
TF_RETURN_IF_ERROR(c->WithRank(c->input(2), minmax_rank, &minmax));
if (axis != -1) {
ShapeHandle input;
+ if (axis >= kint32max) {
+ // Check int32 max bound for a corner case to prevent integer flow
+ // when input actually has kint32max rank and above bound check is not
+ // triggered.
+ return errors::InvalidArgument(
+ ""Axis cannot be >= kint32max value, got "", axis);
+ }
TF_RETURN_IF_ERROR(c->WithRankAtLeast(c->input(0), axis + 1, &input));
DimensionHandle depth;
TF_RETURN_IF_ERROR(
",1
b64638ec5ccaa77b7c1eb90958e3d85ce381f91b,tensorflow/tensorflow,"Fix Integer overflow error in Dequantize op shape function, by adding a bound check on axis.
PiperOrigin-RevId: 412121389
Change-Id: I3088dbad9e90f9998d406b618c16694388a9dfb4",array_ops_test.py,"@@ -1704,6 +1704,21 @@ class QuantizeAndDequantizeTest(test_util.TensorFlowTestCase):
output_grad = gradient_checker_v2.compute_gradient(f, [input_tensor])
self.assertAllClose(output_grad[0], np.zeros([1, 4, 4]))
+ def testOutOfBoundAxis(self):
+ input_tensor = constant_op.constant([1., 1.])
+ input_min = [0]
+ input_max = [1]
+ q_input, _, _ = array_ops.quantize(input_tensor, 0, 1, dtypes.qint32)
+ error = (errors.InvalidArgumentError, ValueError)
+ with self.assertRaisesRegex(error,
+ r"".*Axis must be less than input dimension.*""):
+ self.evaluate(
+ gen_array_ops.dequantize(
+ input=q_input,
+ min_range=input_min,
+ max_range=input_max,
+ axis=2**31 - 1))
+
@test_util.run_all_in_graph_and_eager_modes
class SortedSearchTest(test_util.TensorFlowTestCase):
",1
37c01fb5e25c3d80213060460196406c43d31995,tensorflow/tensorflow,"Fix out of bound error in ReverseSequence Op shape function
PiperOrigin-RevId: 411896080
Change-Id: I7e59a38e2f960886edf2b6c54ed5a84e86a9b193",array_ops.cc,"@@ -1653,11 +1653,21 @@ REGISTER_OP(""ReverseSequence"")
return errors::InvalidArgument(
""batch_dim must be < input rank: "", batch_dim, "" vs. "", input_rank);
}
+
if (seq_dim >= input_rank) {
return errors::InvalidArgument(
""seq_dim must be < input rank: "", seq_dim, "" vs. "", input_rank);
}
+ // To prevent out of bound access when calling c->Dim(input, batch_dim),
+ // batch_dim range [-1 * input rank, input rank) is allowed. However,
+ // the op implementation has a stricter bound for batch_dim requiring >= 0
+ // value. Thus, perform strict check here.
+ if (batch_dim < 0) {
+ return errors::InvalidArgument(""batch_dim must be >=0, got "",
+ batch_dim);
+ }
+
DimensionHandle batch_dim_dim = c->Dim(input, batch_dim);
TF_RETURN_IF_ERROR(
c->Merge(batch_dim_dim, c->Dim(seq_lens_shape, 0), &batch_dim_dim));
",1
58b34c6c8250983948b5a781b426f6aa01fd47af,tensorflow/tensorflow,"Fix integer overflow leading to divide by zero error in Unravel index kernel when dimensions product exceeds max int value.
PiperOrigin-RevId: 413250052
Change-Id: I9450b6e8acecd2e881a64b882e2b7c70e8e9289a",unravel_index_op.cc,"@@ -13,6 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
+#include <cstdint>
+
+#include ""tensorflow/core/framework/types.pb.h""
+#include ""tensorflow/core/platform/types.h""
#define EIGEN_USE_THREADS
#include ""tensorflow/core/framework/op_kernel.h""
@@ -35,7 +39,8 @@ typedef Eigen::ThreadPoolDevice CPUDevice;
template <typename Tidx>
class UnravelIndexOp : public OpKernel {
public:
- explicit UnravelIndexOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
+ explicit UnravelIndexOp(OpKernelConstruction* ctx)
+ : OpKernel(ctx), dtidx_(DataTypeToEnum<Tidx>::v()) {}
void Compute(OpKernelContext* ctx) override {
const Tensor& indices_tensor = ctx->input(0);
@@ -54,12 +59,31 @@ class UnravelIndexOp : public OpKernel {
auto dims = dims_tensor.vec<Tidx>();
// Make sure dims does not contain a zero
+ double prod = 1;
+ uint64_t limit;
+ if (dtidx_ == DataType::DT_INT64) {
+ limit = kint64max;
+ } else {
+ limit = kint32max;
+ }
+
for (int i = 0; i < dims.size(); i++) {
OP_REQUIRES(
ctx, dims(i) != 0,
errors::InvalidArgument(""Input dims cannot contain a dim of zero, ""
""but dims contains zero at index "",
i));
+ OP_REQUIRES(ctx, dims(i) > 0,
+ errors::InvalidArgument(
+ ""Input dims cannot be negative. Got dim = "", dims(i),
+ "" at index "", i));
+ // Check interger overflow
+ OP_REQUIRES(
+ ctx, prod <= limit / dims(i),
+ errors::InvalidArgument(""Input dims product is causing integer ""
+ ""overflow: ("",
+ dims, "")""));
+ prod = (prod * dims(i));
}
// Check to make sure indices is not out of boundary
@@ -132,6 +156,7 @@ class UnravelIndexOp : public OpKernel {
strides_shifted.reshape(reshape).broadcast(bcast);
}
}
+ const DataType dtidx_;
};
#define REGISTER_KERNEL(type) \
",1
58b34c6c8250983948b5a781b426f6aa01fd47af,tensorflow/tensorflow,"Fix integer overflow leading to divide by zero error in Unravel index kernel when dimensions product exceeds max int value.
PiperOrigin-RevId: 413250052
Change-Id: I9450b6e8acecd2e881a64b882e2b7c70e8e9289a",array_ops_test.py,"@@ -1580,6 +1580,20 @@ class UnravelIndexTest(test_util.TensorFlowTestCase):
dims = constant_op.constant([3, 0], dtype=dtype)
self.evaluate(array_ops.unravel_index(indices=indices, dims=dims))
+ def testUnravelIndexIntegerOverflow(self):
+ with self.cached_session():
+ for dtype in [dtypes.int32, dtypes.int64]:
+ with self.assertRaisesRegex(
+ errors.InvalidArgumentError,
+ r""Input dims product is causing integer overflow""):
+ indices = constant_op.constant(-0x100000, dtype=dtype)
+ if dtype == dtypes.int32:
+ value = 0x10000000
+ else:
+ value = 0x7FFFFFFFFFFFFFFF
+ dims = constant_op.constant([value, value], dtype=dtype)
+ self.evaluate(array_ops.unravel_index(indices=indices, dims=dims))
+
class GuaranteeConstOpTest(test_util.TensorFlowTestCase):
",1
002408c3696b173863228223d535f9de72a101a9,tensorflow/tensorflow,"Add negative bound check for row and column pooling_sequence in FractionalAvgPoolGrad op to avoid out of bound heap access
PiperOrigin-RevId: 413837346
Change-Id: I2b86034101df31bee161abcb781755e236c7bccd",fractional_avg_pool_op.cc,"@@ -311,15 +311,26 @@ class FractionalAvgPoolGradOp : public OpKernel {
for (int64_t b = 0; b < out_batch; ++b) {
for (int64_t r = 0; r < out_rows; ++r) {
const int64_t in_row_start = row_seq_tensor_flat(r);
+
int64_t in_row_end = overlapping_ ? row_seq_tensor_flat(r + 1)
: row_seq_tensor_flat(r + 1) - 1;
in_row_end = std::min(in_row_end, in_max_row_index);
+ OP_REQUIRES(context, in_row_start >= 0 && in_row_end >= 0,
+ errors::InvalidArgument(
+ ""Row sequence tensor values must not be negative, got "",
+ row_seq_tensor_flat));
+
for (int64_t c = 0; c < out_cols; ++c) {
const int64_t in_col_start = col_seq_tensor_flat(c);
int64_t in_col_end = overlapping_ ? col_seq_tensor_flat(c + 1)
: col_seq_tensor_flat(c + 1) - 1;
in_col_end = std::min(in_col_end, in_max_col_index);
+ OP_REQUIRES(
+ context, in_col_start >= 0 && in_col_end >= 0,
+ errors::InvalidArgument(
+ ""Column sequence tensor values must not be negative, got "",
+ col_seq_tensor_flat));
const int64_t num_elements_in_pooling_cell =
(in_row_end - in_row_start + 1) * (in_col_end - in_col_start + 1);
const int64_t out_index = (b * out_rows + r) * out_cols + c;
",1
002408c3696b173863228223d535f9de72a101a9,tensorflow/tensorflow,"Add negative bound check for row and column pooling_sequence in FractionalAvgPoolGrad op to avoid out of bound heap access
PiperOrigin-RevId: 413837346
Change-Id: I2b86034101df31bee161abcb781755e236c7bccd",fractional_avg_pool_op_test.py,"@@ -20,6 +20,7 @@ import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
+from tensorflow.python.framework import errors
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gen_nn_ops
@@ -306,6 +307,32 @@ class FractionalAvgTest(test.TestCase):
input_b, row_seq, col_seq, overlapping)
self.assertSequenceEqual(expected.shape, actual.shape)
+ def testNegativeSeqValuesForGradOp(self):
+ with self.assertRaisesRegex(
+ errors.InvalidArgumentError,
+ r""Row sequence tensor values must not be negative.*""):
+ y = nn_ops.gen_nn_ops.fractional_avg_pool_grad(
+ orig_input_tensor_shape=[2, 2, 2, 2],
+ out_backprop=[[[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11,
+ 12]]]],
+ row_pooling_sequence=[-10, 1, 2, 3],
+ col_pooling_sequence=[1, 2, 3, 4],
+ overlapping=True)
+
+ self.evaluate(y)
+ with self.assertRaisesRegex(
+ errors.InvalidArgumentError,
+ r""Column sequence tensor values must not be negative.*""):
+ z = nn_ops.gen_nn_ops.fractional_avg_pool_grad(
+ orig_input_tensor_shape=[2, 2, 2, 2],
+ out_backprop=[[[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11,
+ 12]]]],
+ row_pooling_sequence=[10, 1, 2, 3],
+ col_pooling_sequence=[1, 2, -3, 4],
+ overlapping=True)
+
+ self.evaluate(z)
+
class FractionalAvgPoolGradTest(test.TestCase):
""""""Tests for FractionalAvgPoolGrad.
",1
08d7b00c0a5a20926363849f611729f53f3ec022,tensorflow/tensorflow,"Fix Segfault in Concat V2 shape function.
PiperOrigin-RevId: 412120654
Change-Id: I3ff915faea694f9ad8b00024e9af2de9909011be",common_shape_fns.cc,"@@ -2005,7 +2005,7 @@ Status ConcatShapeHelper(InferenceContext* c, int start_value_index,
}
// Minimum required number of dimensions.
- const int min_rank = concat_dim < 0 ? -concat_dim : concat_dim + 1;
+ const int64 min_rank = concat_dim < 0 ? -concat_dim : concat_dim + 1;
ShapeHandle output_before;
ShapeHandle output_after;
",1
08d7b00c0a5a20926363849f611729f53f3ec022,tensorflow/tensorflow,"Fix Segfault in Concat V2 shape function.
PiperOrigin-RevId: 412120654
Change-Id: I3ff915faea694f9ad8b00024e9af2de9909011be",concat_op_test.py,"@@ -16,6 +16,7 @@
import numpy as np
+from tensorflow.python.eager import def_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_impl
@@ -570,6 +571,17 @@ class ConcatOpTest(test.TestCase):
t2 = [2]
gen_array_ops.concat_v2([t1, t2], 1).eval()
+ def testConcatInvalidAxisInTfFunction(self):
+
+ @def_function.function
+ def concat_wrapper():
+ y = gen_array_ops.concat_v2(
+ values=[[1, 2, 3], [4, 5, 6]], axis=0xb500005b)
+ return y
+
+ with self.assertRaises(ValueError):
+ concat_wrapper()
+
def testConcatNegativeAxis(self):
with test_util.use_gpu():
t1 = [[1, 2, 3], [4, 5, 6]]
",1
e3749a6d5d1e8d11806d4a2e9cc3123d1a90b75e,tensorflow/tensorflow,"[tf.data] Set limit on number of threads used in threadpool_dataset.
PiperOrigin-RevId: 410922677
Change-Id: Ib25814a99043ab10805b5d2d7088ae0e0b7b04fd",threadpool_dataset_op.cc,"@@ -39,6 +39,22 @@ namespace experimental {
PrivateThreadPoolDatasetOp::kDatasetType;
/* static */ constexpr const char* const PrivateThreadPoolDatasetOp::kDatasetOp;
+namespace {
+// To prevent integer overflow issues when allocating threadpool memory for an
+// unreasonable number of threads.
+constexpr int kThreadLimit = 65536;
+
+Status ValidateNumThreads(int32_t num_threads) {
+ if (num_threads < 0) {
+ return errors::InvalidArgument(""`num_threads` must be >= 0"");
+ }
+ if (num_threads >= kThreadLimit) {
+ return errors::InvalidArgument(""`num_threads` must be < "", kThreadLimit);
+ }
+ return Status::OK();
+}
+} // namespace
+
class ThreadPoolResource : public ResourceBase {
public:
ThreadPoolResource(Env* env, const ThreadOptions& thread_options,
@@ -83,9 +99,7 @@ class ThreadPoolHandleOp : public OpKernel {
OP_REQUIRES_OK(ctx, ctx->GetAttr(""num_threads"", &num_threads_));
OP_REQUIRES_OK(ctx, ctx->GetAttr(""max_intra_op_parallelism"",
&max_intra_op_parallelism_));
- OP_REQUIRES(
- ctx, num_threads_ > 0,
- errors::InvalidArgument(""`num_threads` must be greater than zero.""));
+ OP_REQUIRES_OK(ctx, ValidateNumThreads(num_threads_));
}
// The resource is deleted from the resource manager only when it is private
@@ -531,8 +545,7 @@ void PrivateThreadPoolDatasetOp::MakeDatasetFromOptions(OpKernelContext* ctx,
DatasetBase* input,
int32_t num_threads,
DatasetBase** output) {
- OP_REQUIRES(ctx, num_threads >= 0,
- errors::InvalidArgument(""`num_threads` must be >= 0""));
+ OP_REQUIRES_OK(ctx, ValidateNumThreads(num_threads));
*output = new Dataset(ctx,
DatasetContext(DatasetContext::Params(
{PrivateThreadPoolDatasetOp::kDatasetType,
@@ -546,8 +559,7 @@ void PrivateThreadPoolDatasetOp::MakeDataset(OpKernelContext* ctx,
int64_t num_threads = 0;
OP_REQUIRES_OK(
ctx, ParseScalarArgument<int64_t>(ctx, ""num_threads"", &num_threads));
- OP_REQUIRES(ctx, num_threads >= 0,
- errors::InvalidArgument(""`num_threads` must be >= 0""));
+ OP_REQUIRES_OK(ctx, ValidateNumThreads(num_threads));
*output = new Dataset(ctx, input, num_threads);
}
",1
f68fdab93fb7f4ddb4eb438c8fe052753c9413e8,tensorflow/tensorflow,"Add a check for pad width to be a positive value.
PiperOrigin-RevId: 413275853
Change-Id: I261a8db9dabf5ce48a806a9e58129080c9fac619",string_ngrams_op.cc,"@@ -152,6 +152,16 @@ class StringNGramsOp : public tensorflow::OpKernel {
// We don't have to worry about dynamic padding sizes here: if padding
// was dynamic, every sequence would have had sufficient padding to
// generate at least one ngram.
+
+ // If reached here, pad_width should be > 0, pad_width_ = -1,
+ // which indicates max(ngram_widths) - 1 cannot be used here since
+ // ngram_width is not known.
+ OP_REQUIRES(
+ context, pad_width_ >= 0,
+ errors::InvalidArgument(""Pad width should be >= 0 when ""
+ ""preserve_short_sequences is True and ""
+ ""ngram_widths are not provided, got "",
+ pad_width_));
int ngram_width = data_length + 2 * pad_width_;
auto output_start = &ngrams_data[output_start_idx];
int num_ngrams = 1;
",1
f68fdab93fb7f4ddb4eb438c8fe052753c9413e8,tensorflow/tensorflow,"Add a check for pad width to be a positive value.
PiperOrigin-RevId: 413275853
Change-Id: I261a8db9dabf5ce48a806a9e58129080c9fac619",raw_ops_test.py,"@@ -28,7 +28,6 @@ from tensorflow.python.platform import test
@test_util.run_all_in_graph_and_eager_modes
-@test_util.disable_tfrt
class RawOpsTest(test.TestCase, parameterized.TestCase):
def testSimple(self):
@@ -63,8 +62,9 @@ class RawOpsTest(test.TestCase, parameterized.TestCase):
@parameterized.parameters([[0, 8]], [[-1, 6]])
def testStringNGramsBadDataSplits(self, splits):
data = [""aa"", ""bb"", ""cc"", ""dd"", ""ee"", ""ff""]
- with self.assertRaisesRegex(errors.InvalidArgumentError,
- ""Invalid split value""):
+ with self.assertRaisesRegex(
+ errors.InvalidArgumentError,
+ r""Invalid split value|First split value must be 0""):
self.evaluate(
gen_string_ops.string_n_grams(
data=data,
@@ -76,6 +76,25 @@ class RawOpsTest(test.TestCase, parameterized.TestCase):
pad_width=0,
preserve_short_sequences=False))
+ def testStringSplit(self):
+ data = [""123456""]
+ data_splits = [0, 1]
+ separator = ""a"" * 15
+ ngram_widths = []
+ pad_width = -5
+ left_pad = right_pad = """"
+ with self.assertRaisesRegex(errors.InvalidArgumentError,
+ ""Pad width should be >= 0""):
+ self.evaluate(gen_string_ops.string_n_grams(
+ data=data,
+ data_splits=data_splits,
+ separator=separator,
+ ngram_widths=ngram_widths,
+ left_pad=left_pad,
+ right_pad=right_pad,
+ pad_width=pad_width,
+ preserve_short_sequences=True))
+
def testGetSessionHandle(self):
if context.executing_eagerly():
with self.assertRaisesRegex(
",1
f57315566d7094f322b784947093406c2aea0d7d,tensorflow/tensorflow,"Add a check for Key being scalar tensor for MapStage and OrderedMapStage ops.
According to documentation[1][2], key must be int64 value, but this wasn't enforced and the ops would fail with check failure for non-scalar key value.
[1]https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/ordered-map-stage
[2]https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/map-stage
PiperOrigin-RevId: 413822112
Change-Id: I9d118faf990e6361900aa32272eff486ad9f0e2e",map_stage_op.cc,"@@ -536,6 +536,11 @@ class MapStageOp : public OpKernel {
OP_REQUIRES(ctx, key_tensor->NumElements() > 0,
errors::InvalidArgument(""key must not be empty""));
+ OP_REQUIRES(ctx, key_tensor->NumElements() == 1,
+ errors::InvalidArgument(
+ ""key must be an int64 scalar, got tensor with shape: "",
+ key_tensor->shape()));
+
// Create copy for insertion into Staging Area
Tensor key(*key_tensor);
",1
f57315566d7094f322b784947093406c2aea0d7d,tensorflow/tensorflow,"Add a check for Key being scalar tensor for MapStage and OrderedMapStage ops.
According to documentation[1][2], key must be int64 value, but this wasn't enforced and the ops would fail with check failure for non-scalar key value.
[1]https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/ordered-map-stage
[2]https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/map-stage
PiperOrigin-RevId: 413822112
Change-Id: I9d118faf990e6361900aa32272eff486ad9f0e2e",map_stage_op_test.py,"@@ -12,8 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
-from tensorflow.python.framework import errors
+import numpy as np
+
+from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
+from tensorflow.python.framework import errors
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
@@ -28,7 +31,7 @@ class MapStageTest(test.TestCase):
@test_util.run_deprecated_v1
def testSimple(self):
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32)
pi = array_ops.placeholder(dtypes.int64)
@@ -40,9 +43,9 @@ class MapStageTest(test.TestCase):
k, y = stager.get(gi)
y = math_ops.reduce_max(math_ops.matmul(y, y))
- G.finalize()
+ g.finalize()
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
sess.run(stage, feed_dict={x: -1, pi: 0})
for i in range(10):
_, yval = sess.run([stage, y], feed_dict={x: i, pi: i + 1, gi: i})
@@ -50,7 +53,7 @@ class MapStageTest(test.TestCase):
@test_util.run_deprecated_v1
def testMultiple(self):
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32)
pi = array_ops.placeholder(dtypes.int64)
@@ -62,9 +65,9 @@ class MapStageTest(test.TestCase):
k, (z, y) = stager.get(gi)
y = math_ops.reduce_max(z * math_ops.matmul(y, y))
- G.finalize()
+ g.finalize()
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
sess.run(stage, feed_dict={x: -1, pi: 0})
for i in range(10):
_, yval = sess.run([stage, y], feed_dict={x: i, pi: i + 1, gi: i})
@@ -73,26 +76,25 @@ class MapStageTest(test.TestCase):
@test_util.run_deprecated_v1
def testDictionary(self):
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32)
pi = array_ops.placeholder(dtypes.int64)
gi = array_ops.placeholder(dtypes.int64)
v = 2. * (array_ops.zeros([128, 128]) + x)
with ops.device(test.gpu_device_name()):
- stager = data_flow_ops.MapStagingArea(
- [dtypes.float32, dtypes.float32],
- shapes=[[], [128, 128]],
- names=['x', 'v'])
+ stager = data_flow_ops.MapStagingArea([dtypes.float32, dtypes.float32],
+ shapes=[[], [128, 128]],
+ names=['x', 'v'])
stage = stager.put(pi, {'x': x, 'v': v})
key, ret = stager.get(gi)
z = ret['x']
y = ret['v']
y = math_ops.reduce_max(z * math_ops.matmul(y, y))
- G.finalize()
+ g.finalize()
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
sess.run(stage, feed_dict={x: -1, pi: 0})
for i in range(10):
_, yval = sess.run([stage, y], feed_dict={x: i, pi: i + 1, gi: i})
@@ -102,7 +104,7 @@ class MapStageTest(test.TestCase):
def testColocation(self):
gpu_dev = test.gpu_device_name()
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32)
v = 2. * (array_ops.zeros([128, 128]) + x)
@@ -119,58 +121,56 @@ class MapStageTest(test.TestCase):
self.assertEqual(y.device, '/device:CPU:0')
self.assertEqual(z[0].device, '/device:CPU:0')
- G.finalize()
+ g.finalize()
@test_util.run_deprecated_v1
def testPeek(self):
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.int32, name='x')
pi = array_ops.placeholder(dtypes.int64)
gi = array_ops.placeholder(dtypes.int64)
p = array_ops.placeholder(dtypes.int32, name='p')
with ops.device(test.gpu_device_name()):
- stager = data_flow_ops.MapStagingArea(
- [
- dtypes.int32,
- ], shapes=[[]])
+ stager = data_flow_ops.MapStagingArea([
+ dtypes.int32,
+ ], shapes=[[]])
stage = stager.put(pi, [x], [0])
peek = stager.peek(gi)
size = stager.size()
- G.finalize()
+ g.finalize()
n = 10
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
for i in range(n):
sess.run(stage, feed_dict={x: i, pi: i})
for i in range(n):
- self.assertTrue(sess.run(peek, feed_dict={gi: i})[0] == i)
+ self.assertEqual(sess.run(peek, feed_dict={gi: i})[0], i)
- self.assertTrue(sess.run(size) == 10)
+ self.assertEqual(sess.run(size), 10)
@test_util.run_deprecated_v1
def testSizeAndClear(self):
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32, name='x')
pi = array_ops.placeholder(dtypes.int64)
gi = array_ops.placeholder(dtypes.int64)
v = 2. * (array_ops.zeros([128, 128]) + x)
with ops.device(test.gpu_device_name()):
- stager = data_flow_ops.MapStagingArea(
- [dtypes.float32, dtypes.float32],
- shapes=[[], [128, 128]],
- names=['x', 'v'])
+ stager = data_flow_ops.MapStagingArea([dtypes.float32, dtypes.float32],
+ shapes=[[], [128, 128]],
+ names=['x', 'v'])
stage = stager.put(pi, {'x': x, 'v': v})
size = stager.size()
clear = stager.clear()
- G.finalize()
+ g.finalize()
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
sess.run(stage, feed_dict={x: -1, pi: 3})
self.assertEqual(sess.run(size), 1)
sess.run(stage, feed_dict={x: -1, pi: 1})
@@ -182,22 +182,23 @@ class MapStageTest(test.TestCase):
def testCapacity(self):
capacity = 3
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.int32, name='x')
pi = array_ops.placeholder(dtypes.int64, name='pi')
gi = array_ops.placeholder(dtypes.int64, name='gi')
with ops.device(test.gpu_device_name()):
- stager = data_flow_ops.MapStagingArea(
- [
- dtypes.int32,
- ], capacity=capacity, shapes=[[]])
+ stager = data_flow_ops.MapStagingArea([
+ dtypes.int32,
+ ],
+ capacity=capacity,
+ shapes=[[]])
stage = stager.put(pi, [x], [0])
get = stager.get()
size = stager.size()
- G.finalize()
+ g.finalize()
from six.moves import queue as Queue
import threading
@@ -205,7 +206,7 @@ class MapStageTest(test.TestCase):
queue = Queue.Queue()
n = 8
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
# Stage data in a separate thread which will block
# when it hits the staging area's capacity and thus
# not fill the queue with n tokens
@@ -234,13 +235,13 @@ class MapStageTest(test.TestCase):
capacity))
# Should have capacity elements in the staging area
- self.assertTrue(sess.run(size) == capacity)
+ self.assertEqual(sess.run(size), capacity)
# Clear the staging area completely
for i in range(n):
sess.run(get)
- self.assertTrue(sess.run(size) == 0)
+ self.assertEqual(sess.run(size), 0)
@test_util.run_deprecated_v1
def testMemoryLimit(self):
@@ -248,28 +249,28 @@ class MapStageTest(test.TestCase):
chunk = 200 * 1024 # 256K
capacity = memory_limit // chunk
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.uint8, name='x')
pi = array_ops.placeholder(dtypes.int64, name='pi')
gi = array_ops.placeholder(dtypes.int64, name='gi')
with ops.device(test.gpu_device_name()):
- stager = data_flow_ops.MapStagingArea(
- [dtypes.uint8], memory_limit=memory_limit, shapes=[[]])
+ stager = data_flow_ops.MapStagingArea([dtypes.uint8],
+ memory_limit=memory_limit,
+ shapes=[[]])
stage = stager.put(pi, [x], [0])
get = stager.get()
size = stager.size()
- G.finalize()
+ g.finalize()
from six.moves import queue as Queue
import threading
- import numpy as np
queue = Queue.Queue()
n = 8
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
# Stage data in a separate thread which will block
# when it hits the staging area's capacity and thus
# not fill the queue with n tokens
@@ -299,56 +300,57 @@ class MapStageTest(test.TestCase):
capacity))
# Should have capacity elements in the staging area
- self.assertTrue(sess.run(size) == capacity)
+ self.assertEqual(sess.run(size), capacity)
# Clear the staging area completely
for i in range(n):
sess.run(get)
- self.assertTrue(sess.run(size) == 0)
+ self.assertEqual(sess.run(size), 0)
@test_util.run_deprecated_v1
def testOrdering(self):
import six
import random
- with ops.Graph().as_default() as G:
+ with ops.Graph().as_default() as g:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.int32, name='x')
pi = array_ops.placeholder(dtypes.int64, name='pi')
gi = array_ops.placeholder(dtypes.int64, name='gi')
with ops.device(test.gpu_device_name()):
- stager = data_flow_ops.MapStagingArea(
- [
- dtypes.int32,
- ], shapes=[[]], ordered=True)
+ stager = data_flow_ops.MapStagingArea([
+ dtypes.int32,
+ ],
+ shapes=[[]],
+ ordered=True)
stage = stager.put(pi, [x], [0])
get = stager.get()
size = stager.size()
- G.finalize()
+ g.finalize()
n = 10
- with self.session(graph=G) as sess:
+ with self.session(graph=g) as sess:
# Keys n-1..0
keys = list(reversed(six.moves.range(n)))
for i in keys:
sess.run(stage, feed_dict={pi: i, x: i})
- self.assertTrue(sess.run(size) == n)
+ self.assertEqual(sess.run(size), n)
# Check that key, values come out in ascending order
for i, k in enumerate(reversed(keys)):
get_key, values = sess.run(get)
self.assertTrue(i == k == get_key == values)
- self.assertTrue(sess.run(size) == 0)
+ self.assertEqual(sess.run(size), 0)