[Tensorflow] ValueError: Can't convert Python sequence with mixed types to Tensor.
·
Tensorflow
문제의 코드다. c는 어떤 스칼라 값이고, 당연히 tf.constant를 통해 배열을 만들어낼 수 있다고 생각했으나 tf.constant 쪽에서 오류가 떴다. ValueError: Can't convert Python sequence with mixed types to Tensor.python 배열에 왜 뜬금없이 Tensor가 있냐고 불평한다. c의 타입은 당연히 EagarTensor이고, 그래프 모드로 가면 그냥 Tensor가 될것이다. tf.constant를 만들때는 순수 python 배열만 넣어야하는걸까?       [첫번째 가설] 배열에 scalar tensor만 넣는건 어떨까?ValueError: Can't convert Python sequence with mixed types to Tenso..
[Tensorflow] ValueError: 'x' has shape (h, w, c) before the loop, but shape (None, w, c) after one iteration. Use tf.autograph.experimental.set_loop_options to set shape invariants.
·
Tensorflow
제목이 좀 긴데, 해당 에러는 그래프 연산 모드에서 반복문을 사용할 경우 마주할 수 있는 에러이다. ValueError: 'x' has shape (h, w, c) before the loop, but shape (None, w, c) after one iteration. Use tf.autograph.experimental.set_loop_options to set shape invariants. 오류가 난 코드를 함께 보자. def cutout( x, patch_count, patch_base_factor, patch_width_factor, patch_height_factor ): out_x = x + 0. for i in range(patch_count): pw = tf.random.uniform..