Avviso: questa API è obsoleta e verrà rimossa in una versione futura di TensorFlow dopo che la sostituzione sarà stabile.
Shape
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
La forma forse parzialmente conosciuta di un tensore prodotto da un'operazione.
Metodi pubblici
booleano | |
int | |
Forma statica | marca (lungo firstDimensionSize, lungo... otherDimensionSizes) Crea una forma che rappresenta un valore N-dimensionale. |
int | |
Forma statica | scalare () Crea una forma che rappresenta un valore scalare. |
lungo | dimensione (int i) La dimensione della i-esima dimensione. |
Corda | aStringa () Descrizione concisa della forma destinata al debug. |
Forma statica | sconosciuto () Crea una forma che rappresenta un numero sconosciuto di dimensioni. |
Metodi ereditati
Dalla classe java.lang.Object booleano | è uguale a (Oggetto arg0) |
Classe finale<?> | getClass () |
int | codicehash () |
vuoto finale | avvisare () |
vuoto finale | notificaTutti () |
Corda | aStringa () |
vuoto finale | attendere (lungo arg0, int arg1) |
vuoto finale | aspetta (lungo arg0) |
vuoto finale | Aspettare () |
Metodi pubblici
booleano pubblico è uguale a (Oggetto obj)
public static Shape make (long firstDimensionSize, long... otherDimensionSizes)
Crea una forma che rappresenta un valore N-dimensionale.
Crea una forma che rappresenta un valore N-dimensionale (N è almeno 1), con la dimensione fornita per ogni dimensione. Un -1 indica che la dimensione della dimensione corrispondente è sconosciuta. Per esempio:
// 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);
Parametri
primaDimensionSize | |
---|
altredimensioni | |
---|
public int numDimensioni ()
Numero di dimensioni rappresentate da questa forma.
Ritorni
- -1 se il numero di dimensioni è sconosciuto, 0 se la forma rappresenta uno scalare, 1 per un vettore, 2 per una matrice ecc.
pubblica statica Forma scalare ()
Crea una forma che rappresenta un valore scalare.
dimensione lunga pubblica (int i)
La dimensione della i-esima dimensione.
Ritorni
- La dimensione della dimensione richiesta o -1 se è sconosciuta.
stringa pubblica toString ()
Descrizione concisa della forma destinata al debug.
forma statica pubblica sconosciuta ()
Crea una forma che rappresenta un numero sconosciuto di dimensioni.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 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."]]