Skip to content

Add FAQ item about constructing tensors used in overloaded assignments #393

@jwallwork23

Description

@jwallwork23

Note: Found during this that one cannot use tensor_a = tensor_b(requires_grad=.true.) when tensor_a is only defined as a torch_tensor. This is because the required_grad property gets copied across, and then we get errors resulting from trying to modify the values of a tensor with requires_grad=.true.. The solution is to declare tensor_a as empty.

See pFUnit tests for optimizers, specifically the zero_grad test.

cc @jwallwork23

Originally posted by @jatkinson1000 in #320 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    autogradTasks towards the online training / automatic differentiation featuredocumentationImprovements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions