tensorflow / tensorflow/java

NdArray implementations don't throw IllegalRankException as documented if no coordinates provided

Đang mở
#224 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Java
Star
928
Fork
227
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Instead, when no coordinates are provided, we return the scalar at (0, 0, ...). Is this an important idiom that we are preserving, or a questionable choice, or simply a bug?

Here's an example of an abstract method of FloatNdArray that is documented to throw IllegalRankException:

 /**
   * Returns the float value of the scalar found at the given coordinates.
   *
   * . . .
   *
   * @param coordinates coordinates of the scalar to resolve
   * @return value of that scalar
   * @throws IndexOutOfBoundsException if some coordinates are outside the limits of their respective dimension
   * @throws IllegalRankException if number of coordinates is not sufficient to access a scalar element
   */
  float getFloat(long... coordinates);

Here's the implementation in FloatDenseNdArray:

  @Override
  public float getFloat(long... indices) {
    return buffer.getFloat(positionOf(indices, true));
  }

But if indices.length == 0, then positionOf does not throw the claimed IllegalRankException:

  long positionOf(long[] coords, boolean isValue) {
    if (coords == null || coords.length == 0) {
      return 0;
    }
    Validator.coordinates(dimensions, coords, isValue);
    return dimensions.positionOf(coords);
  }

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với contract được ghi chép của FloatNdArray.getFloat và so sánh nó với FloatDenseNdArray.getFloat và positionOf, đặc biệt là nhánh tọa độ bằng không. Xác định liệu việc trả về scalar tại vị trí 0 có được dự định hay vi phạm hành vi exception được ghi chép hay không; được coi là hoàn tất khi hành vi và tài liệu của nó thống nhất, với coverage liên quan được thêm hoặc cập nhật nếu dự án có cung cấp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
machine-learning
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.