Skip to content

Module.to(ScalarType) has restrictions in PyTorch which aren't restricted in TorchSharp #1180

Closed

Description

@shaltielshmid

When calling Module.to(ScalarType) on a module, PyTorch has a restriction that the target dtype must be a floating point or a complex number. See here.

Also, when it gets a floating point type, PyTorch only moves parameters that are already a floating_point type to the new type. See for example here.

This is relatively trivial to add, would TorchSharp want to add the same restrictions?

Activity

  1. changed the title [-]`Module.to(ScalarType)` has restrictions in `PyTorch` which aren't restricted in TorchSharp[/-] [+]`Module.to(ScalarType)` has restrictions in `PyTorch` which aren't restricted in `TorchSharp`[/+] on Dec 7, 2023
  2. NiklasGustafsson commented on Dec 8, 2023

    @NiklasGustafsson

    Under the assumption that modules always participate in backprop, this constraint makes sense.

  3. added a commit that references this issue on Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions