-
Notifications
You must be signed in to change notification settings - Fork 74k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DHT versions for fallback resource support.
PiperOrigin-RevId: 528945537
- Loading branch information
1 parent
3c3ef70
commit 03286f5
Showing
7 changed files
with
124 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* Copyright 2023 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_TFRT_GRAPH_EXECUTOR_SYNC_RESOURCE_STATE_H_ | ||
#define TENSORFLOW_CORE_TFRT_GRAPH_EXECUTOR_SYNC_RESOURCE_STATE_H_ | ||
|
||
#include <utility> | ||
#include <vector> | ||
|
||
#include "tfrt/tensor/dense_host_tensor.h" // from @tf_runtime | ||
namespace tensorflow { | ||
namespace tfrt_stub { | ||
|
||
class SyncResourceState { | ||
public: | ||
// Sets `dht` in the array at `index`. `index` should be dense and | ||
// duplicate indices are not allowed. | ||
void SetResourceDht(int index, tfrt::DenseHostTensor dht) { | ||
if (resource_dht_.size() <= index) { | ||
resource_dht_.resize(index + 1); | ||
} | ||
|
||
resource_dht_[index] = std::move(dht); | ||
} | ||
|
||
tfrt::DenseHostTensor GetResourceDht(int index) const { | ||
return resource_dht_.at(index).CopyRef(); | ||
} | ||
|
||
private: | ||
std::vector<tfrt::DenseHostTensor> resource_dht_; | ||
}; | ||
|
||
} // namespace tfrt_stub | ||
} // namespace tensorflow | ||
|
||
#endif // TENSORFLOW_CORE_TFRT_GRAPH_EXECUTOR_SYNC_RESOURCE_STATE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters