taichi-dev/taichi

[Lang] Deprecate ti.field(ti.f32), use ti.field(ti.f32, None) instead for advanced layouts

Open

#1.614 geöffnet am 30. Juli 2020

Auf GitHub ansehen
 (9 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (2.384 Forks)batch import
discussionfeature requestgood first issuepythonwelcome contribution

Repository-Metriken

Stars
 (28.195 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Concisely describe the proposed feature I'd like to deprecate ti.field(ti.f32), use ti.field(ti.f32, shape=None) instead for advanced layout.

Why? Clarity matters:

  1. People who knows about advanced layouts definitely won't bother with adding a None.
  2. Beginners who just want to declare a dense field will be confused by Some variable(s) not placed and get busy seeking where a shape=xxx is missed. It would be great if we'd raise an argument 'shape' not specified error for them.

Describe the solution you'd like (if any) Since ti.field is a newly-added API, we are OK to tweak it as much as we want before v0.7.0 finally release, we'd only do this on ti.field, not ti.var, both ensuring backward-compatib and pushing refactoring forward. Simply change def field(dt, shape=None) -> def field(dt, shape) should be OK.

Additional comments @k-ye @yuanming-hu WDYT about this change?

Contributor Guide