Avertissement : Cette API est obsolète et sera supprimée dans une future version de TensorFlow une fois que le remplacement sera stable.
Shape
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
La forme peut-être partiellement connue d'un tenseur produit par une opération.
Méthodes publiques
booléen | |
int | |
Forme statique | make (long firstDimensionSize, long... otherDimensionSizes) Créez une forme représentant une valeur à N dimensions. |
int | numDimensions () Nombre de dimensions représentées par cette forme. |
Forme statique | scalaire () Créez une forme représentant une valeur scalaire. |
long | taille (int i) La taille de la i-ème dimension. |
Chaîne | àChaîne () Description succincte de la forme destinée au débogage. |
Forme statique | inconnu () Créez une forme représentant un nombre inconnu de dimensions. |
Méthodes héritées
De la classe java.lang.Object booléen | est égal à (Objet arg0) |
Classe finale<?> | obtenirClasse () |
int | Code de hachage () |
vide final | notifier () |
vide final | notifierTous () |
Chaîne | àChaîne () |
vide final | attendre (long arg0, int arg1) |
vide final | attendez (long arg0) |
vide final | attendez () |
Méthodes publiques
public booléen égal (Objet obj)
code de hachage int public ()
marque de forme statique publique (long firstDimensionSize, long... otherDimensionSizes)
Créez une forme représentant une valeur à N dimensions.
Crée une forme représentant une valeur à N dimensions (N étant au moins 1), avec la taille fournie pour chaque dimension. A -1 indique que la taille de la dimension correspondante est inconnue. Par exemple:
// A 2-element vector.
Shape vector = Shape.create(2);
// A 2x3 matrix.
Shape matrix = Shape.create(2, 3);
// A matrix with 4 columns but an unknown number of rows.
// This is typically used to indicate the shape of tensors that represent
// a variable-sized batch of values. The Shape below might represent a
// variable-sized batch of 4-element vectors.
Shape batch = Shape.create(-1, 4);
Paramètres
premièreDimensionTaille | |
---|
autresDimensionTailles | |
---|
public int numDimensions ()
Nombre de dimensions représentées par cette forme.
Retours
- -1 si le nombre de dimensions est inconnu, 0 si la forme représente un scalaire, 1 pour un vecteur, 2 pour une matrice etc.
Scalaire de forme statique public ()
Créez une forme représentant une valeur scalaire.
taille longue publique (int i)
La taille de la i-ème dimension.
Retours
- La taille de la dimension demandée ou -1 si elle est inconnue.
chaîne publique versString ()
Description succincte de la forme destinée au débogage.
forme statique publique inconnue ()
Créez une forme représentant un nombre inconnu de dimensions.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[],[],null,["# Shape\n\npublic final class **Shape** \nThe possibly partially known shape of a tensor produced by an operation. \n\n### Public Methods\n\n|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| boolean | [equals](/api_docs/java/org/tensorflow/Shape#equals(java.lang.Object))(Object obj) |\n| int | [hashCode](/api_docs/java/org/tensorflow/Shape#hashCode())() |\n| static [Shape](/api_docs/java/org/tensorflow/Shape) | [make](/api_docs/java/org/tensorflow/Shape#make(long,%20long...))(long firstDimensionSize, long... otherDimensionSizes) Create a Shape representing an N-dimensional value. |\n| int | [numDimensions](/api_docs/java/org/tensorflow/Shape#numDimensions())() Number of dimensions represented by this shape. |\n| static [Shape](/api_docs/java/org/tensorflow/Shape) | [scalar](/api_docs/java/org/tensorflow/Shape#scalar())() Create a Shape representing a scalar value. |\n| long | [size](/api_docs/java/org/tensorflow/Shape#size(int))(int i) The size of the i-th dimension. |\n| String | [toString](/api_docs/java/org/tensorflow/Shape#toString())() Succinct description of the shape meant for debugging. |\n| static [Shape](/api_docs/java/org/tensorflow/Shape) | [unknown](/api_docs/java/org/tensorflow/Shape#unknown())() Create a Shape representing an unknown number of dimensions. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public boolean\n**equals**\n(Object obj)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| obj | |\n|-----|---|\n\n#### public int\n**hashCode**\n()\n\n\u003cbr /\u003e\n\n#### public static [Shape](/api_docs/java/org/tensorflow/Shape)\n**make**\n(long firstDimensionSize, long... otherDimensionSizes)\n\nCreate a Shape representing an N-dimensional value.\n\nCreates a Shape representing an N-dimensional value (N being at least 1), with the provided\nsize for each dimension. A -1 indicates that the size of the corresponding dimension is\nunknown. For example:\n\n // A 2-element vector.\n Shape vector = Shape.create(2);\n\n // A 2x3 matrix.\n Shape matrix = Shape.create(2, 3);\n\n // A matrix with 4 columns but an unknown number of rows.\n // This is typically used to indicate the shape of tensors that represent\n // a variable-sized batch of values. The Shape below might represent a\n // variable-sized batch of 4-element vectors.\n Shape batch = Shape.create(-1, 4);\n \n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| firstDimensionSize | |\n| otherDimensionSizes | |\n|---------------------|---|\n\n#### public int\n**numDimensions**\n()\n\nNumber of dimensions represented by this shape. \n\n##### Returns\n\n- -1 if the number of dimensions is unknown, 0 if the shape represents a scalar, 1 for a vector, 2 for a matrix etc. \n\n#### public static [Shape](/api_docs/java/org/tensorflow/Shape)\n**scalar**\n()\n\nCreate a Shape representing a scalar value. \n\n#### public long\n**size**\n(int i)\n\nThe size of the i-th dimension. \n\n##### Parameters\n\n| i | |\n|---|---|\n\n##### Returns\n\n- The size of the requested dimension or -1 if it is unknown. \n\n#### public String\n**toString**\n()\n\nSuccinct description of the shape meant for debugging. \n\n#### public static [Shape](/api_docs/java/org/tensorflow/Shape)\n**unknown**\n()\n\nCreate a Shape representing an unknown number of dimensions."]]