This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import torch | |
import keras | |
def pyt_to_keras(pytorch_model, keras_model): | |
""" | |
Given a PyTorch model, this method transfers the weight to | |
a Keras Model (with backend TensorFlow) with the same architecture. | |
Assumptions: | |
1. The corresponding layer names in both the models will be the same |