Move core/lib/random/random to core/platform

PiperOrigin-RevId: 283111631
Change-Id: I8ef4e09e5035721c45a64ecc7eb598ba448b82ed
This commit is contained in:
Gunhan Gulsoy 2019-11-29 21:16:44 -08:00 committed by TensorFlower Gardener
parent 14a0c12dc2
commit 7879c387f8
5 changed files with 50 additions and 20 deletions
tensorflow/core

View File

@ -64,11 +64,9 @@ cc_library(
cc_library(
name = "random",
srcs = ["random.cc"],
hdrs = ["random.h"],
deps = [
"//tensorflow/core/platform:mutex",
"//tensorflow/core/platform:types",
"//tensorflow/core/platform:random",
],
)
@ -133,7 +131,6 @@ filegroup(
name = "legacy_lib_random_all_srcs",
srcs = [
"distribution_sampler.cc",
"random.cc",
"random_distributions.cc",
"simple_philox.cc",
"weighted_picker.cc",

View File

@ -16,20 +16,6 @@ limitations under the License.
#ifndef TENSORFLOW_LIB_RANDOM_RANDOM_H_
#define TENSORFLOW_LIB_RANDOM_RANDOM_H_
#include "tensorflow/core/platform/types.h"
namespace tensorflow {
namespace random {
// Return a 64-bit random value. Different sequences are generated
// in different processes.
uint64 New64();
// Return a 64-bit random value. Uses
// std::mersenne_twister_engine::default_seed as seed value.
uint64 New64DefaultSeed();
} // namespace random
} // namespace tensorflow
#include "tensorflow/core/platform/random.h"
#endif // TENSORFLOW_LIB_RANDOM_RANDOM_H_

View File

@ -376,6 +376,16 @@ cc_library(
] + if_static(["@com_google_protobuf//:protobuf"]),
)
cc_library(
name = "random",
srcs = ["random.cc"],
hdrs = ["random.h"],
deps = [
":mutex",
":types",
],
)
cc_library(
name = "raw_coding",
hdrs = ["raw_coding.h"],
@ -713,6 +723,7 @@ filegroup(
"numbers.cc",
"platform_strings.cc",
"protobuf.cc",
"random.cc",
"scanner.cc",
"strcat.cc",
"stringprintf.cc",
@ -824,6 +835,7 @@ filegroup(
"platform_strings.cc",
"protobuf.cc",
"protobuf_util.cc",
"random.cc",
"scanner.cc",
"setround.cc",
"status.cc",

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/lib/random/random.h"
#include "tensorflow/core/platform/random.h"
#include <random>
#include "tensorflow/core/platform/mutex.h"

View File

@ -0,0 +1,35 @@
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PLATFORM_RANDOM_H_
#define TENSORFLOW_CORE_PLATFORM_RANDOM_H_
#include "tensorflow/core/platform/types.h"
namespace tensorflow {
namespace random {
// Return a 64-bit random value. Different sequences are generated
// in different processes.
uint64 New64();
// Return a 64-bit random value. Uses
// std::mersenne_twister_engine::default_seed as seed value.
uint64 New64DefaultSeed();
} // namespace random
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PLATFORM_RANDOM_H_