Skip to content

Commit

Permalink
Add constructor to MockSharding that also takes device list to allow …
Browse files Browse the repository at this point in the history
…tests that need working call to Sharding::devices().

PiperOrigin-RevId: 674504128
  • Loading branch information
Google-ML-Automation committed Sep 17, 2024
1 parent 8ace4ee commit 2ba7753
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xla/python/ifrt/mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ class MockSharding : public llvm::RTTIExtends<MockSharding, Sharding> {
BasicDeviceList::Create({}), MemoryKind(),
/*is_fully_replicated=*/false) {}

explicit MockSharding(tsl::RCReference<DeviceList> devices,
MemoryKind memory_kind = MemoryKind(),
bool is_fully_replicated = false)
: llvm::RTTIExtends<MockSharding, Sharding>(devices, memory_kind,
is_fully_replicated) {}

MOCK_METHOD(
(absl::StatusOr<
std::vector<std::pair<Shape, std::shared_ptr<const Sharding>>>>),
Expand Down

0 comments on commit 2ba7753

Please sign in to comment.