Skip to content

cstr and npstr for 0d tensors #1250

Closed
Closed

Description

@yueyinqiu

cstr (or ToString(TensorStringStyle.CSharp)) on a 0d tensor (scalar) will return an empty string, due to the line 6575 in Tensor.cs.

Meanwhile I also found the line 6582, which also tries to check t.Dimensions == 0 and print the scalar value, so I think the current behavior is not expected.

(Also for npstr.)

image

Activity

  1. NiklasGustafsson commented on Mar 1, 2024

    @NiklasGustafsson

    Thank you for reporting! This seems to be affecting formatting strings as C# and Numpy, but not Julia. While waiting for the next release, you can set the default format to 'Julia' and it should work.

  2. NiklasGustafsson commented on Mar 5, 2024

    @NiklasGustafsson

    Fixed in v0.102.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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