MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / RandomDims

Method RandomDims

tensorflow/compiler/tests/randomized_tests.cc:443–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443std::vector<int64> OpTest::RandomDims(int min_rank, int max_rank,
444 int64 min_size, int64 max_size) {
445 CHECK_LE(0, min_rank);
446 CHECK_LE(min_rank, max_rank);
447 std::uniform_int_distribution<int> rank_distribution(min_rank, max_rank);
448 int rank = rank_distribution(generator());
449 std::vector<int64> dims(rank);
450 // TODO(phawkins): too small a maximum tensor size could lead to an infinite
451 // loop here.
452 do {
453 std::generate(dims.begin(), dims.end(), [this, min_size, max_size]() {
454 return RandomDim(min_size, max_size);
455 });
456 } while (!TensorSizeIsOk(dims));
457 return dims;
458}
459
460bool OpTest::RandomBool() {
461 std::bernoulli_distribution d(0.5);

Callers

nothing calls this directly

Calls 3

generateFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected