4 examples of 'python list shape' in Python

Every line of 'python list shape' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
28def shape_list(x):
29 """Return list of dims, statically where possible."""
30 x = tf.convert_to_tensor(x)
31
32 # If unknown rank, return dynamic shape
33 if x.get_shape().dims is None:
34 return tf.shape(x)
35
36 static = x.get_shape().as_list()
37 shape = tf.shape(x)
38
39 ret = []
40 for i in range(len(static)):
41 dim = static[i]
42 if dim is None:
43 dim = shape[i]
44 ret.append(dim)
45 return ret
214def shape_list(x):
215 """Return list of dims, statically where possible."""
216 x = tf.convert_to_tensor(x)
217
218 # If unknown rank, return dynamic shape
219 if x.get_shape().dims is None:
220 return tf.shape(x)
221
222 static = x.get_shape().as_list()
223 shape = tf.shape(x)
224
225 ret = []
226 for i, dim in enumerate(static):
227 if dim is None:
228 dim = shape[i]
229 ret.append(dim)
230 return ret
16def get_shape(data):
17 if isinstance(data, dict):
18 return None
19 elif hasattr(data, '__len__') and not isinstance(data, (text_type, binary_type)):
20 return __get_shape_helper(data)
21 else:
22 return None
47def shape_as_list(t):
48 return t.shape.as_list()

Related snippets