Filipe Fonseca
04/05/2024, 9:36 AMRyuu
04/05/2024, 9:36 AMRyuu
04/05/2024, 9:40 AMFilipe Fonseca
04/05/2024, 9:43 AMRyuu
04/05/2024, 9:44 AMimport torch
from flytekit import task, workflow
@task # The container image is omitted
def pytorch_test() -> torch.Tensor:
# Initialize a tensor
x = torch.rand(5, 3)
print("Original tensor:", x)
# Perform a basic operation (addition)
y = x + 5
print("After addition:", y)
# Return the modified tensor
return y
@workflow
def pytorch_test_workflow() -> torch.Tensor:
result = pytorch_test()
return result
#if __name__ == "__main__":
# print(pytorch_test_workflow())
pyflyte run {your_wf_file_name}.py pytorch_test_workflow
Here is script check to run in locally firstRyuu
04/05/2024, 9:46 AMRyuu
04/05/2024, 9:47 AMFilipe Fonseca
04/05/2024, 9:51 AMFilipe Fonseca
04/05/2024, 10:07 AMRyuu
04/05/2024, 10:17 AMRyuu
04/05/2024, 10:18 AMRyuu
04/05/2024, 10:19 AMRyuu
04/05/2024, 10:20 AMFilipe Fonseca
04/05/2024, 10:21 AMKetan (kumare3)
Ketan (kumare3)
Ketan (kumare3)