import%20marimo%0A%0A__generated_with%20%3D%20%220.24.0%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0Awith%20app.setup%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20pandas%20as%20pd%0A%20%20%20%20import%20tensorflow%20as%20tf%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20TensorFlow%20%E3%83%86%E3%83%B3%E3%82%BD%E3%83%AB%E6%93%8D%E4%BD%9C%E3%83%A1%E3%83%A2%0A%0A%20%20%20%20%E5%A4%89%E5%BD%A2%E3%83%BB%E6%8B%A1%E5%BC%B5%E3%83%BB%E5%8F%8D%E5%BE%A9%E3%83%BB%E5%88%86%E5%89%B2%E3%83%BB%E7%B5%90%E5%90%88%E3%83%BB%E7%B8%AE%E7%B4%84%E3%81%A8%E3%81%84%E3%81%A3%E3%81%9F%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C%E3%82%92%E3%80%81%0A%20%20%20%20%E5%B0%8F%E3%81%95%E3%81%AA%E3%83%86%E3%83%B3%E3%82%BD%E3%83%AB%E3%81%A7%E9%A0%86%E3%81%AB%E7%A2%BA%E8%AA%8D%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%E4%B9%B1%E6%95%B0%E3%82%B7%E3%83%BC%E3%83%89%E3%82%92%E5%9B%BA%E5%AE%9A%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E3%81%AE%E3%81%A7%E3%80%81%0A%20%20%20%20export%20%E5%AE%9F%E8%A1%8C%E6%99%82%E3%82%82%E5%90%8C%E3%81%98%E7%B5%90%E6%9E%9C%E3%82%92%E5%86%8D%E7%8F%BE%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%99%E3%80%82%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20tf.keras.utils.set_random_seed(42)%0A%20%20%20%20device_summary%20%3D%20pd.DataFrame(%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22device_type%22%3A%20%5B%22CPU%22%2C%20%22GPU%22%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22visible_devices%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20len(tf.config.list_physical_devices(%22CPU%22))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20len(tf.config.list_physical_devices(%22GPU%22))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%0A%20%20%20%20device_summary%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20a_tensor%20%3D%20tf.random.uniform(shape%3D%5B4%2C%202%2C%203%5D%2C%20minval%3D-10%2C%20maxval%3D10%2C%20dtype%3Dtf.float64)%0A%20%20%20%20b_tensor%20%3D%20tf.constant(%5B%5B%5B1%2C%203%2C%205%5D%2C%20%5B7%2C%2011%2C%2013%5D%5D%5D%2C%20dtype%3Dtf.float64)%0A%20%20%20%20return%20a_tensor%2C%20b_tensor%0A%0A%0A%40app.cell%0Adef%20_(a_tensor%2C%20b_tensor)%3A%0A%20%20%20%20reshaped%20%3D%20tf.reshape(a_tensor%2C%20shape%3D(-1%2C%203%2C%202))%0A%20%20%20%20expanded%20%3D%20tf.expand_dims(a_tensor%2C%20axis%3D2)%0A%20%20%20%20padded%20%3D%20tf.pad(a_tensor%2C%20paddings%3D%5B%5B0%2C%200%5D%2C%20%5B0%2C%200%5D%2C%20%5B0%2C%201%5D%5D)%0A%20%20%20%20tiled%20%3D%20tf.tile(a_tensor%2C%20multiples%3D(1%2C%201%2C%202))%0A%20%20%20%20tiled_with_axis%20%3D%20tf.tile(tf.expand_dims(a_tensor%2C%200)%2C%20%5B2%2C%201%2C%201%2C%201%5D)%0A%20%20%20%20split_tensors%20%3D%20tf.split(a_tensor%2C%20num_or_size_splits%3D%5B2%2C%201%5D%2C%20axis%3D-1)%0A%20%20%20%20concatenated%20%3D%20tf.concat(%5Ba_tensor%2C%20b_tensor%5D%2C%20axis%3D0)%0A%20%20%20%20squeezed%20%3D%20tf.squeeze(tf.expand_dims(a_tensor%2C%20axis%3D2))%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20concatenated%2C%0A%20%20%20%20%20%20%20%20expanded%2C%0A%20%20%20%20%20%20%20%20padded%2C%0A%20%20%20%20%20%20%20%20reshaped%2C%0A%20%20%20%20%20%20%20%20split_tensors%2C%0A%20%20%20%20%20%20%20%20squeezed%2C%0A%20%20%20%20%20%20%20%20tiled%2C%0A%20%20%20%20%20%20%20%20tiled_with_axis%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20_(%0A%20%20%20%20a_tensor%2C%0A%20%20%20%20b_tensor%2C%0A%20%20%20%20concatenated%2C%0A%20%20%20%20expanded%2C%0A%20%20%20%20padded%2C%0A%20%20%20%20reshaped%2C%0A%20%20%20%20split_tensors%2C%0A%20%20%20%20squeezed%2C%0A%20%20%20%20tiled%2C%0A%20%20%20%20tiled_with_axis%2C%0A)%3A%0A%20%20%20%20operation_table%20%3D%20pd.DataFrame(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22original%20a_tensor%22%2C%20tuple(a_tensor.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22original%20b_tensor%22%2C%20tuple(b_tensor.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22reshape(-1%2C%203%2C%202)%22%2C%20tuple(reshaped.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22expand_dims(axis%3D2)%22%2C%20tuple(expanded.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22pad(last%20axis%20%2B1)%22%2C%20tuple(padded.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22tile(multiples%3D(1%2C1%2C2))%22%2C%20tuple(tiled.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22tile(expand_dims%2C%20%5B2%2C1%2C1%2C1%5D)%22%2C%20tuple(tiled_with_axis.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22split%20sizes%20%5B2%2C1%5D%22%2C%20%5Btuple(item.shape)%20for%20item%20in%20split_tensors%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22concat(axis%3D0)%22%2C%20tuple(concatenated.shape))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22squeeze(expand_dims(...))%22%2C%20tuple(squeezed.shape))%2C%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20columns%3D%5B%22operation%22%2C%20%22shape%22%5D%2C%0A%20%20%20%20)%0A%20%20%20%20operation_table%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(concatenated%2C%20expanded%2C%20padded%2C%20split_tensors)%3A%0A%20%20%20%20mo.tabs(%7B%22expanded%22%3A%20expanded%2C%20%22padded%22%3A%20padded%2C%20%22split%5B0%5D%22%3A%20split_tensors%5B0%5D%2C%20%22split%5B1%5D%22%3A%20split_tensors%5B1%5D%2C%20%22concatenated%22%3A%20concatenated%7D)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
f06a6636114e8f6b3baec212b70dde6d