Returns the size of a tensor. This operation returns an integer representing the number of elements in `input`. For example: ``` # 't' is [[[1, 1,, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]] size(t) ==> 12 ```
(scope *Scope, input tf.Output, optional ...SizeAttr)
| 1822 | // size(t) ==> 12 |
| 1823 | // ``` |
| 1824 | func Size(scope *Scope, input tf.Output, optional ...SizeAttr) (output tf.Output) { |
| 1825 | if scope.Err() != nil { |
| 1826 | return |
| 1827 | } |
| 1828 | attrs := map[string]interface{}{} |
| 1829 | for _, a := range optional { |
| 1830 | a(attrs) |
| 1831 | } |
| 1832 | opspec := tf.OpSpec{ |
| 1833 | Type: "Size", |
| 1834 | Input: []tf.Input{ |
| 1835 | input, |
| 1836 | }, |
| 1837 | Attrs: attrs, |
| 1838 | } |
| 1839 | op := scope.AddOperation(opspec) |
| 1840 | return op.Output(0) |
| 1841 | } |
| 1842 | |
| 1843 | // Returns the rank of a tensor. |
| 1844 | // |