jax.export.symbolic_shape#
- jax.export.symbolic_shape(shape_spec, *, constraints=(), scope=None, like=None)[原始碼]#
從字串表示形式建構符號形狀。
範例請參閱 https://jax.dev.org.tw/en/latest/export/shape_poly.html。
- 參數:
shape_spec (str | None) – 符號形狀規格。 None 代表 “…”。 形狀規格是以逗號分隔的維度表達式的元組的字串表示形式(括號是選用的)。 維度表達式可以是:整數常數、維度變數(字母數字,以字母開頭)、e1 + e2、e1 - e2、e1 * e2、floordiv(e1, e2)、mod(e1, e2)、max(e1, e2) 或 min(e1, e2)。
constraints (Sequence[str]) – 符號維度表達式上的約束序列,形式為 e1 >= e2 或 e1 <= e2,或 e1 == e2。 用法請參閱[文件](https://jax.dev.org.tw/en/latest/export/shape_poly.html#user-specified-symbolic-constraints)。
scope (SymbolicScope | None | None) – (選用) 您可以指定在給定的範圍內建立已剖析的符號表達式。 如果缺少此項,則會使用給定的 constraints 建立新的 SymbolicScope。 您不能同時指定 scope 和 constraints。 用法請參閱[文件](https://jax.dev.org.tw/en/latest/export/shape_poly.html#user-specified-symbolic-constraints)。
like (Sequence[int | None] | None | None) – 當 shape_spec 包含佔位符 (“_”, “…”) 時,使用此形狀來填入佔位符。 用於填入的 like 的維度不得為 None。 如果 like 中的維度不是 None,且 shape_spec 中的對應維度是常數,則它們必須相等。
- 回傳類型:
Sequence[DimSize]
回傳值:包含整數或包含維度變數的符號表達式的元組。