red-state-23767
04/05/2024, 9:36 AMfull-evening-87657
04/05/2024, 9:36 AMfull-evening-87657
04/05/2024, 9:40 AMred-state-23767
04/05/2024, 9:43 AMfull-evening-87657
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 firstfull-evening-87657
04/05/2024, 9:46 AMfull-evening-87657
04/05/2024, 9:47 AMred-state-23767
04/05/2024, 9:51 AMred-state-23767
04/05/2024, 10:07 AMfull-evening-87657
04/05/2024, 10:17 AMfull-evening-87657
04/05/2024, 10:18 AMfull-evening-87657
04/05/2024, 10:19 AMfull-evening-87657
04/05/2024, 10:20 AMred-state-23767
04/05/2024, 10:21 AMfreezing-airport-6809
freezing-airport-6809
freezing-airport-6809