Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Subhransu Bhattacharjee <[email protected]>
  • Loading branch information
1ssb committed Aug 28, 2023
1 parent b117c79 commit 46b7e92
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,25 @@ def main():
mangrove.add_data(1, torch.Tensor, ["retrieved_tensor_data"], [tensor_data_cpu])
print("Retrieved 'tensor_data' added to depth 1.")

print("Adding tensor data to depth 0 (pre-configured)...")
mangrove.add_data(0, torch.Tensor, ["tensor_data"], [torch.tensor([1, 2, 3])])
print("Tensor data added to depth 0.")

# Test shift operation
print("Shifting 'tensor_data' from depth 0 to depth 1...")
mangrove.shift(to=1, variable_name="tensor_data")
print("'tensor_data' shifted to depth 1.")

print("Attempting to shift 'age' to depth that doesn't support its type...")
try:
mangrove.shift(to=2, variable_name="age")
except MangroveException as e:
print("Expected error occurred:", e)

print("Shifting 'age' back to depth 0...")
mangrove.shift(to=0, variable_name="age")
print("'age' shifted to depth 0.")

except MangroveException as e:
print("An error occurred:", e)

Expand Down

0 comments on commit 46b7e92

Please sign in to comment.