Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reshape_out = Reshape((21, 3), input_shape=(21*3,), name='reshape_to_21_3')(output3d)
- def proj_output_shape(shp):
- return (None, 32, 32, 1)
- def f(x):
- import tensorflow as tf
- batch_size = K.shape(x)[0]
- print('x.shape={0}'.format(x.shape))
- idx = K.cast(x[:, :, 0:2]*15.5+15.5, "int64")
- print('idx.shape={0}'.format(idx.shape))
- # z = mysparse_to_dense(idx, (K.shape(x)[0], 32, 32), 1.0, 0.0, name='sparse_tensor')
- updates = tf.ones([batch_size, 21])
- print('updates.shape={0}'.format(updates.shape))
- z = tf.scatter_nd(indices=idx,
- updates=updates,
- shape = (K.shape(x)[0], 32, 32),
- name='cool')
- print('z={0}'.format(z))
- z = tf.add(z, z)
- #z = tf.sparse_add(tf.zeros(z.dense_shape), z)
- z = K.reshape(z, (K.shape(x)[0], 32, 32, 1))
- fil = make_kernel(1.0)
- fil = K.reshape(fil, (5, 5, 1, 1))
- print('z.shape={0}'.format(z.shape), z)
- print('fil.shape={0}'.format(fil.shape), fil)
- r = K.conv2d(z,kernel=fil, padding='same', data_format="channels_last")
- print('r.shape={0}'.format(r.shape), r)
- return r
- proj_out = Lambda(lambda x: f(x),
- output_shape=proj_output_shape, name='projection')(reshape_out)
- x.shape=(?, 21, 3)
- idx.shape=(?, 21, 2)
- updates.shape=(?, 21)
- ValueError: The inner 1 dimensions of output.shape=[?,?,?] must match the inner 0 dimensions of updates.shape=[?,21]: Shapes must be equal rank, but are 1 and 0 for 'projection_20/cool' (op: 'ScatterNd') with input shapes: [?,21,2], [?,21], [3].
Add Comment
Please, Sign In to add comment