Make DebugString() in ResourceBase constant
PiperOrigin-RevId: 228300469
This commit is contained in:
parent
84cf1da2b9
commit
f09a6224ba
@ -62,7 +62,7 @@ XlaCompilationCache::~XlaCompilationCache() {
|
|||||||
// about?
|
// about?
|
||||||
}
|
}
|
||||||
|
|
||||||
string XlaCompilationCache::DebugString() {
|
string XlaCompilationCache::DebugString() const {
|
||||||
return "XLA JIT compilation cache";
|
return "XLA JIT compilation cache";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class XlaCompilationCache : public ResourceBase {
|
|||||||
xla::LocalClient* client() const { return client_; }
|
xla::LocalClient* client() const { return client_; }
|
||||||
const DeviceType& device_type() const { return device_type_; }
|
const DeviceType& device_type() const { return device_type_; }
|
||||||
|
|
||||||
string DebugString() override;
|
string DebugString() const override;
|
||||||
|
|
||||||
// Describes the types, shapes and any compile-time constant arguments
|
// Describes the types, shapes and any compile-time constant arguments
|
||||||
// to a kernel. Key that uniquely identifies a compilation output.
|
// to a kernel. Key that uniquely identifies a compilation output.
|
||||||
|
@ -82,7 +82,7 @@ namespace {
|
|||||||
// compiled kernels.
|
// compiled kernels.
|
||||||
class DummyResourceForTest : public ResourceBase {
|
class DummyResourceForTest : public ResourceBase {
|
||||||
public:
|
public:
|
||||||
string DebugString() override { return "dummy"; }
|
string DebugString() const override { return "dummy"; }
|
||||||
void Increment() { ++value_; }
|
void Increment() { ++value_; }
|
||||||
int Get() { return value_; }
|
int Get() { return value_; }
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ void XlaContext::set_args(std::vector<XlaExpression> args) {
|
|||||||
XlaContext::XlaContext(XlaCompiler* compiler, xla::XlaBuilder* builder)
|
XlaContext::XlaContext(XlaCompiler* compiler, xla::XlaBuilder* builder)
|
||||||
: compiler_(compiler), builder_(builder) {}
|
: compiler_(compiler), builder_(builder) {}
|
||||||
|
|
||||||
string XlaContext::DebugString() { return "XLA JIT context"; }
|
string XlaContext::DebugString() const { return "XLA JIT context"; }
|
||||||
|
|
||||||
void XlaContext::SetRetval(int index, const XlaExpression& expression) {
|
void XlaContext::SetRetval(int index, const XlaExpression& expression) {
|
||||||
if (retvals_.size() <= index) {
|
if (retvals_.size() <= index) {
|
||||||
|
@ -47,7 +47,7 @@ class XlaContext : public ResourceBase {
|
|||||||
XlaContext(XlaCompiler* compiler, xla::XlaBuilder* builder);
|
XlaContext(XlaCompiler* compiler, xla::XlaBuilder* builder);
|
||||||
|
|
||||||
// Virtual method defined by ResourceBase.
|
// Virtual method defined by ResourceBase.
|
||||||
string DebugString() override;
|
string DebugString() const override;
|
||||||
|
|
||||||
XlaCompiler* compiler() const { return compiler_; }
|
XlaCompiler* compiler() const { return compiler_; }
|
||||||
|
|
||||||
|
@ -273,6 +273,8 @@ Status XRTCompilationCache::Lookup(
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
string XRTCompilationCache::DebugString() { return "XRTCompilationCache"; }
|
string XRTCompilationCache::DebugString() const {
|
||||||
|
return "XRTCompilationCache";
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace tensorflow
|
} // namespace tensorflow
|
||||||
|
@ -118,7 +118,7 @@ class XRTCompilationCache : public ResourceBase {
|
|||||||
// EntryRef holding the program is returned in entry.
|
// EntryRef holding the program is returned in entry.
|
||||||
Status Lookup(int64 uid, std::unique_ptr<XRTCompilationCacheEntryRef>* entry);
|
Status Lookup(int64 uid, std::unique_ptr<XRTCompilationCacheEntryRef>* entry);
|
||||||
|
|
||||||
string DebugString() override;
|
string DebugString() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// An entry in the compilation cache. The entry is deleted once it has been
|
// An entry in the compilation cache. The entry is deleted once it has been
|
||||||
|
@ -172,7 +172,7 @@ class XRTTupleAllocation : public ResourceBase {
|
|||||||
// ownership of the device memory is transferred to the result.
|
// ownership of the device memory is transferred to the result.
|
||||||
xla::ShapeTree<xla::MaybeOwningDeviceMemory> ToDeviceMemoryTree(bool release);
|
xla::ShapeTree<xla::MaybeOwningDeviceMemory> ToDeviceMemoryTree(bool release);
|
||||||
|
|
||||||
string DebugString() override { return "XLA allocation handle"; }
|
string DebugString() const override { return "XLA allocation handle"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Creates a new handle with (tuple) shape.
|
// Creates a new handle with (tuple) shape.
|
||||||
|
@ -42,7 +42,7 @@ class BigtableClientResource : public ResourceBase {
|
|||||||
return client_;
|
return client_;
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("BigtableClientResource(project_id: ", project_id_,
|
return strings::StrCat("BigtableClientResource(project_id: ", project_id_,
|
||||||
", instance_id: ", instance_id_, ")");
|
", instance_id: ", instance_id_, ")");
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ class BigtableTableResource : public ResourceBase {
|
|||||||
|
|
||||||
::google::cloud::bigtable::noex::Table& table() { return table_; }
|
::google::cloud::bigtable::noex::Table& table() { return table_; }
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat(
|
return strings::StrCat(
|
||||||
"BigtableTableResource(client: ", client_->DebugString(),
|
"BigtableTableResource(client: ", client_->DebugString(),
|
||||||
", table: ", table_name_, ")");
|
", table: ", table_name_, ")");
|
||||||
|
@ -96,7 +96,7 @@ class StatsAccumulatorResource : public boosted_trees::StampedResource {
|
|||||||
TensorShapeUtils::IsScalar(hessian_shape));
|
TensorShapeUtils::IsScalar(hessian_shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("StatsAccumulatorResource[size=", values_.size(),
|
return strings::StrCat("StatsAccumulatorResource[size=", values_.size(),
|
||||||
"]");
|
"]");
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class DecisionTreeEnsembleResource : public StampedResource {
|
|||||||
protobuf::Arena::CreateMessage<
|
protobuf::Arena::CreateMessage<
|
||||||
boosted_trees::trees::DecisionTreeEnsembleConfig>(&arena_)) {}
|
boosted_trees::trees::DecisionTreeEnsembleConfig>(&arena_)) {}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("GTFlowDecisionTreeEnsemble[size=",
|
return strings::StrCat("GTFlowDecisionTreeEnsemble[size=",
|
||||||
decision_tree_ensemble_->trees_size(), "]");
|
decision_tree_ensemble_->trees_size(), "]");
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class QuantileStreamResource : public StampedResource {
|
|||||||
set_stamp(stamp_token);
|
set_stamp(stamp_token);
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "QuantileStreamResource"; }
|
string DebugString() const override { return "QuantileStreamResource"; }
|
||||||
|
|
||||||
tensorflow::mutex* mutex() { return &mu_; }
|
tensorflow::mutex* mutex() { return &mu_; }
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class DecisionTreeResource : public ResourceBase {
|
|||||||
// Constructor.
|
// Constructor.
|
||||||
explicit DecisionTreeResource(const TensorForestParams& params);
|
explicit DecisionTreeResource(const TensorForestParams& params);
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("DecisionTree[size=",
|
return strings::StrCat("DecisionTree[size=",
|
||||||
decision_tree_->decision_tree().nodes_size(), "]");
|
decision_tree_->decision_tree().nodes_size(), "]");
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class FertileStatsResource : public ResourceBase {
|
|||||||
model_op_ = LeafModelOperatorFactory::CreateLeafModelOperator(params_);
|
model_op_ = LeafModelOperatorFactory::CreateLeafModelOperator(params_);
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "FertileStats"; }
|
string DebugString() const override { return "FertileStats"; }
|
||||||
|
|
||||||
void ExtractFromProto(const FertileStats& stats);
|
void ExtractFromProto(const FertileStats& stats);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class TRTCalibrationResource : public tensorflow::ResourceBase {
|
|||||||
allocator_.reset();
|
allocator_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
std::stringstream oss;
|
std::stringstream oss;
|
||||||
using std::dec;
|
using std::dec;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
@ -131,7 +131,7 @@ class LookupInterface : public ResourceBase {
|
|||||||
// - the default_value tensor shape matches the table's value shape.
|
// - the default_value tensor shape matches the table's value shape.
|
||||||
Status CheckFindArguments(const Tensor& keys, const Tensor& default_value);
|
Status CheckFindArguments(const Tensor& keys, const Tensor& default_value);
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("A lookup table of size: ", size());
|
return strings::StrCat("A lookup table of size: ", size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,11 +85,11 @@ class QueueInterface : public ResourceBase {
|
|||||||
virtual Status MatchesNodeDef(const NodeDef& node_def) = 0;
|
virtual Status MatchesNodeDef(const NodeDef& node_def) = 0;
|
||||||
|
|
||||||
// Returns the number of elements in the queue.
|
// Returns the number of elements in the queue.
|
||||||
virtual int32 size() = 0;
|
virtual int32 size() const = 0;
|
||||||
|
|
||||||
virtual const DataTypeVector& component_dtypes() const = 0;
|
virtual const DataTypeVector& component_dtypes() const = 0;
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("A Queue of size: ", size());
|
return strings::StrCat("A Queue of size: ", size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class ReaderInterface : public ResourceBase {
|
|||||||
// Note: Must Reset on error.
|
// Note: Must Reset on error.
|
||||||
virtual Status RestoreState(const string& state) = 0;
|
virtual Status RestoreState(const string& state) = 0;
|
||||||
|
|
||||||
string DebugString() override { return "a reader"; }
|
string DebugString() const override { return "a reader"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~ReaderInterface() {}
|
virtual ~ReaderInterface() {}
|
||||||
|
@ -77,7 +77,7 @@ namespace tensorflow {
|
|||||||
class ResourceBase : public core::RefCounted {
|
class ResourceBase : public core::RefCounted {
|
||||||
public:
|
public:
|
||||||
// Returns a debug string for *this.
|
// Returns a debug string for *this.
|
||||||
virtual string DebugString() = 0;
|
virtual string DebugString() const = 0;
|
||||||
|
|
||||||
// Returns memory used by this resource.
|
// Returns memory used by this resource.
|
||||||
virtual int64 MemoryUsed() const { return 0; }
|
virtual int64 MemoryUsed() const { return 0; }
|
||||||
|
@ -32,7 +32,7 @@ class Resource : public ResourceBase {
|
|||||||
explicit Resource(const string& label) : label_(label) {}
|
explicit Resource(const string& label) : label_(label) {}
|
||||||
~Resource() override {}
|
~Resource() override {}
|
||||||
|
|
||||||
string DebugString() override { return strings::StrCat("R/", label_); }
|
string DebugString() const override { return strings::StrCat("R/", label_); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string label_;
|
string label_;
|
||||||
@ -43,7 +43,7 @@ class Other : public ResourceBase {
|
|||||||
explicit Other(const string& label) : label_(label) {}
|
explicit Other(const string& label) : label_(label) {}
|
||||||
~Other() override {}
|
~Other() override {}
|
||||||
|
|
||||||
string DebugString() override { return strings::StrCat("O/", label_); }
|
string DebugString() const override { return strings::StrCat("O/", label_); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string label_;
|
string label_;
|
||||||
@ -245,7 +245,7 @@ class StubDevice : public DeviceBase {
|
|||||||
// Empty stub resource for testing resource handles.
|
// Empty stub resource for testing resource handles.
|
||||||
class StubResource : public ResourceBase {
|
class StubResource : public ResourceBase {
|
||||||
public:
|
public:
|
||||||
string DebugString() override { return ""; }
|
string DebugString() const override { return ""; }
|
||||||
int value_{0};
|
int value_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ TEST(ResourceHandleTest, DifferentDevice) {
|
|||||||
// Other stub resource to test type-checking of resource handles.
|
// Other stub resource to test type-checking of resource handles.
|
||||||
class OtherStubResource : public ResourceBase {
|
class OtherStubResource : public ResourceBase {
|
||||||
public:
|
public:
|
||||||
string DebugString() override { return ""; }
|
string DebugString() const override { return ""; }
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ResourceHandleTest, DifferentType) {
|
TEST(ResourceHandleTest, DifferentType) {
|
||||||
|
@ -46,7 +46,7 @@ class StubDevice : public DeviceBase {
|
|||||||
// Stub resource for testing resource op kernel.
|
// Stub resource for testing resource op kernel.
|
||||||
class StubResource : public ResourceBase {
|
class StubResource : public ResourceBase {
|
||||||
public:
|
public:
|
||||||
string DebugString() override { return ""; }
|
string DebugString() const override { return ""; }
|
||||||
int code;
|
int code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class Var : public ResourceBase {
|
|||||||
mutex* mu() { return &mu_; }
|
mutex* mu() { return &mu_; }
|
||||||
Tensor* tensor() { return &tensor_; }
|
Tensor* tensor() { return &tensor_; }
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat(DataTypeString(tensor_.dtype()), "/",
|
return strings::StrCat(DataTypeString(tensor_.dtype()), "/",
|
||||||
tensor_.shape().DebugString());
|
tensor_.shape().DebugString());
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class StatsAggregatorResource : public ResourceBase {
|
|||||||
return stats_aggregator_;
|
return stats_aggregator_;
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() { return "StatsAggregatorResource"; }
|
string DebugString() const override { return "StatsAggregatorResource"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::shared_ptr<StatsAggregator> stats_aggregator_;
|
const std::shared_ptr<StatsAggregator> stats_aggregator_;
|
||||||
|
@ -300,7 +300,7 @@ class Barrier : public ResourceBase {
|
|||||||
ready_queue_->Unref();
|
ready_queue_->Unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "A barrier"; }
|
string DebugString() const override { return "A barrier"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -233,7 +233,7 @@ class BatchResource : public ResourceBase {
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() final { return "BatchResource"; }
|
string DebugString() const final { return "BatchResource"; }
|
||||||
|
|
||||||
// Ingests data from one invocation of the batch op. The data is enqueued to
|
// Ingests data from one invocation of the batch op. The data is enqueued to
|
||||||
// be combined with others into a batch, asynchronously.
|
// be combined with others into a batch, asynchronously.
|
||||||
@ -878,7 +878,7 @@ class UnbatchResource : public ResourceBase {
|
|||||||
timeout_enforcer_ = nullptr;
|
timeout_enforcer_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() final { return "UnbatchResource"; }
|
string DebugString() const final { return "UnbatchResource"; }
|
||||||
|
|
||||||
Status Compute(OpKernelContext* context, AsyncOpKernel::DoneCallback done) {
|
Status Compute(OpKernelContext* context, AsyncOpKernel::DoneCallback done) {
|
||||||
const Tensor& data_t = context->input(0);
|
const Tensor& data_t = context->input(0);
|
||||||
@ -1094,7 +1094,7 @@ class UnbatchGradResource : public ResourceBase {
|
|||||||
public:
|
public:
|
||||||
UnbatchGradResource() {}
|
UnbatchGradResource() {}
|
||||||
|
|
||||||
string DebugString() final { return "UnbatchGradResource"; }
|
string DebugString() const final { return "UnbatchGradResource"; }
|
||||||
|
|
||||||
// Flushes the information for one batch, given its context and done
|
// Flushes the information for one batch, given its context and done
|
||||||
// callback. Clears all information about it from the available_tensors_.
|
// callback. Clears all information about it from the available_tensors_.
|
||||||
|
@ -45,7 +45,7 @@ class BoostedTreesQuantileStreamResource : public ResourceBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "QuantileStreamResource"; }
|
string DebugString() const override { return "QuantileStreamResource"; }
|
||||||
|
|
||||||
tensorflow::mutex* mutex() { return &mu_; }
|
tensorflow::mutex* mutex() { return &mu_; }
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ BoostedTreesEnsembleResource::BoostedTreesEnsembleResource()
|
|||||||
protobuf::Arena::CreateMessage<boosted_trees::TreeEnsemble>(
|
protobuf::Arena::CreateMessage<boosted_trees::TreeEnsemble>(
|
||||||
&arena_)) {}
|
&arena_)) {}
|
||||||
|
|
||||||
string BoostedTreesEnsembleResource::DebugString() {
|
string BoostedTreesEnsembleResource::DebugString() const {
|
||||||
return strings::StrCat("TreeEnsemble[size=", tree_ensemble_->trees_size(),
|
return strings::StrCat("TreeEnsemble[size=", tree_ensemble_->trees_size(),
|
||||||
"]");
|
"]");
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ class BoostedTreesEnsembleResource : public StampedResource {
|
|||||||
public:
|
public:
|
||||||
BoostedTreesEnsembleResource();
|
BoostedTreesEnsembleResource();
|
||||||
|
|
||||||
string DebugString() override;
|
string DebugString() const override;
|
||||||
|
|
||||||
bool InitFromSerialized(const string& serialized, const int64 stamp_token);
|
bool InitFromSerialized(const string& serialized, const int64 stamp_token);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class ConditionalAccumulatorBase : public ResourceBase {
|
|||||||
|
|
||||||
const DataType& dtype() const { return dtype_; }
|
const DataType& dtype() const { return dtype_; }
|
||||||
|
|
||||||
string DebugString() override { return "A conditional accumulator"; }
|
string DebugString() const override { return "A conditional accumulator"; }
|
||||||
|
|
||||||
// SetGlobalStep is a modifier method for current_global_step.
|
// SetGlobalStep is a modifier method for current_global_step.
|
||||||
// It returns an InvalidArgument error if the new_global_step is less than
|
// It returns an InvalidArgument error if the new_global_step is less than
|
||||||
|
@ -63,7 +63,7 @@ struct Im2ColBufferResource : public ResourceBase {
|
|||||||
// the buffer memory held by this resource.
|
// the buffer memory held by this resource.
|
||||||
mutex mu;
|
mutex mu;
|
||||||
T* data;
|
T* data;
|
||||||
string DebugString() { return "Im2ColBufferResource"; }
|
string DebugString() const { return "Im2ColBufferResource"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convolution parameters specified by Op attributes.
|
// Convolution parameters specified by Op attributes.
|
||||||
|
@ -614,7 +614,9 @@ class CacheDatasetOp : public UnaryDatasetOpKernel {
|
|||||||
public:
|
public:
|
||||||
MemoryCache() = default;
|
MemoryCache() = default;
|
||||||
|
|
||||||
string DebugString() override { return "CacheDataset::MemoryCache"; }
|
string DebugString() const override {
|
||||||
|
return "CacheDataset::MemoryCache";
|
||||||
|
}
|
||||||
|
|
||||||
// Marks the cache as completed.
|
// Marks the cache as completed.
|
||||||
void Complete() {
|
void Complete() {
|
||||||
|
@ -106,7 +106,7 @@ class MaterializedDatasetResource : public ResourceBase {
|
|||||||
const std::vector<PartialTensorShape>& output_shapes)
|
const std::vector<PartialTensorShape>& output_shapes)
|
||||||
: output_dtypes_(output_dtypes), output_shapes_(output_shapes) {}
|
: output_dtypes_(output_dtypes), output_shapes_(output_shapes) {}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return "Materialized IndexedDataset resource";
|
return "Materialized IndexedDataset resource";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class ThreadPoolResource : public ResourceBase {
|
|||||||
|
|
||||||
int32 NumThreads() { return thread_pool_.NumThreads(); }
|
int32 NumThreads() { return thread_pool_.NumThreads(); }
|
||||||
|
|
||||||
string DebugString() override { return "ThreadPoolResource"; }
|
string DebugString() const override { return "ThreadPoolResource"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
thread::ThreadPool thread_pool_;
|
thread::ThreadPool thread_pool_;
|
||||||
|
@ -231,7 +231,7 @@ class IteratorResource : public ResourceBase {
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "Iterator resource"; }
|
string DebugString() const override { return "Iterator resource"; }
|
||||||
|
|
||||||
const DataTypeVector& output_dtypes() const { return output_dtypes_; }
|
const DataTypeVector& output_dtypes() const { return output_dtypes_; }
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class MultiDeviceIterator : public ResourceBase {
|
|||||||
DCHECK(lib_ != nullptr);
|
DCHECK(lib_ != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("MultiDeviceIterator for ", devices_.size(),
|
return strings::StrCat("MultiDeviceIterator for ", devices_.size(),
|
||||||
" devices");
|
" devices");
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ class ShuffleDatasetOp : public ShuffleDatasetOpBase {
|
|||||||
parent_generator_(seed, seed2),
|
parent_generator_(seed, seed2),
|
||||||
generator_(&parent_generator_) {}
|
generator_(&parent_generator_) {}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return "ReshufflingDataset::RandomSeedGenerator";
|
return "ReshufflingDataset::RandomSeedGenerator";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class FIFOQueue : public TypedQueue<std::deque<PersistentTensor> > {
|
|||||||
CallbackWithTuple callback) override;
|
CallbackWithTuple callback) override;
|
||||||
Status MatchesNodeDef(const NodeDef& node_def) override;
|
Status MatchesNodeDef(const NodeDef& node_def) override;
|
||||||
|
|
||||||
int32 size() override {
|
int32 size() const override {
|
||||||
mutex_lock lock(mu_);
|
mutex_lock lock(mu_);
|
||||||
return queues_[0].size();
|
return queues_[0].size();
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ class StagingMap : public ResourceBase {
|
|||||||
return map_.size();
|
return map_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "StagingMap"; }
|
string DebugString() const override { return "StagingMap"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <bool Ordered>
|
template <bool Ordered>
|
||||||
|
@ -54,7 +54,7 @@ class Scratch : public ResourceBase {
|
|||||||
|
|
||||||
uint8_t* buffer() { return scratch_32_aligned_; }
|
uint8_t* buffer() { return scratch_32_aligned_; }
|
||||||
|
|
||||||
string DebugString() { return "MetaGemmScratchResource"; }
|
string DebugString() const override { return "MetaGemmScratchResource"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<uint8_t> scratch_;
|
std::unique_ptr<uint8_t> scratch_;
|
||||||
|
@ -45,7 +45,9 @@ class Mutex : public ResourceBase {
|
|||||||
VLOG(2) << "Creating mutex with name " << name << ": " << this;
|
VLOG(2) << "Creating mutex with name " << name << ": " << this;
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return strings::StrCat("Mutex ", name_); }
|
string DebugString() const override {
|
||||||
|
return strings::StrCat("Mutex ", name_);
|
||||||
|
}
|
||||||
|
|
||||||
class LockReleaser {
|
class LockReleaser {
|
||||||
public:
|
public:
|
||||||
|
@ -68,7 +68,7 @@ class PriorityQueue
|
|||||||
Status MatchesPriorityNodeDefTypes(const NodeDef& node_def) const;
|
Status MatchesPriorityNodeDefTypes(const NodeDef& node_def) const;
|
||||||
Status MatchesPriorityNodeDefShapes(const NodeDef& node_def) const;
|
Status MatchesPriorityNodeDefShapes(const NodeDef& node_def) const;
|
||||||
|
|
||||||
int32 size() override {
|
int32 size() const override {
|
||||||
mutex_lock lock(mu_);
|
mutex_lock lock(mu_);
|
||||||
return queues_[0].size();
|
return queues_[0].size();
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class RandomShuffleQueue : public TypedQueue<std::vector<PersistentTensor> > {
|
|||||||
CallbackWithTuple callback) override;
|
CallbackWithTuple callback) override;
|
||||||
Status MatchesNodeDef(const NodeDef& node_def) override;
|
Status MatchesNodeDef(const NodeDef& node_def) override;
|
||||||
|
|
||||||
int32 size() override {
|
int32 size() const override {
|
||||||
mutex_lock lock(mu_);
|
mutex_lock lock(mu_);
|
||||||
return queues_[0].size();
|
return queues_[0].size();
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class SparseTensorsMap : public ResourceBase {
|
|||||||
public:
|
public:
|
||||||
explicit SparseTensorsMap(const string& name) : name_(name), counter_(0) {}
|
explicit SparseTensorsMap(const string& name) : name_(name), counter_(0) {}
|
||||||
|
|
||||||
string DebugString() override { return "A SparseTensorsMap"; }
|
string DebugString() const override { return "A SparseTensorsMap"; }
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PersistentTensor indices;
|
PersistentTensor indices;
|
||||||
|
@ -96,7 +96,7 @@ class Stack : public ResourceBase {
|
|||||||
|
|
||||||
DataType ElemType() { return elem_type_; }
|
DataType ElemType() { return elem_type_; }
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
mutex_lock l(mu_);
|
mutex_lock l(mu_);
|
||||||
return strings::StrCat("Stack[", stack_name_, "]");
|
return strings::StrCat("Stack[", stack_name_, "]");
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ class Buffer : public ResourceBase {
|
|||||||
notify_inserters_if_bounded(&lock);
|
notify_inserters_if_bounded(&lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
std::unique_lock<std::mutex> lock(mu_);
|
std::unique_lock<std::mutex> lock(mu_);
|
||||||
return strings::StrCat("Staging size: ", buf_.size());
|
return strings::StrCat("Staging size: ", buf_.size());
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ class Buffer : public ResourceBase {
|
|||||||
std::size_t capacity_;
|
std::size_t capacity_;
|
||||||
std::size_t memory_limit_;
|
std::size_t memory_limit_;
|
||||||
std::size_t current_bytes_;
|
std::size_t current_bytes_;
|
||||||
std::mutex mu_;
|
mutable std::mutex mu_;
|
||||||
std::condition_variable non_empty_cond_var_;
|
std::condition_variable non_empty_cond_var_;
|
||||||
std::condition_variable full_cond_var_;
|
std::condition_variable full_cond_var_;
|
||||||
std::deque<Tuple> buf_;
|
std::deque<Tuple> buf_;
|
||||||
|
@ -124,7 +124,9 @@ TF_CALL_REAL_NUMBER_TYPES(REGISTER)
|
|||||||
struct HistogramResource : public ResourceBase {
|
struct HistogramResource : public ResourceBase {
|
||||||
histogram::ThreadSafeHistogram histogram;
|
histogram::ThreadSafeHistogram histogram;
|
||||||
|
|
||||||
string DebugString() override { return "A histogram summary. Stats ..."; }
|
string DebugString() const override {
|
||||||
|
return "A histogram summary. Stats ...";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SummaryMergeOp : public OpKernel {
|
class SummaryMergeOp : public OpKernel {
|
||||||
|
@ -261,7 +261,7 @@ class TensorArray : public ResourceBase {
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
mutex_lock l(mu_);
|
mutex_lock l(mu_);
|
||||||
CHECK(!closed_);
|
CHECK(!closed_);
|
||||||
return strings::StrCat("TensorArray[", tensors_.size(), "]");
|
return strings::StrCat("TensorArray[", tensors_.size(), "]");
|
||||||
@ -376,7 +376,7 @@ class TensorArray : public ResourceBase {
|
|||||||
const DataType dtype_;
|
const DataType dtype_;
|
||||||
Tensor handle_;
|
Tensor handle_;
|
||||||
|
|
||||||
mutex mu_;
|
mutable mutex mu_;
|
||||||
|
|
||||||
// Marks that the tensor_array_ has been cleared.
|
// Marks that the tensor_array_ has been cleared.
|
||||||
bool closed_ GUARDED_BY(mu_);
|
bool closed_ GUARDED_BY(mu_);
|
||||||
|
@ -34,7 +34,7 @@ class TensorForestTreeResource : public ResourceBase {
|
|||||||
public:
|
public:
|
||||||
TensorForestTreeResource();
|
TensorForestTreeResource();
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat("TensorForestTree[size=", get_size(), "]");
|
return strings::StrCat("TensorForestTree[size=", get_size(), "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class LegacyVar : public ResourceBase {
|
|||||||
mutex* mu() { return &mu_; }
|
mutex* mu() { return &mu_; }
|
||||||
Tensor* tensor() { return &tensor_; }
|
Tensor* tensor() { return &tensor_; }
|
||||||
|
|
||||||
string DebugString() override {
|
string DebugString() const override {
|
||||||
return strings::StrCat(DataTypeString(tensor_.dtype()), "/",
|
return strings::StrCat(DataTypeString(tensor_.dtype()), "/",
|
||||||
tensor_.shape().DebugString());
|
tensor_.shape().DebugString());
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ class TemporaryVariableOp : public OpKernel {
|
|||||||
mutex mu;
|
mutex mu;
|
||||||
Tensor val;
|
Tensor val;
|
||||||
string name;
|
string name;
|
||||||
string DebugString() override { return name; }
|
string DebugString() const override { return name; }
|
||||||
~TmpVar() override { VLOG(3) << "TmpVar " << name << " deleted"; }
|
~TmpVar() override { VLOG(3) << "TmpVar " << name << " deleted"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -972,7 +972,7 @@ class SummaryDbWriter : public SummaryWriterInterface {
|
|||||||
return MigrateEvent(std::move(e));
|
return MigrateEvent(std::move(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "SummaryDbWriter"; }
|
string DebugString() const override { return "SummaryDbWriter"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Status Write(int64 step, const Tensor& t, const string& tag,
|
Status Write(int64 step, const Tensor& t, const string& tag,
|
||||||
|
@ -148,7 +148,7 @@ class SummaryFileWriter : public SummaryWriterInterface {
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebugString() override { return "SummaryFileWriter"; }
|
string DebugString() const override { return "SummaryFileWriter"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double GetWallTime() {
|
double GetWallTime() {
|
||||||
|
@ -157,7 +157,7 @@ REGISTER_KERNEL_BUILDER(Name("Old").Device(DEVICE_CPU), OldOp);
|
|||||||
// Stubbed-out resource to test resource handle ops.
|
// Stubbed-out resource to test resource handle ops.
|
||||||
class StubResource : public ResourceBase {
|
class StubResource : public ResourceBase {
|
||||||
public:
|
public:
|
||||||
string DebugString() override { return ""; }
|
string DebugString() const override { return ""; }
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_RESOURCE_HANDLE_KERNEL(StubResource);
|
REGISTER_RESOURCE_HANDLE_KERNEL(StubResource);
|
||||||
|
Loading…
Reference in New Issue
Block a user